8
8387815
Unregistered / Unconfirmed
GUEST, unregistred user!
//***********************************************************//
// 功能:在按钮按下时在它下方立即弹出菜单(用BitBtn可以) //
//***********************************************************//
unit UnitFlatMenuBtn;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, CommCtrl,
ExtCtrls,Menus,TFlatButtonUnit;
type
TFlatMenuBtn = class(TFlatButton)
{ Protected declarations }
public
constructor Create(AOwner: TComponent); override;
procedure Click; override;
{ Public declarations }
published
{ AL: }
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TFlatMenuBtn]);
end;
constructor TFlatMenuBtn.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
layout:=blGlyphRight;
Font.Charset := GB2312_CHARSET;
Font.Color := clWindowText;
Font.Height := -12;
Font.Name := '宋体';
end;
procedure TFlatMenuBtn.Click;
var tmp:TPoint;
begin
inherited Click;
if Assigned(PopUpMenu) then
begin
{ calc where to put menu }
tmp := ClientToScreen(Point(0, Height));
PopUpMenu.Popup(tmp.X, tmp.Y);
end;
end;
end.
// 功能:在按钮按下时在它下方立即弹出菜单(用BitBtn可以) //
//***********************************************************//
unit UnitFlatMenuBtn;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, CommCtrl,
ExtCtrls,Menus,TFlatButtonUnit;
type
TFlatMenuBtn = class(TFlatButton)
{ Protected declarations }
public
constructor Create(AOwner: TComponent); override;
procedure Click; override;
{ Public declarations }
published
{ AL: }
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TFlatMenuBtn]);
end;
constructor TFlatMenuBtn.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
layout:=blGlyphRight;
Font.Charset := GB2312_CHARSET;
Font.Color := clWindowText;
Font.Height := -12;
Font.Name := '宋体';
end;
procedure TFlatMenuBtn.Click;
var tmp:TPoint;
begin
inherited Click;
if Assigned(PopUpMenu) then
begin
{ calc where to put menu }
tmp := ClientToScreen(Point(0, Height));
PopUpMenu.Popup(tmp.X, tmp.Y);
end;
end;
end.