, Length(sText), ARect, DT_LEFT or DT_VCENTER or DT_SINGLELINE);
end;
end;
// 画边框的,效果是平面的
mWnd := WindowFromDC(ACanvas.Handle);
if mWnd <> Self.Handle then begin
cTemp := TCanvas.Create();
cTemp.Handle := GetDC(0);
Windows.GetWindowRect(mWnd, rMenu);
cTemp.Brush.Color := RGB(120, 120, 120);
cTemp.FrameRect(rMenu);
InflateRect(rMenu, -1, -1);
cTemp.Brush.Color := RGB(240, 240, 240);
cTemp.FrameRect(rMenu);
InflateRect(rMenu, -1, -1);
cTemp.FrameRect(rMenu);
ReleaseDC(0, cTemp.Handle);
cTemp.Free();
end;
end;
procedure TfrmMain.MeasureMenu(Sender: TObject; ACanvas: TCanvas; var Width, Height: Integer);
begin
Inc(Width,50);//调整菜单的宽度
inc(height,15);//调整每一个item的高度,这一句可以不要,使用默认值
end;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
bmp1:=tbitmap.Create;
bmp1.loadfromfile(''e:\aaa.bmp'');
end;
procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
bmp1.Free;
end;
end.