DotNetBar第三方控件使用筆記_第1頁
DotNetBar第三方控件使用筆記_第2頁
DotNetBar第三方控件使用筆記_第3頁
DotNetBar第三方控件使用筆記_第4頁
DotNetBar第三方控件使用筆記_第5頁
已閱讀5頁,還剩75頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、DotNet第三方控件使用筆記1、 ButtonX控件可實現(xiàn)如下效果:(1)在ButtonX上,是否顯示圖像,取決于“images”屬性。(2)在“ButtomItem”控件中,是否“只是顯示圖像”,“只是文本”,還是“圖像和文本都顯示”,取決于。2、 BalloonTip控件(氣泡提示)在添加了BalloonTip控件后,其他各個控件會出現(xiàn)對應(yīng)的“上的BalloonText”和“上的BalloonCaption”屬性,通過修改這兩個屬性可設(shè)置鼠標(biāo)移動到控件時彈出的氣泡提示的標(biāo)題和內(nèi)容,也可通過代碼設(shè)置這個兩個屬性,如:balloonTip1.SetBalloonCaption(txtUser

2、Name, "提示");balloonTip1.SetBalloonText(txtUserName, "輸入你的大名吧");balloonTip1.SetBalloonCaption(txtUserPw, "提示;balloonTip1.SetBalloonText(txtUserPw, "大名輸完了就是你的密碼咯");")1. 使用效果1) 效果一:在鼠標(biāo)在控件上面停留時,出現(xiàn)提示信息,如下圖: 2) 效果二:當(dāng)控件獲得焦點時,也出現(xiàn)如上圖一樣的信息。2. 實現(xiàn)上述兩種效果的途徑1) 將BalloonTip控件

3、的“ShowBalloonOnFacus”屬性設(shè)置為“False”即可實現(xiàn)效果一。3. 設(shè)置BalloonTip顯示的內(nèi)容2) 將“ShowBalloonOnFacus”屬性設(shè)置為“True”,即可實現(xiàn)效果二。1) 在欲設(shè)置該屬性的控件的“BalloonTipOnFocus上的BalloonCaption”和“BalloonTip推薦精選OnHover上的BalloonCaption”屬性中,分別設(shè)置這兩種效果的“標(biāo)題”屬性;2) 在“BalloonTipOnFocus上的BalloonText”和在“BalloonTipOnHover上的BalloonText”屬性中,分別設(shè)置這兩種效果的“

4、顯示內(nèi)容”的屬性。4. 屬性“AlerAnimation”設(shè)置“BalloonTip”出現(xiàn)的效果5. “BalloonTip”除了出現(xiàn)在該控件附近,還可以出現(xiàn)在屏幕的右下角,示例程序如下:private AlertCustom m_AlertOnLoad=null;m_AlertOnLoad=new AlertCustom();Rectangle r=Screen.GetWorkingArea(this);m_AlertOnLoad.Location=new Point(r.Right-m_AlertOnLoad.Width,r.Bottom-m_AlertOnLoad.Height);m_A

5、lertOnLoad.AutoClose=true;m_AlertOnLoad.AutoCloseTimeOut=15;m_AlertOnLoad.AlertAnimation=eAlertAnimation.BottomToTop;m_AlertOnLoad.AlertAnimationDuration=300;m_AlertOnLoad.Show(false);/ false指示該控件是否需要獲得焦點才出現(xiàn)“BalloonTip”6. “BalloonTip”除了可以通過“添加控件”的方式使用,也可以通過編程的方式使用,示例程序如下:DevComponents.DotNetBar.Ball

6、oon b=new DevComponents.DotNetBar.Balloon();b.Style=eBallonStyle.Alert;b.CaptionImage=balloonTipFocus.CaptionImage.Clone() as Image;b.CaptionText="Balloon Status InFormation"b.Text="Balloons are now enabled for Balloon Tip Test area. Hover mouse over the area and set the focus to any

