欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Delphi菜單組件TMainMenu使用方法詳解

 更新時(shí)間:2017年11月30日 11:52:12   作者:癲狂編程  
這篇文章主要為大家詳細(xì)介紹了Delphi菜單組件TMainMenu的使用方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文為大家分享了菜單組件TMainMenud的使用方法,供大家參考,具體內(nèi)容如下

菜單組件TMainMenu

創(chuàng)建菜單雙擊TmenuMain,單擊Caption就可以添加一個(gè)菜單項(xiàng)

菜單中添加分割線只需加“-”就可以添加一個(gè)分割線

級(jí)聯(lián)菜單的設(shè)計(jì)

單擊鼠標(biāo)右鍵彈出菜單中選擇Create Submenu菜單項(xiàng)

單選功能設(shè)計(jì)

要在設(shè)計(jì)的菜單項(xiàng)目中選擇RadioItem屬性為T(mén)rue,Checked屬性為T(mén)rue

復(fù)選功能的設(shè)計(jì)

在設(shè)計(jì)菜單項(xiàng)目中選擇RadioItem屬性為False,Checked屬性為T(mén)rue

動(dòng)態(tài)創(chuàng)建菜單

源代碼如下

procedure TForm1.Button1Click(Sender: TObject);
var
 MainMenu: TMainMenu;
 MenuItem: TMenuItem;
begin
 //主菜單創(chuàng)建
 MainMenu:=TMainMenu.Create(self);
 Self.Menu:=MainMenu;
 //文件菜單創(chuàng)建
 MenuItem:= TMenuItem.Create(MainMenu);
 MenuItem.Caption:='文件';
 MainMenu.Items.Add(MenuItem);
 //新建子菜單創(chuàng)建
 MenuItem:=TMenuItem.Create(MainMenu);
 MenuItem.Caption:='新建';
 MainMenu.Items[0].Add(MenuItem);
 //子菜單中的子菜單創(chuàng)建
 MenuItem:= TMenuItem.Create(MainMenu);
 MenuItem.Caption:='打開(kāi)';
 MainMenu.Items[0].Items[0].Add(MenuItem);
 MenuItem:= TMenuItem.Create(MainMenu);
 MenuItem.Caption:='保存';
 MainMenu.Items[0].Items[0].Add(MenuItem);
end;
end.

為主菜單添加圖標(biāo)

  為菜單添加圖標(biāo),首先用TImagaList組件為菜單指定好圖標(biāo),將菜單中的Images屬性設(shè)為ImageList1,然后選擇要添加的圖標(biāo)索引。如圖所示:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論