public class GradientButtons : DevComponents.DotNetBar.PanelEx { #region 私有函数 System.Drawing.Color RGB(string red_green_blue) { int red = Convert.ToInt32(red_green_blue.Substring(0, 2), 16); int green = Convert.ToInt32(red_green_blue.Substring(2, 2), 16); int blue = Convert.ToInt32(red_green_blue.Substring(4, 2), 16); return RGB(red, green, blue); } System.Drawing.Color RGB(int red, int green, int blue) { return System.Drawing.Color.FromArgb(((int)(((byte)(red)))), ((int)(((byte)(green)))), ((int)(((byte)(blue))))); } #endregion public GradientButtons() { this.Cursor = System.Windows.Forms.Cursors.Hand; this.CanvasColor = System.Drawing.SystemColors.Control; this.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.Cursor = System.Windows.Forms.Cursors.Hand; this.DisabledBackColor = System.Drawing.Color.Empty; this.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; this.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; this.Style.Alignment = System.Drawing.StringAlignment.Center; this.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; this.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; this.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; this.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; this.Style.GradientAngle = 90; } public enum ColorStyles { black, gray, white, orange, red, blue, rosy, green, pink } public void styleClass(ColorStyles colorStyles) { switch (colorStyles) { case ColorStyles.black: this.Style.ForeColor.Color = RGB("d7d7d7"); this.Style.BorderColor.Color = RGB("333333"); this.Style.BackColor1.Color = RGB("666666"); this.Style.BackColor2.Color = RGB("000000"); this.StyleMouseOver.BackColor1.Color = RGB("444444"); this.StyleMouseOver.BackColor2.Color = RGB("000000"); this.StyleMouseDown.BackColor1.Color = RGB("000000"); this.StyleMouseDown.BackColor2.Color = RGB("666666"); break; case ColorStyles.gray: this.Style.ForeColor.Color = RGB("e9e9e9"); this.Style.BorderColor.Color = RGB("555555"); this.Style.BackColor1.Color = RGB("888888"); this.Style.BackColor2.Color = RGB("575757"); this.StyleMouseOver.BackColor1.Color = RGB("757575"); this.StyleMouseOver.BackColor2.Color = RGB("4b4b4b"); this.StyleMouseDown.BackColor1.Color = RGB("575757"); this.StyleMouseDown.BackColor2.Color = RGB("888888"); break; case ColorStyles.white: this.Style.ForeColor.Color = RGB("606060"); this.Style.BorderColor.Color = RGB("b7b7b7"); this.Style.BackColor1.Color = RGB("ffffff"); this.Style.BackColor2.Color = RGB("ededed"); this.StyleMouseOver.BackColor1.Color = RGB("ffffff"); this.StyleMouseOver.BackColor2.Color = RGB("dcdcdc"); this.StyleMouseDown.BackColor1.Color = RGB("ededed"); this.StyleMouseDown.BackColor2.Color = RGB("ffffff"); break; case ColorStyles.orange: this.Style.ForeColor.Color = RGB("fef4e9"); this.Style.BorderColor.Color = RGB("da7c0c"); this.Style.BackColor1.Color = RGB("faa51a"); this.Style.BackColor2.Color = RGB("f47a20"); this.StyleMouseOver.BackColor1.Color = RGB("f88e11"); this.StyleMouseOver.BackColor2.Color = RGB("f06015"); this.StyleMouseDown.BackColor1.Color = RGB("f47a20"); this.StyleMouseDown.BackColor2.Color = RGB("faa51a"); break; case ColorStyles.red: this.Style.ForeColor.Color = RGB("faddde"); this.Style.BorderColor.Color = RGB("980c10"); this.Style.BackColor1.Color = RGB("ed1c24"); this.Style.BackColor2.Color = RGB("aa1317"); this.StyleMouseOver.BackColor1.Color = RGB("c9151b"); this.StyleMouseOver.BackColor2.Color = RGB("a11115"); this.StyleMouseDown.BackColor1.Color = RGB("aa1317"); this.StyleMouseDown.BackColor2.Color = RGB("ed1c24"); break; case ColorStyles.blue: this.Style.ForeColor.Color = RGB("d9eef7"); this.Style.BorderColor.Color = RGB("0076a3"); this.Style.BackColor1.Color = RGB("00adee"); this.Style.BackColor2.Color = RGB("0078a5"); this.StyleMouseOver.BackColor1.Color = RGB("0095cc"); this.StyleMouseOver.BackColor2.Color = RGB("00678e"); this.StyleMouseDown.BackColor1.Color = RGB("0078a5"); this.StyleMouseDown.BackColor2.Color = RGB("00adee"); break; case ColorStyles.rosy: this.Style.ForeColor.Color = RGB("fae7e9"); this.Style.BorderColor.Color = RGB("b73948"); this.Style.BackColor1.Color = RGB("f16c7c"); this.Style.BackColor2.Color = RGB("bf404f"); this.StyleMouseOver.BackColor1.Color = RGB("cf5d6a"); this.StyleMouseOver.BackColor2.Color = RGB("a53845"); this.StyleMouseDown.BackColor1.Color = RGB("bf404f"); this.StyleMouseDown.BackColor2.Color = RGB("f16c7c"); break; case ColorStyles.green: this.Style.ForeColor.Color = RGB("e8f0de"); this.Style.BorderColor.Color = RGB("538312"); this.Style.BackColor1.Color = RGB("7db72f"); this.Style.BackColor2.Color = RGB("4e7d0e"); this.StyleMouseOver.BackColor1.Color = RGB("6b9d28"); this.StyleMouseOver.BackColor2.Color = RGB("436b0c"); this.StyleMouseDown.BackColor1.Color = RGB("4e7d0e"); this.StyleMouseDown.BackColor2.Color = RGB("7db72f"); break; case ColorStyles.pink: this.Style.ForeColor.Color = RGB("feeef5"); this.Style.BorderColor.Color = RGB("d2729e"); this.Style.BackColor1.Color = RGB("feb1d3"); this.Style.BackColor2.Color = RGB("f171ab"); this.StyleMouseOver.BackColor1.Color = RGB("f4aacb"); this.StyleMouseOver.BackColor2.Color = RGB("e86ca4"); this.StyleMouseDown.BackColor1.Color = RGB("f171ab"); this.StyleMouseDown.BackColor2.Color = RGB("feb1d3"); break; } } }