网淘巴来吧,欢迎您!

返回首页 微信
微信
手机版
手机版

ActnMgrBar 使用实例

2021-08-13 新闻来源:网淘巴 围观:822
''

这个应用程序需要表单上已经有一个TPopupActionBar组件。应用程序创建一个action manager组件,并将一个图像列表分配给它的一些属性。然后,自定义弹出action bar 并将其assigned to表单的PopupMenu属性。右击表单显示弹出菜单。

Code

procedure TForm1.FormCreate(Sender: TObject);var  Images: TImageList;  Image: TBitmap;  ActionManager: TActionManager;  Option1, Option2: TMenuItem;begin  // display an information message  ShowMessage('Right click the form to display the customized popup menu');  // create an image list  Images := TImageList.Create(self);  Images.Height := 32;  Images.Width := 32;  try    Image := TBitmap.Create;    Image.Height := 32;    Image.Width := 32;    Image.Canvas.Font.Name := 'Times New Roman';    Image.Canvas.Font.Size := 22;    Image.Canvas.TextOut((Image.Width - Image.Canvas.TextWidth('1')) div 2, 0, '1');    Images.Add(Image, nil);  finally    Image.Free;  end;  // create an action manager and assign the image list to some of its properties  ActionManager := TActionManager.Create(self);  ActionManager.DisabledImages := Images;  ActionManager.LargeDisabledImages  := Images;  ActionManager.LargeImages := Images;  // add some items to the popup menu associated with the popup action bar  Option1:= TMenuItem.Create(self);  Option1.Caption := 'New';  PopupActionBar1.Items.Add(Option1);  Option2:= TMenuItem.Create(self);  Option2.Caption := 'Save';  PopupActionBar1.Items.Add(Option2);  // let the popup action bar be the form's popup menu  Form1.PopupMenu := PopupActionBar1;end;

翻译由网淘巴完成,转载必须标明出处:ActnMgrBar 使用实例_delphi_网淘巴 (wtao8.com)

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏

本文链接:https://www.wtao8.com/post/151.html 转载需授权!

分享到:

相关文章

  • ADOQuery (Delphi)使用实例
    ADOQuery (Delphi)使用实例

    此示例演示了使用 ADO 进行数据库连接。 该示例假设在窗体上放置了一个 DBGrid。 Code procedure TForm2.FormCreate(Sender: TObject); c...

    2021-08-13
  • AddChildObjectFirst使用实例
    AddChildObjectFirst使用实例

    下面的示例将一个新项目添加到the tree view 控件中所选项目的子项目列表中。新项目首先添加到子项目列表中。新项目由文本“new item”标识。TBitmap对象附加到the new ite...

    2021-08-13
  • ActivePage实例代码
    ActivePage实例代码

    这个例子要求form上已经有一个TPageControl。另外,您必须通过右击并选择New Page将页面添加到TPageControl中。示例代码允许您通过选择ComboBox项来选择ActiveP...

    2021-08-13
  • ActiveControl (Delphi)实例
    ActiveControl (Delphi)实例

    在窗体上放置一个TTimer对象,并在OnTimer事件中输入Timer1Timer。将其他控件放置在窗体上,并在运行时更改活动控件。下面的事件处理程序通过每100毫秒向右移动一个像素来响应计时器事件...

    2021-08-12
龙年
大发