请问下面的安钮要怎么做出来????? (100分)

  • 主题发起人 主题发起人 Meclo
  • 开始时间 开始时间
M

Meclo

Unregistered / Unconfirmed
GUEST, unregistred user!
http://www.ejsp.net/snap034.jpg

http://www.ejsp.net/snap035.jpg

请问在DELPHI里这种按钮如何做出来 ?
 
xp类型的平面控件
也可以用image控件来做,上面放2幅图片
 
小熊跳舞的答案够精彩
 
请问这个控件要到哪下载?
 
很简单啊,你首先用photoshop做一个图片,然后在找一个可以放图片的按纽就行了,我就是
这么做的
 
小弟没明白意思.

小弟的意思是按钮,不是按钮里的正方形的图...
 
TspeedButton

在Additional页上面的第二个控件
设置Flat属性
 
用皮肤吧,Playicq.com找skin
 
这种圆角的按钮制作其实也是不难的,下面这个例子可以产生圆角按钮,然后在按钮上贴图
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Edit2: TEdit;
Panel1: TPanel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure MakeRounded(Control: TWinControl);
var
R: TRect;
Rgn: HRGN;
begin
with Control do
begin
R := ClientRect;
rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 20, 20);
Perform(EM_GETRECT, 0, lParam(@r));
InflateRect(r, -5, -5);
Perform(EM_SETRECTNP, 0, lParam(@r));
SetWindowRgn(Handle, rgn, True);
Invalidate;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.BorderStyle := bsNone;
MakeRounded(Memo1);

Edit2.BorderStyle := bsNone;
MakeRounded(Edit2);

MakeRounded(Panel1);

//button1.BorderStyle := bsNone;
MakeRounded(button2);

end;

end.
 
楼上的哥哥的办法好是好,可是我觉得做起来还是不太美观啊。
 
flatStyle系列控件
www.playicq.com上有下载,界面类
 
duxbin说的对,
TspeedButton控件
在Additional页上面的第二个控件
flat=true
Glyph属性设置图片

还有一个可以实现有图片的button
TBitBtn控件
在Additional页上面的第一个控件
设置Glyph属性

快点散分把
(我用的delphi7)
 
个你写一各吧,其他功能自己去加
unit XPButton;

interface

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

type
TXPButton = class(TCustomControl)
private
FCaption: string;
FMouseIn: Boolean;
FICON: TICON;
procedure SetMouseIn(const Value: Boolean);
procedure SetICON(const Value: TICON);

protected
procedure Paint; override;
property MouseIn: Boolean read FMouseIn write SetMouseIn;
procedure CMMouseenter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseleave(var Message: TMessage); message CM_MOUSELEAVE;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Caption: string read FCaption write FCaption;
property ICON: TICON read FICON write SetICON;
property OnClick;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('WRCtrl', [TXPButton]);
end;

procedure TXPButton.CMMouseenter(var Message: TMessage);
begin
inherited;
MouseIn := True;
end;

procedure TXPButton.CMMouseleave(var Message: TMessage);
begin
inherited;
MouseIn := False;
end;

constructor TXPButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FICON := TICON.Create;
end;

destructor TXPButton.Destroy;
begin
FICON.Free;
inherited Destroy;
end;

procedure TXPButton.Paint;
var
ARect : TRect;
ICONPos : Integer;
begin
inherited Paint;
ARect := ClientRect;
with Canvas, ARect do
begin
Brush.Color := RGB(255, 251, 247);
FillRect(Arect);

if (FMouseIn) and (not (csDesigning in ComponentState)) then
begin
Inc(Left, 2);
Inc(Top, 2);
Brush.Style := bsSolid;
brush.Color := clGray;
Pen.Color := clMenu;
RoundRect(Left, Top, Right, Bottom, 5, 5);

brush.Color := RGB(175, 183, 207);
Dec(Left, 2);
Dec(Top, 2);
Dec(Right, 2);
Dec(Bottom, 2);
Pen.Color := clBlack;
RoundRect(Left, Top, Right, Bottom, 5, 5);
end;
if FICON <> nil then
begin
ICONPos := (Height - FICON.Height) div 2;
Draw(ICONPos, ICONPos, FICON);
end;
Brush.Style := bsClear;
Inc(ARect.Left, ICONPos + FICON.Width);
DrawText(Handle, PChar(FCaption), -1, ARect, DT_CENTER or DT_SINGLELINE or
DT_VCENTER);
end;
end;

procedure TXPButton.SetICON(const Value: TICON);
begin
if Assigned(Value) then
FICON.Assign(Value);
end;

procedure TXPButton.SetMouseIn(const Value: Boolean);
begin
FMouseIn := Value;
Repaint;
end;

end.
 
要实现类似XP界面,有不少控件做得比较好
也可以试试v6.0版的cmdlg32.dll
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部