combobox的那个下键头如何才透明(即与表单背景色一致

faqing 2005-03-23 01:17:15
在delphi中combobox,updown的那个键头下的灰色背景,如何才能透明(或者说是更改为与表单背景色一致)
...全文
357 23 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
王集鹄 2005-04-17
  • 打赏
  • 举报
回复
//放一个SpeedButton在ComboBox中,在SpeedButton中用图片 :)
procedure TForm1.FormCreate(Sender: TObject);
begin
SpeedButton1.Height := ComboBox1.ClientHeight - 3;
SpeedButton1.Width := ComboBox1.ClientHeight - 3;
SpeedButton1.Parent := ComboBox1;
SpeedButton1.Left := ComboBox1.ClientWidth - SpeedButton1.Width - 2;
SpeedButton1.Top := 2;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
ComboBox1.DroppedDown := not ComboBox1.DroppedDown;
end;
linzhengqun 2005-04-17
  • 打赏
  • 举报
回复
上面的ComboBox1.Canvas.Polygon(Ap);去掉吧,你自己设计一个样式,或者用图片。
g961681 2005-04-17
  • 打赏
  • 举报
回复
要收藏!
linzhengqun 2005-04-17
  • 打赏
  • 举报
回复
以下方法仅供参考,具体自己画出来:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
ComboBox1: TComboBox;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
CBOldProc: TWndMethod;
public
{ Public declarations }
procedure CBNewWndProc(var message: TMessage);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.CBNewWndProc(var message: TMessage);
var
cbInfo: TComboBoxInfo;
AP: array [0..2] of TPoint;
begin
if message.Msg = WM_PAINT then
begin
CBOldProc(Message);
cbInfo.cbSize:= SizeOf(cbInfo);
GetComboBoxInfo(ComboBox1.Handle, cbInfo);
ComboBox1.Canvas.Pen.Width:= 1;
ComboBox1.Canvas.Brush.Style:= bsSolid;
if cbInfo.stateButton = STATE_SYSTEM_PRESSED then
ComboBox1.Canvas.Brush.Color:= clGreen
else
ComboBox1.Canvas.Brush.Color:= clRed;
ComboBox1.Canvas.Rectangle(cbInfo.rcButton);
ComboBox1.Canvas.Brush.Color:= clBlack;
ComboBox1.Canvas.Polygon(Ap);
end
else
CBOldProc(Message);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
CBOldProc:= Combobox1.WindowProc;
ComboBox1.WindowProc:= CBNewWndProc;
end;

end.
real_name 2005-04-17
  • 打赏
  • 举报
回复
第3方 控件集 的名字叫 IP3000
它有很多很好用的 控件
real_name 2005-04-17
  • 打赏
  • 举报
回复
打错了 ,是wwDBcombobox
real_name 2005-04-17
  • 打赏
  • 举报
回复
我用的是FlatStyle控件,
ideacao 2005-04-17
  • 打赏
  • 举报
回复
改控件的ParentColor试试
faqing 2005-04-17
  • 打赏
  • 举报
回复
但你这个说法就不合理阿

请问什么说法不合理?
xjwy 2005-04-12
  • 打赏
  • 举报
回复
呵呵,不是不帮你,但你这个说法就不合理阿
faqing 2005-04-12
  • 打赏
  • 举报
回复
UP
faqing 2005-04-06
  • 打赏
  • 举报
回复
大虾帮忙啊
faqing 2005-03-29
  • 打赏
  • 举报
回复
这里不能贴图我将效果图放在下面:http://www.myf1.net/bbs/dispbbs.asp?boardID=5&ID=273922
Heyongfeng 2005-03-28
  • 打赏
  • 举报
回复
faqing 2005-03-27
  • 打赏
  • 举报
回复
沉得太快啦,顶一下!大虾帮忙啊
herman~~ 2005-03-27
  • 打赏
  • 举报
回复
不用代码 ,那你可以去修改combox的源代码呀
才子鸣 2005-03-27
  • 打赏
  • 举报
回复
up
dejoy 2005-03-27
  • 打赏
  • 举报
回复
SStallMan 2005-03-27
  • 打赏
  • 举报
回复
用用FlatStyle控件试一试,代码当然可以解决,只是不会
faqing 2005-03-25
  • 打赏
  • 举报
回复
只用代码真的就没法解决吗?
加载更多回复(3)

5,928

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