6
我想在Delphi/Win32的组合框(右侧边缘)内绘制图像。在Delphi/Win32中将图像放入组合框(右侧边缘)
组合框的风格为csDropDown。这不适用于csOwnerDrawFixed或csOwnerDrawVariable。
组合框应该是可编辑的,类似于浏览器的地址栏。
有没有创建一个额外的Delphi组件的Win32解决方案?
我试过以下,但它不起作用。我可以用Delphi 7来做到吗?
TForm1 = class(TForm)
...
private
FChDirComboWndProc: TWndMethod;
procedure ChDirComboWndProc(var Message: TMessage);
...
procedure TForm1.FormCreate(Sender: TObject);
begin
FChDirComboWndProc := ChDirComboBox.WindowProc; // save old window proc
ChDirComboBox.WindowProc := ChDirComboWndProc; // subclass
end;
procedure TForm1.ChDirComboWndProc(var Message: TMessage);
begin
WM_ERASEBKGND: begin // WM_PAINT ?
SetBkMode(Message.WParam, TRANSPARENT);
SetTextColor(Message.wParam, GetSysColor(COLOR_GRAYTEXT));
FillRect(Message.wParam, Rect(3,3,300,30), GetStockObject(BLACK_BRUSH));
Rectangle(Message.wParam, 15,15, 100, 100); //Test
OutputDebugString(PCHar(Format('aa %d %d %d',[Message.WParam, Message.LParam, ChDirComboBox.Handle])));
end;
end;
FChDirComboWndProc(Message); // process message
end;
组合框的样式为** csDropDown **。这不适用于csOwnerDrawFixed或csOwnerDrawVariable。组合框应该是可编辑的,类似于浏览器的地址栏。我会将这些信息添加到我的问题中,遗憾的是忘记了这一点。 – Codr