精華|使用教程|編輯:龔雪|2021-01-06 10:12:54.643|閱讀 501 次
概述:DevExpress工具欄表單是DevExpress XtraForm的擴(kuò)展版本,允許您將bar items?直接添加到表單標(biāo)題欄中。本節(jié)將為大家介紹DevExpress Toolbar Form控件。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
下載DevExpress v20.2完整版 DevExpress v20.2漢化資源獲取
Toolbar Form是的擴(kuò)展版本,允許您將 直接添加到表單標(biāo)題欄中。
下圖說(shuō)明了一個(gè)示例Toolbar Form,在表單標(biāo)題欄中帶有不同類型的bar items(常規(guī)按鈕、編輯項(xiàng)、檢查項(xiàng)和外觀菜單)。
ToolbarForm是類的后代,并共享其所有功能。
要將標(biāo)準(zhǔn)或任何轉(zhuǎn)換為工具欄表單,請(qǐng)調(diào)用智能標(biāo)記菜單并選擇 "Convert to Toolbar Form" 選項(xiàng)。
可以顯示沒有標(biāo)題的Toolbar Form(Form.Text屬性),為此請(qǐng)禁用ShowText設(shè)置。 以下"Visual Studio Inspired UI Demo" DevExpress demo屏幕截圖說(shuō)明了沒有可見標(biāo)題的Toolbar Form。
可以使用向床柜工具欄添加bar items的方法來(lái)填充Toolbar Form的標(biāo)題欄:表單在其標(biāo)題欄的兩端都有兩個(gè)可以容納項(xiàng)目的區(qū)域,單擊 "[Add]" 按鈕創(chuàng)建一個(gè)新的項(xiàng)目。
您可以在設(shè)計(jì)時(shí)拖放項(xiàng)目來(lái)重新排列它們,然后從一個(gè)標(biāo)題欄區(qū)域移動(dòng)到另一個(gè)標(biāo)題欄區(qū)域。
Toolbar Form具有兩個(gè)必需的附屬控件 - 和。
要將現(xiàn)有表單轉(zhuǎn)換為Toolbar Forms或在代碼中創(chuàng)建新的工具欄表單,您需要手動(dòng)創(chuàng)建這些組件。
C#
ToolbarForm myForm = new ToolbarForm(); myForm.Size = new Size(800, 600); myForm.Text = "Toolbar Form"; ToolbarFormManager tfcManager = new ToolbarFormManager() { Form = myForm }; ToolbarFormControl tfcHeader = new ToolbarFormControl() { ToolbarForm = myForm, Manager = tfcManager}; myForm.Controls.Add(tfcHeader); myForm.ToolbarFormControl = tfcHeader; //create four buttons BarButtonItem item1 = new BarButtonItem(tfcManager, "Button 1"); BarButtonItem item2 = new BarButtonItem(tfcManager, "Button 2"); BarButtonItem item3 = new BarButtonItem(tfcManager, "Button 3"); BarButtonItem item4 = new BarButtonItem(tfcManager, "Button 4"); //buttons 3 and 4 will be docked to the ToolbarFormControl's right edge item3.Alignment = item4.Alignment = BarItemLinkAlignment.Right; //Out of two items added to the TitleItemLinks collection, the item that was added first //will be closer to the form edge. For that reason, you need to populate the right area //backwards, i.e. start with rightmost item tfcHeader.TitleItemLinks.AddRange(new BarItem[] { item1, item2, item4, item3}); myForm.Show();
VB.NET
Dim myForm As New ToolbarForm() myForm.Size = New Size(800, 600) myForm.Text = "Toolbar Form" Dim tfcManager As New ToolbarFormManager() With {.Form = myForm} Dim tfcHeader As New ToolbarFormControl() With {.ToolbarForm = myForm, .Manager = tfcManager} myForm.Controls.Add(tfcHeader) myForm.ToolbarFormControl = tfcHeader 'create four buttons Dim item1 As New BarButtonItem(tfcManager, "Button 1") Dim item2 As New BarButtonItem(tfcManager, "Button 2") Dim item3 As New BarButtonItem(tfcManager, "Button 3") Dim item4 As New BarButtonItem(tfcManager, "Button 4") 'buttons 3 and 4 will be docked to the ToolbarFormControl's right edge item4.Alignment = BarItemLinkAlignment.Right item3.Alignment = item4.Alignment 'Out of two items added to the TitleItemLinks collection, the item that was added first 'will be closer to the form edge. For that reason, you need to populate the right area 'backwards, i.e. start with rightmost item tfcHeader.TitleItemLinks.AddRange(New BarItem() { item1, item2, item4, item3}) myForm.Show()
有關(guān)表單標(biāo)題欄的更新信息,請(qǐng)參見類說(shuō)明。
DevExpress技術(shù)交流群3:700924826 歡迎一起進(jìn)群討論
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都網(wǎng)