7、control."b.AlertAnimation=eAlertAnimation.TopToBottom;b.AutoResize();b.AutoClose=true;b.AutoCloseTimeOut=4;b.Owner=this;/ 指示父控件b.Show(button2,false);/ button2指示在那個控件附近出現(xiàn)“BalloonTip”7. 還可以對“BalloonTip”出現(xiàn)時的效果進行程序控制,如下:/ BalloonTriggerControl property returns control that invoked balloon/ BalloonT

8、riggerControl屬性返回觸發(fā)“BalloonTip”的控件if(balloonTipHover.BalloonTriggerControl=groupBox1)/ BalloonControl is already prepared Balloon control that is just about to be displayed/ Setting BalloonControl to null will cancel balloon displayPoint p=Control.MousePosition;/ Adjust cursor position so cursor is

9、below tipp.Offset(-balloonTipHover.BalloonControl.TipOffset,balloonTipHover.BalloonControl.TipLength+4);推薦精選/Offset屬性將點p進行平移balloonTipHover.BalloonControl.Location=p;8. 與之類似的是DotNetToolTip所有控件都有的“ToolTip”屬性,也可以是控件在鼠標(biāo)劃過時出現(xiàn)類似的東西,如下圖:3、 DotNetBarManager控件與Bar控件的使用示例效果如下圖:1. DotNetBarManager控件將該控件添加到工程后

10、,將給Bar控件提供了“??奎c(DockSite)”,可以實現(xiàn)工具欄在窗體的“上、下、左、右”擺放??梢酝ㄟ^程序?qū)崿F(xiàn),也可以通過“屬性頁”的“Dock”屬性進行設(shè)置。bar.DockSide = eDockSide.Top;2. DotNetBarManager控件,通過右鍵菜單可以輕松實現(xiàn)如下圖所示的布局。推薦精選通過拖動也可以輕易的實現(xiàn)如下視圖的布局與上圖相應(yīng)的代碼:/ Create new document and add it to existing barDevComponents.DotNetBar.DockContainerItem DockItem=new DevCompone

11、nts.DotNetBar.DockContainerItem();DockItem.Text="Custom Document"/ Add control to itTextBox t=new TextBox();t.Autosize=false;t.Multiline=true;t.Text=DockItem.Text;/ PanelDockContainer will be used to host any controls. It provides automatic focus management so focused/ document tab appears

12、 boldDevComponents.DotNetBar.PanelDockContainer panel = new DevComponents.DotNetBar.推薦精選PanelDockContainer();t.Dock = DockStyle.Fill;panel.Controls.Add(t);DockItem.Control=panel;bar1.Items.Add(DockItem);/添加第二個選項卡/*/DevComponents.DotNetBar.DockContainerItem DockItem1 = new DevComponents.DotNetBar.Doc

13、kContainerItem();DockItem1.Text = "This is the second!"Label l = new Label();l.Text = DockItem1.Text;DevComponents.DotNetBar.PanelDockContainer panel1 = new DevComponents.DotNetBar.PanelDockContainer();l.Dock = DockStyle.Fill;panel1.Controls.Add(l);DockItem1.Control = panel1;bar1.Items.Add

14、(DockItem1);/*/if(!bar1.Visible)bar1.Visible=true;elsebar1.RecalcLayout();/ Optimize display by disabling layout for all Dock sitesdotNetBarManager1.SuspendLayout=true;tryforeach(DevComponents.DotNetBar.Bar bar in dotNetBarManager1.Bars)if(bar.DockSide=DevComponents.DotNetBar.eDockSide.Document)fore

15、ach(DevComponents.DotNetBar.DockContainerItem Dock in bar.Items)Dock.Visible=true;if(!bar.Visible)bar.Visible=true;推薦精選finallydotNetBarManager1.SuspendLayout=false;代碼實現(xiàn)的界面如下圖:推薦精選3. 下面的代碼通過編程的方式實現(xiàn)如下圖所示的功能private void Form1_Load(object sender, System.EventArgs e)dotNetBarManager1.DockTabChange+=new D

