关于dotnetbar控件

关于dotnetbar控件一 引用方法新建项目 项目 添加引用 浏览 DevComponent DotNetBar2 dll 文件 确定 生成一下项目 生成项目后 DevComponent DotNetBar2 dll 会被拷贝到项目的 debug 文件夹内 在工具箱中 添加选项卡 命名 如 dotnetbar2 等 打开我的电脑 找到 debug DevComponent DotNetBar2 dll 拖到上

一.引用方法

  • 新建项目
  • 项目-添加引用-浏览,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.

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/212745.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 下午7:22
下一篇 2026年3月18日 下午7:22


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号