Tcombobox没有borderstyle属性,我需要如何创建一个没有三维外观和边框的ComboBox,怎么办?

pipimei 2001-04-19 09:31:00
...全文
100 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
pipimei 2001-04-22
  • 打赏
  • 举报
回复
FlatStyler在哪里?
王集鹄 2001-04-22
  • 打赏
  • 举报
回复
//我用的是一个变态的方法
//就是用面板将其边界盖住

unit Unit1;

interface

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

type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Button1: TButton;
ComboBox2: TComboBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure bsNoneComboBox(mComboBox: TComboBox);
begin
with TPanel.Create(mComboBox) do begin
Parent := mComboBox.Parent;
Width := mComboBox.Width;
Top := mComboBox.Top;
Left := mComboBox.Left;
ParentColor := True;
Height := 2;
BevelOuter := bvNone;
end;

with TPanel.Create(mComboBox) do begin
Parent := mComboBox.Parent;
Width := mComboBox.Width;
Top := mComboBox.Top + mComboBox.Height - 1;
Left := mComboBox.Left;
ParentColor := True;
Height := 2;
BevelOuter := bvNone;
end;

with TPanel.Create(mComboBox) do begin
Parent := mComboBox.Parent;
Width := mComboBox.Width;
Top := mComboBox.Top;
Left := mComboBox.Left;
ParentColor := True;
Height := mComboBox.Height;
Width := 2;
BevelOuter := bvNone;
end;

with TPanel.Create(mComboBox) do begin
Parent := mComboBox.Parent;
Width := mComboBox.Width;
Top := mComboBox.Top;
Left := mComboBox.Left + mComboBox.Width - 1;
ParentColor := True;
Height := mComboBox.Height;
Width := 2;
BevelOuter := bvNone;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
bsNoneComboBox(ComboBox2);
end;

end.

//dfm
object Form1: TForm1
Left = 192
Top = 107
Width = 544
Height = 375
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ComboBox1: TComboBox
Left = 32
Top = 16
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 0
Text = 'ComboBox1'
end
object Panel1: TPanel
Left = 24
Top = 36
Width = 185
Height = 10
BevelOuter = bvNone
TabOrder = 1
end
object Panel2: TPanel
Left = 32
Top = 36
Width = 145
Height = 10
BevelOuter = bvNone
TabOrder = 2
end
object Panel3: TPanel
Left = 33
Top = 8
Width = 141
Height = 10
BevelOuter = bvNone
TabOrder = 3
end
object Panel4: TPanel
Left = 9
Top = 7
Width = 25
Height = 45
BevelOuter = bvNone
TabOrder = 4
end
object Panel5: TPanel
Left = 175
Top = 3
Width = 25
Height = 45
BevelOuter = bvNone
TabOrder = 5
end
object Button1: TButton
Left = 272
Top = 128
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 6
OnClick = Button1Click
end
object ComboBox2: TComboBox
Left = 320
Top = 32
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 7
Text = 'ComboBox2'
end
end
lichp 2001-04-19
  • 打赏
  • 举报
回复
去下载一个FlatStyler的控件包吧,里边有你想要的东西!
Apollo47 2001-04-19
  • 打赏
  • 举报
回复
你可以用 edit, button, listbox 拼成一个
combobox.
pipimei 2001-04-19
  • 打赏
  • 举报
回复
现成的控件也可以,但最好有源代码。

再把这个问题引申一下,控件的3D边框的颜色都是系统默认的,如果我想修改,可能做到吗?

5,388

社区成员

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

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