使用dxBarManager1创建一个TdxBarSubItem类型的用于菜单,这个会吧.然后
设置TdxBarSubItem的BarSize属性,这个属性是要显示图像的宽度.然后在TdxBarSubItem
的OnPaintBar事件中写入以下代码(我是从Demo)中Copy的.根据你的图像大小可以
更改.
procedure TForm1.dxBarSubItemFilePaintBar(Sender: TObject; Canvas: TCanvas;
const R: TRect);
var
SR, BR: TRect;
begin
DrawVerticalGradient(Canvas, R, 0, 0, 0, 0, 0, 255);
SR := R;
with iBars4.Picture.Bitmap do
begin
TransparentColor := clBlack;
BR := Rect(0, 0, Width, Height);
end;
with SR do
begin
Left := (Left + Right - BR.Right) div 2;
Right := Left + BR.Right;
Top := Bottom - BR.Bottom;
end;
if SR.Top > 0 then
with Canvas do
begin
Brush.Style := bsClear;
BrushCopy(SR, iBars4.Picture.Bitmap, BR, clBlack);
Brush.Style := bsSolid;
end;
end;