DevExpress Diagram 抽取原BarItem至自定义ToolBar
Posted jjhua
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DevExpress Diagram 抽取原BarItem至自定义ToolBar相关的知识,希望对你有一定的参考价值。
例如:从Ribbon中提取DevExpress.XtraDiagram.Bars.DiagramCommandSelectConnectorToolBarCheckItem
至自定义的Bar中,效果如下图:
UcXXX.Designer.cs
namespace DiagramDesign
partial class XtraUserControl2
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
if (disposing && (components != null))
components.Dispose();
base.Dispose(disposing);
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
this.components = new System.ComponentModel.Container();
// 必须有,BarItem和DiagramControl的中间者
this.diagramControl1 = new DevExpress.XtraDiagram.DiagramControl();
this.diagramCommandSelectConnectorToolBarCheckItem1 = new DevExpress.XtraDiagram.Bars.DiagramCommandSelectConnectorToolBarCheckItem();
this.diagramBarController1 = new DevExpress.XtraDiagram.Bars.DiagramBarController(this.components);
this.barManager1 = new DevExpress.XtraBars.BarManager(this.components);
this.bar1 = new DevExpress.XtraBars.Bar();
this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
this.barDockControlRight = new DevExpress.XtraBars.BarDockControl();
((System.ComponentModel.ISupportInitialize)(this.diagramControl1)).BeginInit();
// 必须有,否则设计时不显示图标
((System.ComponentModel.ISupportInitialize)(this.diagramBarController1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
this.SuspendLayout();
//
// diagramControl1
//
this.diagramControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.diagramControl1.Location = new System.Drawing.Point(0, 24);
this.diagramControl1.Name = "diagramControl1";
this.diagramControl1.OptionsBehavior.SelectedStencils = new DevExpress.Diagram.Core.StencilCollection(new string[]
"BasicShapes",
"BasicFlowchartShapes");
this.diagramControl1.OptionsView.PaperKind = System.Drawing.Printing.PaperKind.Letter;
this.diagramControl1.Size = new System.Drawing.Size(1210, 823);
this.diagramControl1.TabIndex = 0;
this.diagramControl1.Text = "diagramControl1";
//
// diagramCommandSelectConnectorToolBarCheckItem1
//
this.diagramCommandSelectConnectorToolBarCheckItem1.Id = 1;
this.diagramCommandSelectConnectorToolBarCheckItem1.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.False;
this.diagramCommandSelectConnectorToolBarCheckItem1.Name = "diagramCommandSelectConnectorToolBarCheckItem1";
//
// diagramBarController1
//
this.diagramBarController1.BarItems.Add(this.diagramCommandSelectConnectorToolBarCheckItem1);
this.diagramBarController1.Control = this.diagramControl1;
//
// barManager1
//
this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[]
this.bar1);
this.barManager1.DockControls.Add(this.barDockControlTop);
this.barManager1.DockControls.Add(this.barDockControlBottom);
this.barManager1.DockControls.Add(this.barDockControlLeft);
this.barManager1.DockControls.Add(this.barDockControlRight);
this.barManager1.Form = this;
// 添加项
this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[]
this.diagramCommandSelectConnectorToolBarCheckItem1);
this.barManager1.MaxItemId = 2;
//
// bar1
//
this.bar1.BarName = "Tools";
this.bar1.DockCol = 0;
this.bar1.DockRow = 0;
this.bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
this.bar1.FloatLocation = new System.Drawing.Point(49, 109);
// 添加项
this.bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[]
new DevExpress.XtraBars.LinkPersistInfo(this.diagramCommandSelectConnectorToolBarCheckItem1));
this.bar1.Offset = 2;
this.bar1.Text = "Tools";
//
// barDockControlTop
//
this.barDockControlTop.CausesValidation = false;
this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.barDockControlTop.Location = new System.Drawing.Point(0, 0);
this.barDockControlTop.Manager = this.barManager1;
this.barDockControlTop.Size = new System.Drawing.Size(1210, 24);
//
// barDockControlBottom
//
this.barDockControlBottom.CausesValidation = false;
this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.barDockControlBottom.Location = new System.Drawing.Point(0, 847);
this.barDockControlBottom.Manager = this.barManager1;
this.barDockControlBottom.Size = new System.Drawing.Size(1210, 0);
//
// barDockControlLeft
//
this.barDockControlLeft.CausesValidation = false;
this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.barDockControlLeft.Location = new System.Drawing.Point(0, 24);
this.barDockControlLeft.Manager = this.barManager1;
this.barDockControlLeft.Size = new System.Drawing.Size(0, 823);
//
// barDockControlRight
//
this.barDockControlRight.CausesValidation = false;
this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.barDockControlRight.Location = new System.Drawing.Point(1210, 24);
this.barDockControlRight.Manager = this.barManager1;
this.barDockControlRight.Size = new System.Drawing.Size(0, 823);
//
// XtraUserControl2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.diagramControl1);
this.Controls.Add(this.barDockControlLeft);
this.Controls.Add(this.barDockControlRight);
this.Controls.Add(this.barDockControlBottom);
this.Controls.Add(this.barDockControlTop);
this.Name = "XtraUserControl2";
this.Size = new System.Drawing.Size(1210, 847);
((System.ComponentModel.ISupportInitialize)(this.diagramControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.diagramBarController1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
#endregion
private DevExpress.XtraDiagram.DiagramControl diagramControl1;
private DevExpress.XtraDiagram.Bars.DiagramCommandSelectConnectorToolBarCheckItem diagramCommandSelectConnectorToolBarCheckItem1;
private DevExpress.XtraDiagram.Bars.DiagramBarController diagramBarController1;
private DevExpress.XtraBars.BarManager barManager1;
private DevExpress.XtraBars.Bar bar1;
private DevExpress.XtraBars.BarDockControl barDockControlTop;
private DevExpress.XtraBars.BarDockControl barDockControlBottom;
private DevExpress.XtraBars.BarDockControl barDockControlLeft;
private DevExpress.XtraBars.BarDockControl barDockControlRight;
以上是关于DevExpress Diagram 抽取原BarItem至自定义ToolBar的主要内容,如果未能解决你的问题,请参考以下文章