16、otNetBarManager.DockTabChangeEventHandler(this.DockTabChanged);CreateBottomBarAutoHide();CreateLeftDockedBars();private void DockTabChanged(object sender, DockTabChangeEventArgs e)/ 使Bar的標(biāo)題與當(dāng)前??窟x項卡同步Bar bar=sender as Bar;if(bar=null | e.NewTab=null)return;bar.Text=e.NewTab.Text;private void CreateBo

17、ttomBarAutoHide()Bar bar=new Bar("Bottom Bar in auto-hide state");bar.Name="bottomBar"bar.LayoutType=eLayoutType.DockContainer; / ??咳萜鞑季中枰赏?看翱赽ar.Stretch=true; / 可??看翱诶熘撂钛a容器bar.AutoHideAnimationTime=0; / 一些控件不支持動畫所以關(guān)掉它bar.GrabHandleStyle=eGrabHandleStyle.Caption; / 可停靠窗口有標(biāo)題dotN

18、etBarManager1.Bars.Add(bar); / DotNetBar需要添加bar以便能管理它的??康? 創(chuàng)建托管控件推薦精選DockContainerItem DockItem=new DockContainerItem("bottomDockItem1","First Dock item");bar.Items.Add(DockItem);/ 創(chuàng)建我們想放在可??看翱诘目丶serControl1 DockedControl=new UserControl1();DockedControl.label1.Text=bar.Name+&qu

19、ot; - "+DockItem.Text;DockedControl.BackColor=Color.Azure;DockItem.Control=DockedControl; / 指定該控件是托管在??咳萜魃螪ockItem.Height=128; / 指定可??咳萜鞯母叨群屯粫r間控制/ 創(chuàng)建第二個??咳萜鞑⑻砑拥紹ar中DockItem=new DockContainerItem("bottomDockItem2","Second Dock item");bar.Items.Add(DockItem);DockedControl=new

20、 UserControl1();DockedControl.label1.Text=bar.Name+" - "+DockItem.Text;DockedControl.BackColor=Color.Aquamarine;DockItem.Control=DockedControl; / 指定該控件是托管在??咳萜魃? 將Bar??康较旅娴耐?课恢胐otNetBarManager1.BottomDockSite.GetDocumentUIManager().Dock(bar);DockItem.Height=128; / 指定可停靠容器的高度和同一時間控制bar.Reca

21、lcLayout(); / 適用所有的變化.bar.AutoHide=true; / 將Bar置為自動隱藏模式。Bar需要停靠的地方,才能置為自動隱藏模式private void CreateLeftDockedBars()/ 將前兩個Bar并排??坎⒌谌齻€Bar停靠在他們之后.Bar bar=new Bar("Bar1");bar.Name="leftBar1"bar.LayoutType=eLayoutType.DockContainer; / ??咳萜鞑季中枰赏?看翱赽ar.Stretch=true; / 可??看翱诶熘撂钛a容器bar.Aut

22、oHideAnimationTime=0; / 一些控件不支持動畫所以關(guān)掉它bar.GrabHandleStyle=eGrabHandleStyle.Caption; / 可??看翱谟袠?biāo)題bar.CanHide=true;/ 為Bar創(chuàng)建DockContainerItem,該項應(yīng)該在Bar??壳疤砑覦ockContainerItem DockItem=new DockContainerItem("leftDockItem1","Top Left Dock Container");bar.Items.Add(DockItem);/ 創(chuàng)建我們想放在可??看翱?/p>

23、的控件UserControl1 DockedControl=new UserControl1();DockedControl.label1.Text=bar.Name+" - "+DockItem.Text;推薦精選DockedControl.BackColor=Color.Khaki;DockItem.Control=DockedControl; / 指定該控件是托管在??咳萜魃蟙otNetBarManager1.Bars.Add(bar); / DotNetBar需要添加bar以便能管理它的??康萪otNetBarManager1.LeftDockSite.GetDoc

24、umentUIManager().Dock(bar); / 將Bar??康阶筮叺目赏?课恢肈ockItem.Width=128; / 在??恐笾付ㄍ?咳萜黜椀膶挾? 創(chuàng)建第二個Bar并將它??康陀诘谝粋€Bar但仍在同一行Bar bar2=new Bar("Bar2");bar2.Name="leftBar2"bar2.LayoutType=eLayoutType.DockContainer; / ??咳萜鞑季中枰赏?看翱赽ar2.AutoHideAnimationTime=0; / 一些控件不支持動畫所以關(guān)掉它bar2.Stretch=true; /

25、 可??看翱诶熘撂钛a容器bar2.CanHide=true;bar2.GrabHandleStyle=eGrabHandleStyle.Caption; / 可停靠窗口有標(biāo)題/ 添加新的??咳萜鞯紹ar上,應(yīng)該在添加Bar之前執(zhí)行以便大小可以計算正確DockItem=new DockContainerItem("leftDockItem2","Bottom Left Dock Container");bar2.Items.Add(DockItem);/ 創(chuàng)建我們想放在可??看翱诘目丶﨑ockedControl=new UserControl1();Do

26、ckedControl.label1.Text=bar.Name+" - "+DockItem.Text;DockedControl.BackColor=Color.Lavender;DockItem.Control=DockedControl; / 指定該控件是托管在??咳萜魃蟙otNetBarManager1.Bars.Add(bar2); / DotNetBar需要添加bar以便能管理它的??康?dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar, bar2, eDockSide.Bottom)

27、; / ??啃耣ar2低于我們先前創(chuàng)建的Bar/ 創(chuàng)建第三個Bar,??吭诘谝粋€和第二個之后/ i.e. on the line 1bar=new Bar("Bar3");bar.Name="leftBar3"bar.LayoutType=eLayoutType.DockContainer; / ??咳萜鞑季中枰赏?看翱赽ar.AutoHideAnimationTime=0; / 一些控件不支持動畫所以關(guān)掉它bar.Stretch=true; / 可??看翱诶熘撂钛a容器bar.CanHide=true;bar.GrabHandleStyle=eGra

28、bHandleStyle.Caption; / 可??看翱谟袠?biāo)題DockItem=new DockContainerItem("leftDockItem3","Left Dock Container line 1");bar.Items.Add(DockItem);/ 創(chuàng)建我們想放在可??看翱诘目丶﨑ockedControl=new UserControl1();DockedControl.label1.Text=bar.Name+" - "+DockItem.Text;推薦精選DockedControl.BackColor=Colo

29、r.LemonChiffon;DockItem.Control=DockedControl; / 指定該控件是托管在??咳萜魃蟙otNetBarManager1.Bars.Add(bar); / DotNetBar需要添加bar以便能管理它的??康?dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar);/ 設(shè)置停靠點的寬度并將bars按比例??吭诶锩? 但是這個尺寸應(yīng)該大到足以容納所有的Bar包括約束像MinimumSize等等dotNetBarManager1.LeftDockSite.Width = 150;Base

30、Item:定義了DotNetBar使用的項的基類示例:BaseItem item = sender as BaseItem;4. 添加“菜單項“也可以通過兩種方式實現(xiàn)1) “可視化“的方式在“設(shè)計器“里可以通過”右鍵“來實現(xiàn);2) 程序的方法private void CreateBar()/創(chuàng)建BarBar bar=new Bar("Standard");bar.CanHide=true;bar.Style=eDotNetBarStyle.Office2003;bar.GrabHandleStyle=eGrabHandleStyle.StripeFlat;bar.WrapI

31、temsDock=true;bar.WrapItemsFloat=false;/ 向Bar內(nèi)添加項ButtonItem item, fileItem;/ 添加新建菜單item=new ButtonItem("bNew");item.ImageIndex=0;/ item.Image = imageList1.Images0;item.Text="&New"item.Shortcuts.Add(eShortcut.CtrlN);item.Category="Standard"bar.Items.Add(item);m_DotNe

32、tBar.Items.Add(item.Copy();/ 這將創(chuàng)建類別條目/ 添加打開菜單item=new ButtonItem("bOpen");item.ImageIndex=1;item.Text="&Open"item.Shortcuts.Add(eShortcut.CtrlO);item.Category="Standard"推薦精選bar.Items.Add(item);m_DotNetBar.Items.Add(item.Copy();/ 添加子菜單項到打開菜單,例如最近使用的文件之類的東西fileItem=ne

33、w ButtonItem("file1");fileItem.Text="&1. File1.txt"item.SubItems.Add(fileItem);fileItem=new ButtonItem("file2");fileItem.Text="&2. File2.txt"item.SubItems.Add(fileItem);fileItem=new ButtonItem("file3");fileItem.Text="&3. File3.txt&qu

34、ot;item.SubItems.Add(fileItem);fileItem=new ButtonItem("file4");fileItem.Text="&4. File4.txt"item.SubItems.Add(fileItem);fileItem=new ButtonItem("file5");fileItem.Text="&5. File5.txt"item.SubItems.Add(fileItem);/ 添加關(guān)閉菜單item=new ButtonItem("bClose&

35、quot;);item.ImageIndex=2;item.Text="&Close"item.Shortcuts.Add(eShortcut.CtrlX);item.Category="Standard"bar.Items.Add(item);m_DotNetBar.Items.Add(item.Copy();/ 添加保存菜單item=new ButtonItem("bSave");item.ImageIndex=3;item.Text="&Save"item.Shortcuts.Add(eSho

36、rtcut.CtrlS);item.Category="Standard"bar.Items.Add(item);m_DotNetBar.Items.Add(item.Copy();/ 添加打印預(yù)覽菜單item=new ButtonItem("bPrintPreview");item.ImageIndex=6;item.Text="Print Pre&view"item.Category="Standard"item.BeginGroup=true;推薦精選bar.Items.Add(item);m_Dot

37、NetBar.Items.Add(item.Copy();/ 添加打印菜單item=new ButtonItem("bPrint");item.ImageIndex=5;item.Text="&Print"item.Category="Standard"item.Shortcuts.Add(eShortcut.CtrlP);bar.Items.Add(item);m_DotNetBar.Items.Add(item.Copy();/ 添加郵件菜單item=new ButtonItem("bEmail");i

38、tem.ImageIndex=4;item.Text="&Email"item.Category="Standard"item.BeginGroup=true;bar.Items.Add(item);m_DotNetBar.Items.Add(item.Copy();/ 添加“添加/刪除“按鈕CustomizeItem citem=new CustomizeItem();bar.Items.Add(citem);/ 由于我們將使用ImageList,Bar酒吧必須被添加到DotNetBarManager中/ 將Bar加入DotNetBarMana

39、germ_DotNetBar.Bars.Add(bar);bar.DockSide=eDockSide.Top;5. 為所有選項添加“事件”this.m_DotNetBar.ItemClick += new System.EventHandler(this.BarItemClick);private void BarItemClick(object sender, EventArgs e)BaseItem item = sender as BaseItem;if (item = null | item.Name = "" | item.SystemItem)return;M

40、essageBox.Show("Item '" + item.Name + "' clicked");6. 設(shè)置窗體的大小AutoScaleBaseSize屬性的值在窗體顯示時使用,用來計算該窗體的縮放因子。窗體將自動縮放基大?。ㄓ米髋c系統(tǒng)的字體大小進行比較的基準(zhǔn)),以確定使用自動縮放時窗體的縮放量。如果要確定根據(jù)特定字體窗體將自動縮放到的大小,請使用GetAutoScaleSize方法。示例:推薦精選this.AutoScaleBaseSize = new System.Drawing.Size(11, 17);該屬性將按著Size(a

41、,b)內(nèi)a與b的比例大小自動調(diào)整窗口大小,但是值得注意的是:a與b的絕對值越大,窗口越小。/設(shè)置工作區(qū)域的大小this.ClientSize = new System.Drawing.Size(351, 207);4、 ImageList組件1. 概述ImageList組件就是一個圖像列表。一般情況下,這個屬性用于存儲一個圖像集合,這些圖像用作工具欄圖標(biāo)或TreeView控件上的圖標(biāo)。許多控件都包含ImageList屬性。這個屬性一般和ImageIndex屬性一起使用。ImageList屬性設(shè)置為ImageList組件的一個實例,ImageIndex屬性設(shè)置為ImageList中應(yīng)在控件中顯示

42、的圖像的索引。使用ImageIndex.Images屬性的Add方法可以把圖像添加到ImageList組件中。Images屬性返回一個ImageCollection。兩個最常用的屬性是ImageSize和ColorDepth。ImageSize使用Size結(jié)構(gòu)作為其值。其默認值是16×16,但可以取1256之間的任意值。ColorDepth使用ColorDepth枚舉作為其值。顏色深度值可以從4位32位。在.NET Framework 1.1中,默認是ColorDepth.Depth8Bit。2. 示例private System.Windows.Forms.ImageList im

43、ageList1;this.imageList1.ImageStream = (System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream");this.imageList1.TransparentColor = System.Drawing.Color.Transparent;/ 下面加幾個Imagethis.imageList1.Images.SetKeyName(0, "acrobat.ico");this.imageList1.Images

44、.SetKeyName(1, "address book.ico");this.imageList1.Images.SetKeyName(2, "adjust colour.ico");/把imageList1賦給treeView1this.treeView1.ImageIndex = 0;this.treeView1.ImageList = this.imageList1;this.treeView1.Location = new System.Drawing.Point(3, 3);this.treeView1.Name = "treeVi

45、ew1"this.treeView1.SelectedImageIndex = 0;this.treeView1.Size = new System.Drawing.Size(579, 450);this.treeView1.TabIndex = 0;/ 以上code在Designer完成/ 在添加TreeNode的時候, 把Image加上/ 未選中時,這個node顯示imageList1中的"acrobat.ico", 選中后顯示"address book.ico"TreeNode node = new TreeNode("Tree

46、NodeName", 0, 1);treeView1.Nodes.Add(node);treeView1.ExpandAll();推薦精選3. 討論1) ImageList里面的圖片的顏色2) ImageList里面的圖片的大小引起ImageList里面圖片顏色失真的原因是在Design-Time就在VS.NET中往ImageList里面添加了Images。  當(dāng)用戶一邊在“Image Collection Editor”對話框里面添加圖片,VS.NET一邊就已經(jīng)把這些圖片裝載到resource文件里面了。這樣,以后程序運行時就只需要訪問resource文件就可以載入所有圖

47、片而不需要依賴原始的圖片文件。  但是問題在于從結(jié)果看,當(dāng)VS.NET在Design-Time往resource文件里面添加圖片時并沒有使用用戶指定的ColorDepth(例如Depth32Bit),而用了ImageList.ColorDepth的默認值(Depth8Bit)。這樣,等程序運行時,即使ImageList.ColorDepth指定了Depth32Bit也無濟于事,因為原始的素材本身只有8bit的顏色。這基本上就是失真的問題的原因。  因此,解決方案是:不在Design-Time用VS.NET往ImageList里面添加圖片,而是在程序運行時先指定32Bit的C

48、olorDepth,然后再添加圖片,如以下例子代碼:  this.imageList1.ColorDepth=ColorDepth.Depth32Bit;  this.imageList1.Images.Add(Image.FromFile("C:Inetpubwwwrootwinxp.gif");  this.imageList1.Images.Add(Image.FromFile("C:Inetpubwwwrootimagesinit_dotnet.gif");  this.imageList1.Images.

49、Add(Image.FromFile("C:Inetpubwwwrootimagesmslogo.gif");  this.imageList1.Images.Add(Image.FromFile("C:Inetpubwwwrootimagesmslogo2.gif");  這里需要注意的是,必須先指定ColorDepth,然后再添加圖片。因為對ColorDepth賦值會清空所有圖片。BTW,ImageList.ColorDepth的默認值是Depth8Bit,而非文檔上所述Depth4Bit。這一點很容易可以通過寫一段例子代碼來驗證

50、,也可以通過很多Decompiler來查看ImageList的構(gòu)造函數(shù)的實現(xiàn)來驗證。  的確,通過ImageList.Imagesi獲得圖片的大小都是統(tǒng)一的,都等于ImageList.ImageSize。這個問題的原因在于ImageList在返回Imagesi的過程中并沒有返回原始的圖片,而是按照ImageList.ImageSize創(chuàng)建了一個新的Bitmap,并把原始圖片的內(nèi)容重新繪制上去以后再返回給用戶。關(guān)于這一點,可以用一些Decompiler工具如ILDASM.exe或者Anakrino通過察看私有函數(shù)ImageList.GetBitmap(int index)來驗證。我想現(xiàn)

51、在paulluo0739應(yīng)該能夠理解為什么ImageList里面的圖片都是一樣大的了。  ImageSize同ColorDepth類似,也不宜在運行時改動,一旦重新賦值,就會清空所有的圖片。因此,如果程序運行時需要某一圖片的不同大小的版本,可以考慮使用多個不同ImageSize的ImageList。 推薦精選4. 關(guān)于ImageList組件的用法還存在問題5、 控件BubbleBar的使用1. 使用效果2. 其實使用很簡單,只有將BubbleBar控件拖到窗體上,然后,就可以添加“Tab”和“Button”了。3. 一些有用的語句private void bubbleButton_C

52、lick(object sender, DevComponents.DotNetBar.ClickEventArgs e)DevComponents.DotNetBar.BubbleButton button=sender as DevComponents.DotNetBar.BubbleButton;textBox1.Text=button.Name+", "+button.TooltipText;private void checkBox2_CheckedChanged(object sender, System.EventArgs e)if(checkBox2.Che

53、cked)bubbleBar1.ButtonBackgroundStretch=true;elsebubbleBar1.ButtonBackgroundStretch=false;/ Apply UI changes and refresh /刷新bubbleBar1.RecalcLayout();bubbleBar1.Refresh();private void numericUpDown1_ValueChanged(object sender, System.EventArgs e)推薦精選/ 圖像分配給控件時總是匹配最佳外觀的尺寸是最好的bubbleBar1.ImageSizeNorma

54、l=new Size(int)numericUpDown1.Value,(int)numericUpDown1.Value);bubbleBar1.RecalcLayout();bubbleBar1.Refresh();6、 控件DataGridViewX的使用1. 說明(1) 控件DataGridView與DataGridView的基本用法類似。(2) DataGridView有自動按列排序的功能。(3) dataGridViewX1.SelectedRows.Count。(4) dataGridViewX1.SelectedRows0.Cells0.Value.ToString()。2.

55、DataGridView的示例代碼#region 設(shè)置DataGridView的顯示格式dgvMachinceList.AutosizeColumnsMode = System.Windows.Forms.DataGridViewAutosizeColumnsMode.Fill;dgvMachinceList.AutoGenerateColumns = false;dgvMachinceList.AllowUserToAddRows = false;dgvMachinceList.AllowUserToResizeColumns = true;/TabControlPanel tcp;fore

56、ach (Control c in tabControl1.Controls)if (c is TabControlPanel)tcp = (TabControlPanel)c; tcp.Style.BackColor1.Color = Color.FromArgb(227, 239, 255);tcp.Style.BackColor2.Color = Color.FromArgb(175, 210, 255);foreach (Control ctrl in tcp.Controls)if (ctrl is DevComponents.DotNetBar.Controls.DataGridV

57、iewX)DevComponents.DotNetBar.Controls.DataGridViewX dgv = (DevComponents.DotNetBar.Controls.DataGridViewX)ctrl; dgv.AutoGenerateColumns = false; dgv.BackgroundColor = Color.FromArgb(227, 239, 255); dgv.AllowUserToAddRows = false; dgv.AllowUserToDeleteRows = false; /dgv.Autosize = false; dgv.AutosizeColumnsMode = System.Windows.Forms.DataGridViewAutosizeColumnsMode.Fill; dgv.AutosizeRowsMode = System

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論