效果如图所示,CheckedListBoxControl 的项内容并不能完整显示,所以需要加一个工具提示。
代码如下:
private void ToolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
{
if (e.SelectedControl == checkedListBoxControl1)
{
BaseListBoxViewInfo vi = checkedListBoxControl1.GetViewInfo() as BaseListBoxViewInfo;
CheckedItemInfo itemInfo = vi.GetItemInfoByPoint(e.ControlMousePosition) as CheckedItemInfo;
if(itemInfo != null && itemInfo.CheckArgs.CheckState == CheckState.Checked)
{
e.Info = new ToolTipControlInfo() { ToolTipType = ToolTipType.SuperTip, Object = itemInfo };
var itemTreeListToolTip = new SuperToolTip();
SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
args.Title.Text = "Title";
args.Contents.Text = itemInfo.Text;
args.Contents.Image = Properties.Resources.Image;
itemTreeListToolTip.Setup(args);
e.Info.SuperTip = itemTreeListToolTip;
}
}
}
完整代码已上传。