delphi button 实现下拉列表

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
PopupMenu1: TPopupMenu;
fgh1: TMenuItem;
drg1: TMenuItem;
dg1: TMenuItem;
procedure Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
pt:TPoint;
begin
GetCursorPos(pt);
PopupMenu1.Popup((pt.x-x),(pt.y+(Button1.Height-y))); end; end.

 简单的一种下拉列表

上一篇:必要的软件架构师——编译原理·语法


下一篇:SpringCloud学习(6)——Hystrix熔断器