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 getexplorerpid获取系统explorer.exe进程id

Delphi读取excel文件-统计全部工作表中内容相同单元格出现次数

Delphi窗口最小化和还原事件捕获

Delphi xe taskbar按钮用法

5种运行程序的方法具体应用实例

Delphi shellexecute多种用法

Delphi tlistbox添加横向滚动条

Delphi 在xp/2k 下实现 win+ctrl+del 等键的屏蔽的方法

Delphi 截屏函数(包含截取鼠标形状)

Delphi 字符串中末位是双字节字符的处理(避免最后一位为乱码)

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



打赏

取消

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

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

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

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

评论

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