نوشته شده توسط
nazanin366
button item یه کامپوننتی از شرکت dev هستش که از buttonX درست میشه.یه منو رو تصور کنید که با باتن درست شده باشه.کدهایی که گفتین رو پیاده سازی کردم ولی روی button item جواب نمیده
.................................................. ............
private void CreateNewPanel()
{
DevComponents.DotNetBar.ButtonItem button = default(DevComponents.DotNetBar.ButtonItem);
button = new DevComponents.DotNetBar.ButtonItem();
button.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
// Assign your image here instead of taking one from existing buttons
button.Image = (Image)ButtonItem1.Image.Clone();
button.Name = "newButton";
button.OptionGroup = "navBar";
button.Text = "New Item";
// Setup panel which is connected to button and acts as container for other controls
DevComponents.DotNetBar.NavigationPanePanel panel = default(DevComponents.DotNetBar.NavigationPanePane l);
panel = new DevComponents.DotNetBar.NavigationPanePanel();
panel.AntiAlias = true;
// Add any controls to the panel by adding them to the Controls collection
panel.Dock = System.Windows.Forms.DockStyle.Fill;
panel.DockPadding.Left = 1;
panel.DockPadding.Right = 1;
panel.DockPadding.Top = 1;
panel.Location = new System.Drawing.Point(0, 24);
// Connect panel and the button
panel.ParentItem = button;
panel.Size = new System.Drawing.Size(184, 214);
panel.Style.Alignment = System.Drawing.StringAlignment.Center;
panel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackgr ound;
panel.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackgr ound2;
panel.Style.BackgroundImagePosition = DevComponents.DotNetBar.eBackgroundImagePosition.T ile;
panel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
panel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBord er;
panel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
panel.Style.GradientAngle = 90;
panel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
panel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.NavigationPane1.Controls.Add(panel);
this.NavigationPane1.Items.Add(button);
this.NavigationPane1.RecalcLayout();
// Select newly created panel
button.Checked = true;
}
منبع http://www.devcomponents.com/kb2/?p=302