首页 > 代码库 > DevComponents.DotNetBar.Command使用方法

DevComponents.DotNetBar.Command使用方法

如前文所说,DotNetBar为用户制作界面程序提供了很大的方便。同时其也提供了许多其他的工具,例如本文提到的DevComponents.DotNetBar.Command。

DevComponents.DotNetBar.Command的思想是将界面设计与相应函数的实现分离,降低系统内部的耦合性,同时可以提高相应函数的复用性。我们可以把Command对象绑定到一个系统控件上,在控件的触发一定动作时通过Command的响应函数来实现相应操作。

例如:

示例一

InitializeComponent函数

private void InitializeComponent()
{
    this.buttonX1 = new DevComponents.DotNetBar.ButtonX();
    this.command1 = new DevComponents.DotNetBar.Command();
    this.SuspendLayout();
    // 
    // buttonX1
    // 
    this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
    this.buttonX1.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
    this.buttonX1.Command = this.command1;
    this.buttonX1.Location = new System.Drawing.Point(367, 51);
    this.buttonX1.Name = "buttonX1";
    this.buttonX1.Text = "buttonX1";
    // 
    // command1
    // 
    this.command1.Executed += new System.EventHandler(this.command1_Executed);
    // 
    // Form1
    // 
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.ClientSize = new System.Drawing.Size(549, 363);
    this.Controls.Add(this.buttonX1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.ResumeLayout(false);
}

command1响应函数

private void command1_Executed(object sender, EventArgs e)

{

MessageBox.Show("Just Test");

 

 

jiayuan.com/121664874
jiayuan.com/121646238
jiayuan.com/121668066
jiayuan.com/121668243
jiayuan.com/121668337
jiayuan.com/121668454
jiayuan.com/121668588
jiayuan.com/121678877
jiayuan.com/121678987
jiayuan.com/121679106
jiayuan.com/121679213
jiayuan.com/121679574
jiayuan.com/121679714
jiayuan.com/121679956
jiayuan.com/121680172
jiayuan.com/121680342
jiayuan.com/121680524
jiayuan.com/121680707
jiayuan.com/121680900
jiayuan.com/121681643
jiayuan.com/121681804
jiayuan.com/121681975
jiayuan.com/121682295
jiayuan.com/121682462
jiayuan.com/121682682
jiayuan.com/121682837
jiayuan.com/121683064
jiayuan.com/121683231
jiayuan.com/121683601
jiayuan.com/121683797
jiayuan.com/121684031
jiayuan.com/121684221
jiayuan.com/121684411
jiayuan.com/121684529
jiayuan.com/121684687
jiayuan.com/121685109
jiayuan.com/121685332
jiayuan.com/121685497
jiayuan.com/121685689
jiayuan.com/121686121
jiayuan.com/121686393
jiayuan.com/121686583
jiayuan.com/121686777
jiayuan.com/121686964
jiayuan.com/121687194
jiayuan.com/121687395
jiayuan.com/121687538
jiayuan.com/121687929
jiayuan.com/121688131
jiayuan.com/121688344
jiayuan.com/121688616
jiayuan.com/121688765
jiayuan.com/121688963
jiayuan.com/121689156
jiayuan.com/121689358
jiayuan.com/121689583
jiayuan.com/121689771
jiayuan.com/121689966
jiayuan.com/121690216
jiayuan.com/121690416
jiayuan.com/121690649
jiayuan.com/121690830
jiayuan.com/121691082
jiayuan.com/121691281
jiayuan.com/121691494
jiayuan.com/121691690
jiayuan.com/121691901
jiayuan.com/121692135
jiayuan.com/121692351
jiayuan.com/121692611
jiayuan.com/121692824
jiayuan.com/121692977
jiayuan.com/121693164
jiayuan.com/121693399
jiayuan.com/121693605
jiayuan.com/121693828
jiayuan.com/121694097
jiayuan.com/121694318
jiayuan.com/121694498
jiayuan.com/121694747
jiayuan.com/121694958
jiayuan.com/121698304
jiayuan.com/121698587
jiayuan.com/121698767
jiayuan.com/121698978
jiayuan.com/121699137
jiayuan.com/121699365
jiayuan.com/121699551
jiayuan.com/121699757
jiayuan.com/121699943
jiayuan.com/121700109
jiayuan.com/121700257
jiayuan.com/121700421
jiayuan.com/121700609
jiayuan.com/121700820
jiayuan.com/121700991
jiayuan.com/121701217
jiayuan.com/121701380
jiayuan.com/121701542
jiayuan.com/121701922
jiayuan.com/121702095
jiayuan.com/121702289
jiayuan.com/121702470
jiayuan.com/121702628
jiayuan.com/121702815
jiayuan.com/121702984
jiayuan.com/121703146
jiayuan.com/121703314
jiayuan.com/121703526
jiayuan.com/121703711
jiayuan.com/121703907
jiayuan.com/121704061
jiayuan.com/121704240
jiayuan.com/121704365
jiayuan.com/121704550
jiayuan.com/121704689
jiayuan.com/121704851
jiayuan.com/121705043
jiayuan.com/121705226
jiayuan.com/121705407
jiayuan.com/121705616
jiayuan.com/121706141
jiayuan.com/121706354
jiayuan.com/121706754
jiayuan.com/121707106
jiayuan.com/121707274
jiayuan.com/121707420
jiayuan.com/121707585
jiayuan.com/121707762
jiayuan.com/121707927
jiayuan.com/121708081
jiayuan.com/121708348
jiayuan.com/121708463
jiayuan.com/121708612
jiayuan.com/121708752
jiayuan.com/121708872
jiayuan.com/121708982
jiayuan.com/121709128
jiayuan.com/121709226
jiayuan.com/121709313
jiayuan.com/121709436
jiayuan.com/121709565
jiayuan.com/121709680
jiayuan.com/121709806
jiayuan.com/121709909
jiayuan.com/121710016
jiayuan.com/121710119
jiayuan.com/121710237
jiayuan.com/121710320
jiayuan.com/121710440
jiayuan.com/121710526
jiayuan.com/121710589
jiayuan.com/121710668
jiayuan.com/121710741
jiayuan.com/121710898
jiayuan.com/121711077
jiayuan.com/121711160
jiayuan.com/121711270
jiayuan.com/121711360
jiayuan.com/121711551
jiayuan.com/121711647
jiayuan.com/121711735
jiayuan.com/121711807
jiayuan.com/121711974

 

 

DevComponents.DotNetBar.Command使用方法