一.引用方法
- 新建项目
- 项目-添加引用-浏览,DevComponents.DotNetBar2.dll 文件,确定.
- 生成一下项目,生成项目后DevComponents.DotNetBar2.dll 会被拷贝到项目的debug文件夹内.
- 在工具箱中,添加选项卡,命名,如dotnetbar2等。
- 打开我的电脑,找到debug\DevComponents.DotNetBar2.dll ,拖到上述选项卡内。
- 删除 Form1,新建Form1,使继承DevComponents.DotNetBar.Office2007Form.
-
二.自定义按钮颜色表
DevComponents.DotNetBar.Rendering.Office2007ButtonItemColorTable table = new DevComponents.DotNetBar.Rendering.Office2007ButtonItemColorTable();
table.Name = "MyColorName"; // This is the color table name that we assigned to the CustomColorName property in designer
table.Default = new DevComponents.DotNetBar.Rendering.Office2007ButtonItemStateColorTable();
table.Default.OuterBorder.Start = System.Drawing.Color.FromArgb(255, 121, 136, 155);
table.Default.OuterBorder.End = System.Drawing.Color.FromArgb(255, 121, 136, 155);
table.Default.TopBackground.Start = System.Drawing.Color.FromArgb(230, 121, 136, 155);
table.Default.TopBackground.End = System.Drawing.Color.FromArgb(230, 99, 123, 155);
table.Default.BottomBackground.Start = System.Drawing.Color.FromArgb(220, 76, 110, 155);
table.Default.BottomBackground.End = System.Drawing.Color.FromArgb(230, 88, 117, 155); ;
table.Default.BottomBackgroundHighlight.Start = System.Drawing.Color.Transparent;
table.Default.BottomBackgroundHighlight.End = System.Drawing.Color.Transparent;
table.Default.Text = System.Drawing.Color.Maroon;
table.MouseOver = new DevComponents.DotNetBar.Rendering.Office2007ButtonItemStateColorTable();
table.MouseOver.OuterBorder.Start = System.Drawing.Color.FromArgb(255, 121, 136, 155);
table.MouseOver.OuterBorder.End = System.Drawing.Color.FromArgb(255, 121, 136, 155);
table.MouseOver.TopBackground.Start = System.Drawing.Color.FromArgb(255, 155, 118, 126);
table.MouseOver.TopBackground.End = System.Drawing.Color.FromArgb(255, 155, 118, 126);
table.MouseOver.BottomBackground.Start = System.Drawing.Color.FromArgb(255, 155, 81, 100);
table.MouseOver.BottomBackground.End = System.Drawing.Color.FromArgb(255, 155, 81, 100);
table.MouseOver.BottomBackgroundHighlight.Start = System.Drawing.Color.Transparent;
table.MouseOver.BottomBackgroundHighlight.End = System.Drawing.Color.Transparent;
table.MouseOver.Text = System.Drawing.Color.Maroon;
table.Pressed = new DevComponents.DotNetBar.Rendering.Office2007ButtonItemStateColorTable();
table.Pressed.OuterBorder.Start = System.Drawing.Color.FromArgb(255, 121, 136, 155);
table.Pressed.OuterBorder.End = System.Drawing.Color.FromArgb(255, 121, 136, 155);
table.Pressed.TopBackground.Start = System.Drawing.Color.FromArgb(255, 170, 94, 119);
table.Pressed.TopBackground.End = System.Drawing.Color.FromArgb(255, 170, 94, 119);
table.Pressed.BottomBackground.Start = System.Drawing.Color.FromArgb(255, 177, 65, 101);
table.Pressed.BottomBackground.End = System.Drawing.Color.FromArgb(255, 177, 65, 104);
table.Pressed.BottomBackgroundHighlight.Start = System.Drawing.Color.Transparent;
table.Pressed.BottomBackgroundHighlight.End = System.Drawing.Color.Transparent;
table.Pressed.Text = System.Drawing.Color.Maroon;
if (DevComponents.DotNetBar.Rendering.GlobalManager.Renderer is DevComponents.DotNetBar.Rendering.Office2007Renderer)
{
DevComponents.DotNetBar.Rendering.Office2007Renderer r = DevComponents.DotNetBar.Rendering.GlobalManager.Renderer as DevComponents.DotNetBar.Rendering.Office2007Renderer;
r.ColorTable.ButtonItemColors.Add(table);
}
注意,控钮控件的背景颜色应设为Transparent.