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.

来源:https://www.cnblogs.com/zhangzhifeng/p/9935245.html

相关阅读 >>

Delphi 获取闪盘列表

Delphi fdmemtable1内存表字段排序

Delphi winapi: getdesktopwindow - 返回桌面窗口的句柄

Delphi for 循环 to和downto的理解

Delphi 时间控制窗口标题栏文字或任务栏标题文字滚动

Delphi 调用驱动

Delphi获取本机的ip地址

Delphi简单的播放声音

Delphi 通过 shgetspecialfolderlocation、shgetpathfromidlist 函数获取常用路径

datasnap服务器如何得到客户端的ip和端口

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...