using DevExpress.XtraTreeList;
using DevExpress.XtraEditors;
using DevExpress.Utils;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : XtraForm
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 팝업 컨트롤
/// </summary>
private PopupControl popupControl;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 팝업 컨트롤 - PopupControl
/// <summary>
/// 팝업 컨트롤
/// </summary>
PopupControl PopupControl
{
get
{
if(this.popupControl == null)
{
this.popupControl = new PopupControl();
}
return this.popupControl;
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
this.toolTipController.GetActiveObjectInfo += toolTipController_GetActiveObjectInfo;
this.treeList.DataSource = DataHelper.GetInformationBindingList(10);
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 툴팁 컨트롤러 액티브 객체 정보 구하기 - toolTipController_GetActiveObjectInfo(sender, e)
/// <summary>
/// 툴팁 컨트롤러 액티브 객체 정보 구하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void toolTipController_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e)
{
TreeList treeList = e.SelectedControl as TreeList;
if(treeList != null)
{
TreeListHitInfo hitInfo = treeList.CalcHitInfo(e.ControlMousePosition);
Information information = (Information)treeList.GetDataRecordByNode(hitInfo.Node);
if(hitInfo.HitInfoType == HitInfoType.Cell)
{
e.Info = new ToolTipControlInfo();
e.Info.Object = $"컬럼={hitInfo.Column.FieldName}, 노드 ID={hitInfo.Node.Id}";
e.Info.FlyoutControl = PopupControl;
PopupControl.UpdateInformation(information);
}
}
}
#endregion
}
}