OrangeUI

拖一个ListBox到窗体上,
双击ListBox就能弹出项目编辑器,
用于添加、编辑、删除列表项,

点击项目编辑器上的”添加”按钮,
添加多个ListBoxItem,
并设置好ListBoxItem的标题和图标:

由于默认的ListBox没有自己的样式,
会出现显示重叠的情况(标题默认在左上角,图标默认也显示原始尺寸)
如下图所示:

我们先调整一下图标,让它自适应大小,并且垂直居中:
DrawItemIconParam.IsAutoFit设置为True,
DrawItemIconParam.PictureVertAlign设置为pvaCenter,
这样图标不会显示得太大:

接着我们调整标题,让它显示在图标的右边,并且字体稍微设大一点,
DrawItemCaption.DrawFont.Size设置为14,
DrawItemCaption.DrawRectSetting.Enabled设置为True,
DrawItemCaption.DrawRectSetting.SizeType设置为dpstPixel,
DrawItemCaption.DrawRectSetting.Left设置为65,
DrawItemCaption.DrawRectSetting.Top设置为10,


上面图标显示得太大了,需要调整得小一点,
DrawItemIconParam.DrawRectSetting.Enabled设置为True,
DrawItemIconParam.DrawRectSetting.SizeType设置为dpstPixel,
DrawItemIconParam.DrawRectSetting.Left设置6,
DrawItemIconParam.DrawRectSetting.Height设置为50,
DrawItemIconParam.DrawRectSetting.PositionVertType设置为dppvtCenter,

再把ListBox的背景色设置成白色,
SelfOwnMaterial.IsTransparent设置为False,
SelfOwnMaterial.BackColor.IsFill设置为True,
SelfOwnMaterial.BackColor.FillColor设置为白色,

还需完善下面两点,
第一点是每个列表项之间添加分隔线,
把SelfOwnMaterial.DrawItemDevideParam.IsFill设置为True就可以了,

第二点是鼠标点击列表项的时候显示淡灰的背景色,
找到DrawItemBackColorParam.DrawEffectSetting.MouseDownEffect,
EffectTypes设置为drpetFillColorChange和drpetIsFillChange,
FillColor设置为LightGray,
IsFill设置为True,
在运行时用鼠标点击一下试试: