DotNet第三方控件使用笔记.docx

上传人:b****7 文档编号:15688020 上传时间:2023-07-06 格式:DOCX 页数:98 大小:810.62KB
下载 相关 举报
DotNet第三方控件使用笔记.docx_第1页
第1页 / 共98页
DotNet第三方控件使用笔记.docx_第2页
第2页 / 共98页
DotNet第三方控件使用笔记.docx_第3页
第3页 / 共98页
DotNet第三方控件使用笔记.docx_第4页
第4页 / 共98页
DotNet第三方控件使用笔记.docx_第5页
第5页 / 共98页
DotNet第三方控件使用笔记.docx_第6页
第6页 / 共98页
DotNet第三方控件使用笔记.docx_第7页
第7页 / 共98页
DotNet第三方控件使用笔记.docx_第8页
第8页 / 共98页
DotNet第三方控件使用笔记.docx_第9页
第9页 / 共98页
DotNet第三方控件使用笔记.docx_第10页
第10页 / 共98页
DotNet第三方控件使用笔记.docx_第11页
第11页 / 共98页
DotNet第三方控件使用笔记.docx_第12页
第12页 / 共98页
DotNet第三方控件使用笔记.docx_第13页
第13页 / 共98页
DotNet第三方控件使用笔记.docx_第14页
第14页 / 共98页
DotNet第三方控件使用笔记.docx_第15页
第15页 / 共98页
DotNet第三方控件使用笔记.docx_第16页
第16页 / 共98页
DotNet第三方控件使用笔记.docx_第17页
第17页 / 共98页
DotNet第三方控件使用笔记.docx_第18页
第18页 / 共98页
DotNet第三方控件使用笔记.docx_第19页
第19页 / 共98页
DotNet第三方控件使用笔记.docx_第20页
第20页 / 共98页
亲,该文档总共98页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

DotNet第三方控件使用笔记.docx

《DotNet第三方控件使用笔记.docx》由会员分享,可在线阅读,更多相关《DotNet第三方控件使用笔记.docx(98页珍藏版)》请在冰点文库上搜索。

DotNet第三方控件使用笔记.docx

DotNet第三方控件使用笔记

DotNet第三方控件使用笔记

1、

1)ButtonX控件

可实现如下效果:

在ButtonX上,是否显示“图像,取决于“images“属性

2)在“buttomItem“控件中,是否“只是显示图像”,”只是文本”,还是“图像和文本都显示”,取决于

2、BalloonTio控件(气泡提示)

(1)使用效果

1)效果一:

在鼠标在控件上面停留时,出现提示信息,如下图:

a)效果二:

当控件获得焦点时,也出现如上图一样的信息。

(2)实现上述两种效果的途径

1)将BalloonTip控件的“ShowBalloonOnFacus”属性设置为“False”即可实现,效果一。

2)将“ShowBalloonOnFacus”属性设置为“True”,即可实现效果二。

(3)设置BalloonTip显示的内容:

在欲设置该属性的控件的“BalloonTioOnFocus上的BalloonCaption”和“BalloonTioOnHover上的BalloonCaption”属性中,分别设置这两种效果的“标题”属性;

在“BalloonTioOnFocus上的BalloonText”和在“BalloonTioOnHover上的BalloonText”属性中,分别设置这两种效果的“显示内容”的属性。

(4)属性“AlerAnimation”设置“BalloonTip”出现的效果,

(5)“BalloonTip”除了出现在该控件附近,还可以出现在屏幕的右下角,示例程序如下:

privateAlertCustomm_AlertOnLoad=null;

m_AlertOnLoad=newAlertCustom();

Rectangler=Screen.GetWorkingArea(this);

m_AlertOnLoad.Location=newPoint(r.Right-m_AlertOnLoad.Width,r.Bottom-m_AlertOnLoad.Height);

m_AlertOnLoad.AutoClose=true;

m_AlertOnLoad.AutoCloseTimeOut=15;

m_AlertOnLoad.AlertAnimation=eAlertAnimation.BottomToTop;

m_AlertOnLoad.AlertAnimationDuration=300;

m_AlertOnLoad.Show(false);//false:

:

指示该控件是否需要获得焦点才出现“BalloonTip”

(6)“BalloonTip”除了可以通过“添加控件”的方式使用,也可以通过编程的方式使用,示例程序如下:

DevComponents.DotNetBar.Balloonb=newDevComponents.DotNetBar.Balloon();

b.Style=eBallonStyle.Alert;

b.CaptionImage=balloonTipFocus.CaptionImage.Clone()asImage;

b.CaptionText="BalloonStatusInformation";

b.Text="BalloonsarenowenabledforBalloonTipTestarea.Hovermouseovertheareaandsetthefocustoanycontrol.";

b.AlertAnimation=eAlertAnimation.TopToBottom;

b.AutoResize();

b.AutoClose=true;

b.AutoCloseTimeOut=4;

b.Owner=this;//指示父控件

b.Show(button2,false);//button2:

指示在那个控件附近出现“BalloonTip”

(7)还可以对“BalloonTip”出现时的效果进行程序控制,如下:

//BalloonTriggerControlpropertyreturnscontrolthatinvokedballoon

//BalloonTriggerControl属性返回触发“BalloonTip”的控件

if(balloonTipHover.BalloonTriggerControl==groupBox1)

{

//BalloonControlisalreadypreparedBallooncontrolthatisjustabouttobedisplayed

//SettingBalloonControltonullwillcancelballoondisplay

Pointp=Control.MousePosition;

//Adjustcursorpositionsocursorisbelowtip

p.Offset(-balloonTipHover.BalloonControl.TipOffset,balloonTipHover.BalloonControl.TipLength+4);

//Offset属性将点p进行平移

balloonTipHover.BalloonControl.Location=p;

}

(8)与之类似的是DotNetToolTip所有控件都有的“ToolTip”属性,也可以是控件在鼠标划过时出现类似的东西,如下图

3、DotNetBarManager控件与Bar控件的使用

示例效果如下图:

(1)DotNetBarManager控件

----将该控件添加到工程后,将给Bar控件提供了“停靠点(DockSite)”,可以实现是工具栏在窗体的“上、下、左、右“摆放。

可以通过程序实现,也可以通过“属性页“的”Dock“属性进行设置。

bar.DockSide=eDockSide.Top;

(2)DotNetBarManager控件,通过右键菜单

可以轻松实现如下图所示的布局。

通过拖动也可以轻易的实现如下视图的布局

与上图相应的代码:

//Createnewdocumentandaddittoexistingbar

DevComponents.DotNetBar.DockContainerItemdockItem=newDevComponents.DotNetBar.DockContainerItem();

dockItem.Text="CustomDocument";

//Addcontroltoit

TextBoxt=newTextBox();

t.AutoSize=false;

t.Multiline=true;

t.Text=dockItem.Text;

//PanelDockContainerwillbeusedtohostanycontrols.Itprovidesautomaticfocusmanagementsofocused

//documenttabappearsbold

DevComponents.DotNetBar.PanelDockContainerpanel=newDevComponents.DotNetBar.PanelDockContainer();

t.Dock=DockStyle.Fill;

panel.Controls.Add(t);

dockItem.Control=panel;

bar1.Items.Add(dockItem);

if(!

bar1.Visible)

bar1.Visible=true;

else

bar1.RecalcLayout();

//Optimizedisplaybydisablinglayoutforalldocksites

dotNetBarManager1.SuspendLayout=true;

try

{

foreach(DevComponents.DotNetBar.BarbarindotNetBarManager1.Bars)

{

if(bar.DockSide==DevComponents.DotNetBar.eDockSide.Document)

{

foreach(DevComponents.DotNetBar.DockContainerItemdockinbar.Items)

dock.Visible=true;

}

if(!

bar.Visible)

bar.Visible=true;

}

}

finally

{

dotNetBarManager1.SuspendLayout=false;

}

(2×)下面的代码通过编程的方式实现如下图所示的功能

privatevoidForm1_Load(objectsender,System.EventArgse)

{

dotNetBarManager1.DockTabChange+=newDotNetBarManager.DockTabChangeEventHandler(this.DockTabChanged);

CreateBottomBarAutoHide();

CreateLeftDockedBars();

}

privatevoidDockTabChanged(objectsender,DockTabChangeEventArgse)

{

//Synccaptionofthebarwiththecurrentlyselecteddocktab

Barbar=senderasBar;

if(bar==null||e.NewTab==null)

return;

bar.Text=e.NewTab.Text;

}

privatevoidCreateBottomBarAutoHide()

{

Barbar=newBar("BottomBarinauto-hidestate");

bar.Name="bottomBar";

bar.LayoutType=eLayoutType.DockContainer;//DockContainerLayoutneededfordockablewindows

bar.Stretch=true;//Dockablewindowsstretchtofillcontainer

bar.AutoHideAnimationTime=0;//Somecontrolsdonotsupportanimationsoturnitoff

bar.GrabHandleStyle=eGrabHandleStyle.Caption;//DockableWindowshavecaptions

dotNetBarManager1.Bars.Add(bar);//DotNetBarneedstobeawareofthebarsoitcanmanageit'sdockingetc.

//Createhostedcontrols

DockContainerItemdockItem=newDockContainerItem("bottomDockItem1","Firstdockitem");

bar.Items.Add(dockItem);

//Createcontrolthatwewanttohostondockablewindow

UserControl1dockedControl=newUserControl1();

dockedControl.label1.Text=bar.Name+"-"+dockItem.Text;

dockedControl.BackColor=Color.Azure;

dockItem.Control=dockedControl;//Specifythatcontrolishostedonthedockcontainer

dockItem.Height=128;//Specifytheheightofthedockablecontainerandatthesametimecontrol

//Createseconddockcontainerandaddittothebar

dockItem=newDockContainerItem("bottomDockItem2","Seconddockitem");

bar.Items.Add(dockItem);

dockedControl=newUserControl1();

dockedControl.label1.Text=bar.Name+"-"+dockItem.Text;

dockedControl.BackColor=Color.Aquamarine;

dockItem.Control=dockedControl;//Specifythatcontrolishostedonthedockcontainer

//Dockbartobottomdocksite

dotNetBarManager1.BottomDockSite.GetDocumentUIManager().Dock(bar);

dockItem.Height=128;//Specifytheheightofthedockablecontainerandatthesametimecontrol

bar.RecalcLayout();//Applyallchanges...

bar.AutoHide=true;//Placebarinauto-hidemode.Barneedstobedockedbeforeitcanbeplacesinauto-hidemode

}

privatevoidCreateLeftDockedBars()

{

//Dockfirsttwobarssidebysideanddockthirdbarnexttothem...

Barbar=newBar("Bar1");

bar.Name="leftBar1";

bar.LayoutType=eLayoutType.DockContainer;//DockContainerLayoutneededfordockablewindows

bar.Stretch=true;//Dockablewindowsstretchtofillcontainer

bar.AutoHideAnimationTime=0;//Somecontrolsdonotsupportanimationsoturnitoff

bar.GrabHandleStyle=eGrabHandleStyle.Caption;//DockableWindowshavecaptions

bar.CanHide=true;

//CreateDockContainerItemforthebar.Theitemshouldbeaddedbeforethebarisdocked.

DockContainerItemdockItem=newDockContainerItem("leftDockItem1","TopLeftDockContainer");

bar.Items.Add(dockItem);

//Createcontrolthatishostedondockcontainer

UserControl1dockedControl=newUserControl1();

dockedControl.label1.Text=bar.Name+"-"+dockItem.Text;

dockedControl.BackColor=Color.Khaki;

dockItem.Control=dockedControl;//Specifythatcontrolishostedonthedockcontainer

dotNetBarManager1.Bars.Add(bar);//DotNetBarneedstobeawareofthebarsoitcanmanageit'sdockingetc.

dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar);//PerformsactualdockingoftheBartothespecifieddocksite

dockItem.Width=128;//SpecifyWidthofdockcontaineritemafteritisdocked

//Createsecondbaranddockitbelowthefirstbarbutstillonthesameline

Barbar2=newBar("Bar2");

bar2.Name="leftBar2";

bar2.LayoutType=eLayoutType.DockContainer;//DockContainerLayoutneededfordockablewindows

bar2.AutoHideAnimationTime=0;//Somecontrolsdonotsupportanimationsoturnitoff

bar2.Stretch=true;//Dockablewindowsstretchtofillcontainer

bar2.CanHide=true;

bar2.GrabHandleStyle=eGrabHandleStyle.Caption;//DockableWindowshavecaptions

//AddnewDockContainertothebar,shouldbedonebeforeaddingthebarsosizecanbecalculatedproperly

dockItem=newDockContainerItem("leftDockItem2","BottomLeftDockContainer");

bar2.Items.Add(dockItem);

//Createcontrolthatishostedondockcontainer

dockedControl=newUserControl1();

dockedControl.label1.Text=bar.Name+"-"+dockItem.Text;

dockedControl.BackColor=Color.Lavender;

dockItem.Control=dockedControl;//Specifythatcontrolishostedonthedockcontainer

dotNetBarManager1.Bars.Add(bar2);//DotNetBarneedstobeawareofthebarsoitcanmanageit'sdockingetc.

dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar,bar2,eDockSide.Bottom);//Docknewbar2belowthebarthatwecreatedpreviously

//Createthirdbarthatisdockednexttothefirstandsecond

//i.e.ontheline1

bar=newBar("Bar3");

bar.Name="leftBar3";

bar.LayoutType=eLayoutType.DockContainer;//DockContainerLayoutneededfordockablewindows

bar.AutoHideAnimationTime=0;//Somecontrolsdonotsupportanimationsoturnitoff

bar.Stretch=true;//Dockablewindowsstretchtofillcontainer

bar.CanHide=true;

bar.GrabHandleStyle=eGrabHandleStyle.Caption;//DockableWindowshavecaptions

dockItem=newDockContainerItem("leftDockItem3","LeftDockContainerline1");

bar.Items.Add(dockItem);

//Createcontrolthatishostedondockcontainer

dockedControl=newUserControl1();

dockedControl.label1.Text=bar.Name+"-"+dockItem.Text;

dockedControl.BackColor=Color.LemonChiffon;

dockItem.Control=dockedControl;//Specifythatcontrolishostedonthedockcontainer

dotNetBarManager1.Bars.Add(bar);//DotNetBarneedstobeawareofthebarsoitcanmanageit'sdockingetc.

dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar);

//Settingthewidthofthedocksitewillalsoscalethebarsdockedinside,

//howeverthesizeshouldbelargeenoughtoaccomodateallbarsincludingtheconstraintslikeMinimumSizeetc.

dotNetBar

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2