private void SkinButtonStyles(FlatStyle style) { btnOpen.FlatStyle = style; btnCleaner.FlatStyle = style; btnClose.FlatStyle = style; btnClipboard.FlatStyle = style; }
public void ButtonBaseAccessibleObject_State_is_correct(FlatStyle flatStyle, bool createControl, bool mouseIsDown, AccessibleStates expectedAccessibleState) { using var button = new SubButtonBase() { FlatStyle = flatStyle }; if (createControl) { button.CreateControl(); } Assert.Equal(createControl, button.IsHandleCreated); if (mouseIsDown) { button.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); } var buttonBaseAccessibleObject = new ButtonBase.ButtonBaseAccessibleObject(button); Assert.Equal(expectedAccessibleState, buttonBaseAccessibleObject.State); // TODO: ControlAccessibleObject shouldn't force handle creation, tracked in https://github.com/dotnet/winforms/issues/3062 Assert.True(button.IsHandleCreated); }
private void customInitialisation() { this.SuspendLayout(); this._FlatStyle = FlatStyle.System; this.BackColor = Color.Transparent; this.ResumeLayout(false); }
/// <summary> /// FlatStyleを文字列から列挙型に変換 /// </summary> /// <param name="styleName">FlatStyle名</param> /// <returns>列挙型</returns> public static FlatStyle GetFlatStyle(string styleName) { FlatStyle style = FlatStyle.Standard; switch (styleName) { case "Standard": style = FlatStyle.Standard; break; case "System": style = FlatStyle.System; break; case "Popup": style = FlatStyle.Popup; break; case "Flat": style = FlatStyle.Flat; break; default: style = FlatStyle.Standard; break; } return(style); }
private void frmAbout_Load(object sender, EventArgs e) { // Localize the form btnOK.Text = localization.strings.ok; // Color text and background according to the current theme var defSettings = Properties.Settings.Default; this.BackColor = defSettings.customTheme ? defSettings.colorBgd : defSettings.colorBgdOriginal; this.ForeColor = defSettings.customTheme ? defSettings.colorTxt : defSettings.colorTxtOriginal; FlatStyle buttonStyle = defSettings.customTheme ? FlatStyle.Flat : FlatStyle.Standard; btnOK.FlatStyle = buttonStyle; btnOK.BackColor = this.BackColor; btnOK.ForeColor = this.ForeColor; if (ApplicationDeployment.IsNetworkDeployed) { var version = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); lblVersion.Text = "Idle Master v" + version; } else { var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); lblVersion.Text = "Idle Master v" + version; } }
private static int DefaultBaselineOffset(ContentAlignment alignment, FlatStyle flatStyle) { if ((alignment & DesignerUtils.AnyMiddleAlignment) != 0) { return(0); } else { // Top or bottom alignment if ((flatStyle == FlatStyle.Standard) || (flatStyle == FlatStyle.Popup)) { return(((alignment & DesignerUtils.AnyTopAlignment) != 0) ? 4 : -4); } else if (flatStyle == FlatStyle.System) { return(((alignment & DesignerUtils.AnyTopAlignment) != 0) ? 3 : -3); } else if (flatStyle == FlatStyle.Flat) { return(((alignment & DesignerUtils.AnyTopAlignment) != 0) ? 5 : -5); } else { Debug.Fail("Unknown FlatStyle"); return(0); //Unknown FlatStyle } } }
/// <summary> /// 读FlatStyle型样式配置节 /// </summary> /// <param name="nodeName">读取的XmlAttribute所属XmlNode的name</param> /// <param name="attributeName">要读取的配置节属性名</param> /// <param name="attribute">要读取的配置节属性对象</param> /// <returns>读取并转换好的FlatStyle枚举值,若数据不存在则返回FlatStyle.Flat</returns> public static FlatStyle ReadFlatStyle(string nodeName, string attributeName, XmlAttribute attribute) { FlatStyle retFlatStyle = FlatStyle.Flat; if (attribute == null) { //不存在指定属性时返回BorderStyle.None return(FlatStyle.Flat); } string value = attribute.Value.Trim(); if (string.IsNullOrEmpty(value)) { return(FlatStyle.Flat); //配置节存在,但值为空的时候,返回BorderStyle.None } try { retFlatStyle = (FlatStyle)Enum.Parse(typeof(FlatStyle), value); } catch { throw new Exception(string.Format( "读取节点{0}中的FlatStyle型属性{1}时,值[{2}]格式不合法,请检查皮肤配置文件相关配置节!", nodeName, attributeName, value)); } return(retFlatStyle); }
public void SetFlatStyle(FlatStyle v) { flatstyle = v; lbsys.Visible = (flatstyle == FlatStyle.System); this.Invalidate(); lbsys.Items.AddRange(this.Items.ToArray()); }
private static int RadiobuttonBaselineOffset(ContentAlignment alignment, FlatStyle flatStyle) { if ((alignment & DesignerUtils.AnyMiddleAlignment) != 0) { if (flatStyle == FlatStyle.System) { return(-1); } else { return(0); //FlatStyle.Standard || FlatStyle.Flat || FlatStyle.Popup || Unknown FlatStyle } } else {// Top or bottom alignment if ((flatStyle == FlatStyle.Standard) || (flatStyle == FlatStyle.Flat) || (flatStyle == FlatStyle.Popup)) { return(((alignment & DesignerUtils.AnyTopAlignment) != 0) ? 2 : -2); } else if (flatStyle == FlatStyle.System) { return(0); } else { Debug.Fail("Unknown FlatStyle"); return(0); //Unknown FlatStyle } } }
public Label() { // Defaults in the Spec autosize = false; TabStop = false; string_format = new StringFormat(); string_format.FormatFlags = StringFormatFlags.LineLimit; TextAlign = ContentAlignment.TopLeft; image = null; UseMnemonic = true; image_list = null; image_align = ContentAlignment.MiddleCenter; SetUseMnemonic(UseMnemonic); flat_style = FlatStyle.Standard; SetStyle(ControlStyles.Selectable, false); SetStyle(ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor #if NET_2_0 | ControlStyles.OptimizedDoubleBuffer #else | ControlStyles.DoubleBuffer #endif , true); HandleCreated += new EventHandler(OnHandleCreatedLB); }
/* * SetPadding */ private void SetPadding(FlatStyle flatStyle) { Padding currentPadding = this.TabRenderer.GetPadding(flatStyle); currentPadding.Top += this.TabStripBounds.Bottom; this.Padding = currentPadding; }
private static GroupBox MakeGroup (int x, int y, String text, FlatStyle style, Size buttonSize, String[] buttonStrings) { int bHeight = buttonSize.Height; int width = buttonSize.Width + 20; int height = ((bHeight + 10) * buttonStrings.Length) + 40; GroupBox box = new GroupBox(); box.Size = new Size(width, height); box.Location = new Point(x, y); box.Text = text; box.FlatStyle = style; x += 10; y += 40; FlatStyle sNone = (FlatStyle)0; Appearance aNone = (Appearance)0; for (int i = 0; i < buttonStrings.Length; ++i) { box.Controls.Add(MakeButton(x, y, buttonSize, buttonStrings[i], sNone, false, aNone, false)); y += bHeight + 10; } return(box); }
private int DefaultBaselineOffset(ContentAlignment alignment, FlatStyle flatStyle) { if ((alignment & DesignerUtils.anyMiddleAlignment) != ((ContentAlignment)0)) { return(0); } if ((flatStyle == FlatStyle.Standard) || (flatStyle == FlatStyle.Popup)) { if ((alignment & DesignerUtils.anyTopAlignment) == ((ContentAlignment)0)) { return(-4); } return(4); } if (flatStyle == FlatStyle.System) { if ((alignment & DesignerUtils.anyTopAlignment) == ((ContentAlignment)0)) { return(-3); } return(3); } if (flatStyle != FlatStyle.Flat) { return(0); } if ((alignment & DesignerUtils.anyTopAlignment) == ((ContentAlignment)0)) { return(-5); } return(5); }
private void SetFlatStyle(bool flat) { FlatStyle flatStyle = flat ? FlatStyle.Flat : FlatStyle.Standard; SimpleButton.FlatStyle = SimpleDropDown.FlatStyle = SimpleSplitButton.FlatStyle = SimpleToggleButton.FlatStyle = SimpleButton.FlatStyle = SimpleDropDown.FlatStyle = SimpleSplitButton.FlatStyle = SimpleToggleButton.FlatStyle = flatStyle; ButtonWithImage.FlatStyle = DropDownWithImage.FlatStyle = SplitButtonWithImage.FlatStyle = ToggleButtonWithImage.FlatStyle = ButtonWithImage.FlatStyle = DropDownWithImage.FlatStyle = SplitButtonWithImage.FlatStyle = ToggleButtonWithImage.FlatStyle = flatStyle; ButtonWithStateSensitiveImage.FlatStyle = DropDownWithStateSensitiveImage.FlatStyle = SplitButtonWithStateSensitiveImage.FlatStyle = ToggleButtonWithStateSensitiveImage.FlatStyle = ButtonWithStateSensitiveImage.FlatStyle = DropDownWithStateSensitiveImage.FlatStyle = SplitButtonWithStateSensitiveImage.FlatStyle = ToggleButtonWithStateSensitiveImage.FlatStyle = flatStyle; }
private int DefaultBaselineOffset(ContentAlignment alignment, FlatStyle flatStyle) { if ((alignment & DesignerUtils.anyMiddleAlignment) != ((ContentAlignment) 0)) { return 0; } if ((flatStyle == FlatStyle.Standard) || (flatStyle == FlatStyle.Popup)) { if ((alignment & DesignerUtils.anyTopAlignment) == ((ContentAlignment) 0)) { return -4; } return 4; } if (flatStyle == FlatStyle.System) { if ((alignment & DesignerUtils.anyTopAlignment) == ((ContentAlignment) 0)) { return -3; } return 3; } if (flatStyle != FlatStyle.Flat) { return 0; } if ((alignment & DesignerUtils.anyTopAlignment) == ((ContentAlignment) 0)) { return -5; } return 5; }
//*************************************************************************** // Static Methods // public static void SetAllFlatStyles(Control.ControlCollection controls, FlatStyle value) { foreach (Control cn in controls) { Type cnType = cn.GetType(); //System.Reflection.PropertyInfo pi = cnType.GetProperty("FlatStyle"); System.Reflection.MemberInfo[] pi = cnType.FindMembers(System.Reflection.MemberTypes.Property, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, System.Type.FilterNameIgnoreCase, "FlatStyle"); if (pi != null && pi.Length > 0) { if (cnType.FullName != "RainstormStudios.Controls.AdvancedButton") { ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, value, null); } else if (cnType.FullName == "RainstormStudios.Controls.AdvancedButton") { try { AdvancedButton.AdvButtonStyle btnStyle = (AdvancedButton.AdvButtonStyle)Enum.Parse(typeof(AdvancedButton.AdvButtonStyle), value.ToString()); ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, btnStyle, null); } finally { } } } if (cn.Controls.Count > 0) { RsUserControlBase.SetAllFlatStyles(cn.Controls, value); } } }
private void frmSettingsAdvanced_Load(object sender, EventArgs e) { // Localize Form btnUpdate.Text = localization.strings.update; this.Text = localization.strings.auth_data; ttHelp.SetToolTip(btnView, localization.strings.cookie_warning); // Read settings var customTheme = Settings.Default.customTheme; var whiteIcons = Settings.Default.whiteIcons; // Define colors this.BackColor = customTheme ? Settings.Default.colorBgd : Settings.Default.colorBgdOriginal; this.ForeColor = customTheme ? Settings.Default.colorTxt : Settings.Default.colorTxtOriginal; // Buttons FlatStyle buttonStyle = customTheme ? FlatStyle.Flat : FlatStyle.Standard; btnView.FlatStyle = btnUpdate.FlatStyle = buttonStyle; btnView.BackColor = btnUpdate.BackColor = this.BackColor; btnView.ForeColor = btnUpdate.ForeColor = this.ForeColor; btnView.Image = customTheme ? Resources.imgView_w : Resources.imgView; if (!string.IsNullOrWhiteSpace(Settings.Default.sessionid)) { txtSessionID.Text = Settings.Default.sessionid; txtSessionID.Enabled = false; } else { txtSessionID.PasswordChar = '\0'; } if (!string.IsNullOrWhiteSpace(Settings.Default.steamLogin)) { txtSteamLogin.Text = Settings.Default.steamLogin; txtSteamLogin.Enabled = false; } else { txtSteamLogin.PasswordChar = '\0'; } if (!string.IsNullOrWhiteSpace(Settings.Default.steamparental)) { txtSteamParental.Text = Settings.Default.steamparental; txtSteamParental.Enabled = false; } else { txtSteamParental.PasswordChar = '\0'; } if (txtSessionID.Enabled && txtSteamLogin.Enabled && txtSteamParental.Enabled) { btnView.Visible = false; } btnUpdate.Enabled = false; }
protected ButtonBase() : base() { flat_style = FlatStyle.Standard; flat_button_appearance = new FlatButtonAppearance (this); this.image_key = string.Empty; this.text_image_relation = TextImageRelation.Overlay; this.use_mnemonic = true; use_visual_style_back_color = true; image_index = -1; image = null; image_list = null; image_alignment = ContentAlignment.MiddleCenter; ImeMode = ImeMode.Disable; text_alignment = ContentAlignment.MiddleCenter; is_default = false; is_pressed = false; text_format = new StringFormat(); text_format.Alignment = StringAlignment.Center; text_format.LineAlignment = StringAlignment.Center; text_format.HotkeyPrefix = HotkeyPrefix.Show; text_format.FormatFlags |= StringFormatFlags.LineLimit; text_format_flags = TextFormatFlags.HorizontalCenter; text_format_flags |= TextFormatFlags.VerticalCenter; text_format_flags |= TextFormatFlags.TextBoxControl; SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque | ControlStyles.UserMouse | ControlStyles.SupportsTransparentBackColor | ControlStyles.CacheText | ControlStyles.OptimizedDoubleBuffer, true); SetStyle (ControlStyles.StandardClick, false); }
public Label() { // Defaults in the Spec autosize = false; TabStop = false; string_format = new StringFormat(); string_format.FormatFlags = StringFormatFlags.LineLimit; TextAlign = ContentAlignment.TopLeft; image = null; UseMnemonic = true; image_list = null; image_align = ContentAlignment.MiddleCenter; SetUseMnemonic(UseMnemonic); flat_style = FlatStyle.Standard; SetStyle(ControlStyles.Selectable, false); SetStyle(ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer , true); can_cache_preferred_size = true; }
protected ButtonBase() : base() { flat_style = FlatStyle.Standard; flat_button_appearance = new FlatButtonAppearance(this); this.image_key = string.Empty; this.text_image_relation = TextImageRelation.Overlay; this.use_mnemonic = true; use_visual_style_back_color = true; image_index = -1; image = null; image_list = null; image_alignment = ContentAlignment.MiddleCenter; ImeMode = ImeMode.Disable; text_alignment = ContentAlignment.MiddleCenter; is_default = false; is_pressed = false; text_format = new StringFormat(); text_format.Alignment = StringAlignment.Center; text_format.LineAlignment = StringAlignment.Center; text_format.HotkeyPrefix = HotkeyPrefix.Show; text_format.FormatFlags |= StringFormatFlags.LineLimit; text_format_flags = TextFormatFlags.HorizontalCenter; text_format_flags |= TextFormatFlags.VerticalCenter; text_format_flags |= TextFormatFlags.TextBoxControl; SetStyle(ControlStyles.ResizeRedraw | ControlStyles.Opaque | ControlStyles.UserMouse | ControlStyles.SupportsTransparentBackColor | ControlStyles.CacheText | ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.StandardClick, false); }
// Constructor. public GroupBox() { base.TabStop = false; this.flatStyle = FlatStyle.Standard; this.entered = false; SetStyle(ControlStyles.ContainerControl, true); SetStyle(ControlStyles.Selectable, false); }
internal Case() { ForeColor = Color.Black; BackColor = Color.White; FlatStyle = new FlatStyle(); Text = value.ToString(); FlatAppearance.BorderColor = Color.White; }
public GroupBox() { TabStop = false; flat_style = FlatStyle.Standard; SetStyle(ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.Selectable, false); }
public EnumColumn(object DataSource, string ValueMember, string DisplayMember, FlatStyle FlatStyle) { this.DataSource = DataSource; this.ValueMember = ValueMember; this.DisplayMember = DisplayMember; this.FlatStyle = FlatStyle; EnumCell = new EnumCell(); CellTemplate = EnumCell; }
public static GUISkin LoadSkinFromWindow(Form window, FlatStyle buttonFlatStyle) { GUISkin skin = new GUISkin(); skin.FormBackgroundColor = window.BackColor; skin.FormFont = window.Font; skin.FormTextColor = window.ForeColor; skin.ButtonFlatStyle = buttonFlatStyle; return(skin); }
//===================================================================== /// <summary> /// Constructor /// </summary> protected BaseComboBoxCell() { maxDropDownItems = 8; displayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton; flatStyle = FlatStyle.Standard; displayMember = valueMember = String.Empty; miParseFormattedValueInternal = base.GetType().GetMethod("ParseFormattedValueInternal", BindingFlags.NonPublic | BindingFlags.Instance); }
public override bool Populate(cmnGroupData data) { if (!base.Populate(data) || data.GetType() != typeof(CMNBtnGroupData)) { return(false); } CMNBtnGroupData calcBtnGroupData = (CMNBtnGroupData)data; if (calcBtnGroupData.mButtons == null || calcBtnGroupData.mButtons.Length == 0) { return(true); } this.mButtons = new GroupButton[calcBtnGroupData.mButtons.Length]; this.mRows = 0; this.mColumns = 0; foreach (cmnBtnData mButton in calcBtnGroupData.mButtons) { if (mButton.mVIndex >= this.mRows) { ++this.mRows; } if (mButton.mHIndex >= this.mColumns) { ++this.mColumns; } } if (this.mRows == 0 || this.mColumns == 0) { return(true); } this.mHeight = ButtonGroupCtrl.GROUP_TOP_PADDING + this.mRows * (calcBtnGroupData.mBtnSize.Height + ButtonGroupCtrl.BUTTON_V_SPACE) - ButtonGroupCtrl.BUTTON_V_SPACE + ButtonGroupCtrl.GROUP_BOTTOM_PADDING; FlatStyle btnStyle = ButtonGroupCtrl.GetBtnStyle(); for (int index = 0; index < calcBtnGroupData.mButtons.Length; ++index) { cmnBtnData data1 = (cmnBtnData)calcBtnGroupData.mButtons.GetValue(index); GroupButton groupButton = new GroupButton(data1); groupButton.FlatStyle = btnStyle; groupButton.ForeColor = Color.FromName(data1.msColor); groupButton.Location = new Point(ButtonGroupCtrl.GROUP_LEFT_PADDING + data1.mHIndex * (calcBtnGroupData.mBtnSize.Width + ButtonGroupCtrl.BUTTON_H_SPACE), ButtonGroupCtrl.GROUP_TOP_PADDING + data1.mVIndex * (calcBtnGroupData.mBtnSize.Height + ButtonGroupCtrl.BUTTON_V_SPACE)); groupButton.Size = calcBtnGroupData.mBtnSize; groupButton.Name = data1.msExpression; groupButton.TabIndex = index; groupButton.Text = ResHandler.GetResStringByName(data1.msLabel); string msToolTip = data1.msToolTip; if (msToolTip != null && !msToolTip.Equals("")) { groupButton.ToolTip = ResHandler.GetResStringByName(data1.msToolTip); } groupButton.Click += new EventHandler(this.OnButton_Click); this.mButtons.SetValue((object)groupButton, index); this.Controls.Add((Control)groupButton); } return(true); }
private int CheckboxBaselineOffset(ContentAlignment alignment, FlatStyle flatStyle) { if ((alignment & DesignerUtils.AnyMiddleAlignment) != 0) { if ((flatStyle == FlatStyle.Standard) || (flatStyle == FlatStyle.System)) { return(-1); } else { return(0); //FlatStyle.Flat || FlatStyle.Popup || Unknown FlatStyle } } else if ((alignment & DesignerUtils.AnyTopAlignment) != 0) { if (flatStyle == FlatStyle.Standard) { return(1); } else if (flatStyle == FlatStyle.System) { return(0); } else if ((flatStyle == FlatStyle.Flat) || (flatStyle == FlatStyle.Popup)) { return(2); } else { Debug.Fail("Unknown FlatStyle"); return(0); //Unknown FlatStyle } } else {//bottom alignment if (flatStyle == FlatStyle.Standard) { return(-3); } else if (flatStyle == FlatStyle.System) { return(0); } else if ((flatStyle == FlatStyle.Flat) || (flatStyle == FlatStyle.Popup)) { return(-2); } else { Debug.Fail("Unknown FlatStyle"); return(0); //Unknown FlatStyle } } }
// Get the painter for a particular flat style. public static IThemePainter PainterForStyle(FlatStyle style) { if (style == FlatStyle.System) { return(SystemPainter); } else { return(MainPainter); } }
public void PaintRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, ElementState state, FlatStyle style, bool isChecked) { switch (style) { case FlatStyle.Standard: case FlatStyle.System: switch (state) { case ElementState.Normal: DrawNormalRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Hot: DrawHotRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Pressed: DrawPressedRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Disabled: DrawDisabledRadioButton (g, bounds, backColor, foreColor, isChecked); break; } break; case FlatStyle.Flat: switch (state) { case ElementState.Normal: DrawFlatNormalRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Hot: DrawFlatHotRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Pressed: DrawFlatPressedRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Disabled: DrawFlatDisabledRadioButton (g, bounds, backColor, foreColor, isChecked); break; } break; case FlatStyle.Popup: switch (state) { case ElementState.Normal: DrawPopupNormalRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Hot: DrawPopupHotRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Pressed: DrawPopupPressedRadioButton (g, bounds, backColor, foreColor, isChecked); break; case ElementState.Disabled: DrawPopupDisabledRadioButton (g, bounds, backColor, foreColor, isChecked); break; } break; } }
public void PaintCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, ElementState state, FlatStyle style, CheckState checkState) { switch (style) { case FlatStyle.Standard: case FlatStyle.System: switch (state) { case ElementState.Normal: DrawNormalCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Hot: DrawHotCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Pressed: DrawPressedCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Disabled: DrawDisabledCheckBox (g, bounds, backColor, foreColor, checkState); break; } break; case FlatStyle.Flat: switch (state) { case ElementState.Normal: DrawFlatNormalCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Hot: DrawFlatHotCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Pressed: DrawFlatPressedCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Disabled: DrawFlatDisabledCheckBox (g, bounds, backColor, foreColor, checkState); break; } break; case FlatStyle.Popup: switch (state) { case ElementState.Normal: DrawPopupNormalCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Hot: DrawPopupHotCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Pressed: DrawPopupPressedCheckBox (g, bounds, backColor, foreColor, checkState); break; case ElementState.Disabled: DrawPopupDisabledCheckBox (g, bounds, backColor, foreColor, checkState); break; } break; } }
// Get the painter for a particular flat style. public static IThemePainter PainterForStyle(FlatStyle style) { if(style == FlatStyle.System) { return SystemPainter; } else { return MainPainter; } }
public DataGridViewCheckBoxCell () { check_state = PushButtonState.Normal; editingCellFormattedValue = false; editingCellValueChanged = false; falseValue = null; flatStyle = FlatStyle.Standard; indeterminateValue = null; threeState = false; trueValue = null; ValueType = null; }
// Contructor. protected ButtonBase() { flatStyle = FlatStyle.Standard; imageAlign = ContentAlignment.MiddleCenter; imageIndex = -1; textAlign = ContentAlignment.MiddleCenter; prevState = (ButtonState)(-1); format = new StringFormat(); format.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show; SetStringFormat(); SetStyle(ControlStyles.ResizeRedraw, true); }
// Contructor. public Label() { SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.Selectable, false); this.useMnemonic = true; this.flatStyle = FlatStyle.Standard; this.alignment = ContentAlignment.TopLeft; this.preferredWidth = -1; TabStop = false; }
private FlatStyle _flatStyle; //按钮点击外观样式 #endregion public ButtonDUIStyle(XmlNode styleNode) :base(styleNode) { if (styleNode == null) { throw new Exception("传入了空的XmlNode对象,无法初始化LabelDUIStyle对象!"); } //读取基础属性 _fontName = XMLConfigReader.ReadString("fontName", styleNode.Attributes["fontName"]); _flatStyle = XMLConfigReader.ReadFlatStyle(styleNode.Name, "flatStyle", styleNode.Attributes["flatStyle"]); }
public DataGridViewComboBoxCell () : base() { autoComplete = true; dataSource = null; displayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton; displayStyleForCurrentCellOnly = false; dropDownWidth = 1; flatStyle = FlatStyle.Standard; items = new ObjectCollection(this); maxDropDownItems = 8; sorted = false; owningColumnTemlate = null; }
public DataGridViewCheckBoxCell() { check_state = PushButtonState.Normal; editingCellFormattedValue = false; editingCellValueChanged = false; falseValue = null; flatStyle = FlatStyle.Standard; indeterminateValue = null; threeState = false; trueValue = null; ValueType = null; }
public static void CreateButton(ref Button btn, string text, FlatStyle style, Rectangle location, btnAction action) { btn = new Button { Bounds = location, Text = text, FlatStyle = style, }; GameObject.GameToRun.Controls.Add(btn); btn.Click += (object sender, EventArgs e) => action(); }
private int CheckboxBaselineOffset(ContentAlignment alignment, FlatStyle flatStyle) { if ((alignment & DesignerUtils.anyMiddleAlignment) != ((ContentAlignment) 0)) { if ((flatStyle != FlatStyle.Standard) && (flatStyle != FlatStyle.System)) { return 0; } return -1; } if ((alignment & DesignerUtils.anyTopAlignment) != ((ContentAlignment) 0)) { if (flatStyle == FlatStyle.Standard) { return 1; } if (flatStyle == FlatStyle.System) { return 0; } if ((flatStyle != FlatStyle.Flat) && (flatStyle != FlatStyle.Popup)) { return 0; } return 2; } if (flatStyle == FlatStyle.Standard) { return -3; } if (flatStyle == FlatStyle.System) { return 0; } if ((flatStyle != FlatStyle.Flat) && (flatStyle != FlatStyle.Popup)) { return 0; } return -2; }
/* * GetPadding */ /// <summary> /// </summary> /// <param name="flatStyle"></param> /// <returns></returns> public Padding GetPadding(FlatStyle flatStyle) { switch (flatStyle) { case FlatStyle.Flat: case FlatStyle.Popup: { return _flatPadding; } case FlatStyle.Standard: case FlatStyle.System: { return _systemPadding; } } return _emptyPadding; }
public abstract void ComboBoxDrawBackground (ComboBox comboBox, Graphics g, Rectangle clippingArea, FlatStyle style);
public GroupBox () { TabStop = false; flat_style = FlatStyle.Standard; SetStyle(ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.Selectable, false); }
/// <summary> /// Draws a group box control /// </summary> public override void DrawGroupBox (Graphics graphics, Rectangle bounds, Color foreColor, Color backColor, Brush backgroundBrush, bool enabled, bool entered, FlatStyle style, String text, Font font, StringFormat format) { // revert to default theme if necessary if (!enableTheme || style != FlatStyle.System) { base.DrawGroupBox(graphics, bounds, foreColor, backColor, backgroundBrush, enabled, entered, style, text, font, format); return; } // draw the groupbox rectangle Theme.DrawControl(graphics, "Button", bounds.X, bounds.Y + 8, bounds.Width, bounds.Height - 8, (int)ButtonParts.BP_GROUPBOX, 1); // this is only temporary, // DrawThemeParentBackground should be used instead bounds.X += 8; bounds.Width -= 16; Size textSize = Size.Ceiling(graphics.MeasureString(text, font, bounds.Width, format)); Rectangle textbounds = new Rectangle(bounds.X - 2, bounds.Y, textSize.Width + 4, textSize.Height); graphics.FillRectangle(new SolidBrush(backColor), textbounds); graphics.DrawString(text, font, new SolidBrush(foreColor), (RectangleF)bounds, format); }
public override void ComboBoxDrawBackground (ComboBox comboBox, Graphics g, Rectangle clippingArea, FlatStyle style) { if (!RenderClientAreas || !ComboBoxShouldPaintBackground (comboBox)) { base.ComboBoxDrawBackground (comboBox, g, clippingArea, style); return; } VisualStyleElement element; if (!comboBox.Enabled) element = VisualStyleElement.ComboBox.Border.Disabled; else if (comboBox.Entered) element = VisualStyleElement.ComboBox.Border.Hot; else if (comboBox.Focused) element = VisualStyleElement.ComboBox.Border.Focused; else element = VisualStyleElement.ComboBox.Border.Normal; if (!VisualStyleRenderer.IsElementDefined (element)) { base.ComboBoxDrawBackground (comboBox, g, clippingArea, style); return; } new VisualStyleRenderer (element).DrawBackground (g, new Rectangle (Point.Empty, comboBox.Size), clippingArea); }
private static GroupBox MakeGroup (int x, int y, String text, FlatStyle style, Size buttonSize, String[] buttonStrings) { int bHeight = buttonSize.Height; int width = buttonSize.Width + 20; int height = ((bHeight+10)*buttonStrings.Length) + 40; GroupBox box = new GroupBox(); box.Size = new Size(width, height); box.Location = new Point(x, y); box.Text = text; box.FlatStyle = style; x += 10; y += 40; FlatStyle sNone = (FlatStyle)0; Appearance aNone = (Appearance)0; for(int i = 0; i < buttonStrings.Length; ++i) { box.Controls.Add(MakeButton(x, y, buttonSize, buttonStrings[i], sNone, false, aNone, false)); y += bHeight+10; } return box; }
//===================================================================== /// <summary> /// Constructor /// </summary> protected BaseListControl() { // Set the value of the double-buffering style bits to true this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true); this.UpdateStyles(); selectedIndex = -1; flatStyle = FlatStyle.Standard; enforceDefaultSelection = true; }
// Draw a group box. public virtual void DrawGroupBox (Graphics graphics, Rectangle bounds, Color foreColor, Color backColor, Brush backgroundBrush, bool enabled, bool entered, FlatStyle style, String text, Font font, StringFormat format) { int x = bounds.X; int y = bounds.Y; int width = bounds.Width; int height = bounds.Height; int textOffset = 8; bool flat = (style == FlatStyle.Flat) || (!entered && style == FlatStyle.Popup); bool rtl = (format.FormatFlags & StringFormatFlags.DirectionRightToLeft) != 0; // fill in the background graphics.FillRectangle(backgroundBrush, x, y, width, height); // prepare bounds for use as text border bounds.X = x + textOffset; bounds.Width = width - textOffset*2; // simplifies things if(text == null) { text = ""; } // measure text #if CONFIG_EXTENDED_NUMERICS Size textSize = Size.Ceiling(graphics.MeasureString(text, font, bounds.Width, format)); #else SizeF textSizeF = graphics.MeasureString(text, font, bounds.Width, format); Size textSize = new Size((int)(textSizeF.Width), (int)(textSizeF.Height)); #endif // draw text if(enabled) { using(Brush brush = new SolidBrush(foreColor)) { graphics.DrawString(text, font, brush, (RectangleF)bounds, format); } } else { DrawStringDisabled(graphics, text, font, backColor, (RectangleF)bounds, format); } // setup for drawing the box int left = x; int right = x + width - 1; int top = y + font.Height/2 - 1; int bottom = y + height - 1; int textLeft; int textRight; if(text == "") { textLeft = textRight = left; } else if(rtl) { textRight = right - textOffset + 1; textLeft = textRight - textSize.Width - 1; } else { textLeft = left + textOffset - 1; textRight = textLeft + textSize.Width + 1; } // draw the box if(flat) { Color color; if(enabled) { color = ControlPaint.Light(foreColor); } else { color = ControlPaint.LightLight(foreColor); } using(Pen pen = new Pen(color)) { // draw left side of box graphics.DrawLine(pen, left, top, left, bottom); ++left; // draw right side of box graphics.DrawLine(pen, right, top, right, bottom); --right; // draw bottom of box graphics.DrawLine(pen, left, bottom, right, bottom); // draw top of box, left of text graphics.DrawLine(pen, left, top, textLeft, top); // draw top of box, right of text graphics.DrawLine(pen, textRight, top, right, top); } } else { Pen dark; Pen light; // create pens for drawing the box if(enabled) { dark = new Pen(ControlPaint.DarkDark(backColor)); light = new Pen(ControlPaint.LightLight(backColor)); } else { dark = new Pen(ControlPaint.Dark(backColor)); light = new Pen(ControlPaint.Light(backColor)); } // draw left side of box graphics.DrawLine(dark, left, top, left, bottom); graphics.DrawLine(light, left+1, top+1, left+1, bottom-1); // draw right side of box graphics.DrawLine(dark, right-1, top+2, right-1, bottom-2); graphics.DrawLine(light, right, top+2, right, bottom-1); // draw bottom of box graphics.DrawLine(dark, left+2, bottom-1, right-1, bottom-1); graphics.DrawLine(light, left+1, bottom, right, bottom); // draw top of box, left of text graphics.DrawLine(dark, left+1, top, textLeft, top); graphics.DrawLine(light, left+2, top+1, textLeft, top+1); // draw top of box, right of text graphics.DrawLine(dark, textRight, top, right, top); graphics.DrawLine(light, textRight, top+1, right, top+1); // cleanup dark.Dispose(); light.Dispose(); } }
//*************************************************************************** // Static Methods // public static void SetAllFlatStyles(Control.ControlCollection controls, FlatStyle value) { foreach (Control cn in controls) { Type cnType = cn.GetType(); //System.Reflection.PropertyInfo pi = cnType.GetProperty("FlatStyle"); System.Reflection.MemberInfo[] pi = cnType.FindMembers(System.Reflection.MemberTypes.Property, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, System.Type.FilterNameIgnoreCase, "FlatStyle"); if (pi != null && pi.Length > 0) { if (cnType.FullName != "RainstormStudios.Controls.AdvancedButton") ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, value, null); else if (cnType.FullName == "RainstormStudios.Controls.AdvancedButton") { try { AdvancedButton.AdvButtonStyle btnStyle = (AdvancedButton.AdvButtonStyle)Enum.Parse(typeof(AdvancedButton.AdvButtonStyle), value.ToString()); ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, btnStyle, null); } finally { } } } if (cn.Controls.Count > 0) RsUserControlBase.SetAllFlatStyles(cn.Controls, value); } }
public override void ComboBoxDrawBackground (ComboBox comboBox, Graphics g, Rectangle clippingArea, FlatStyle style) { if (!comboBox.Enabled) g.FillRectangle (ResPool.GetSolidBrush (ColorControl), comboBox.ClientRectangle); if (comboBox.DropDownStyle == ComboBoxStyle.Simple) g.FillRectangle (ResPool.GetSolidBrush (comboBox.Parent.BackColor), comboBox.ClientRectangle); if (style == FlatStyle.Popup && (comboBox.Entered || comboBox.Focused)) { Rectangle area = comboBox.TextArea; area.Height -= 1; area.Width -= 1; g.DrawRectangle (ResPool.GetPen (SystemColors.ControlDark), area); g.DrawLine (ResPool.GetPen (SystemColors.ControlDark), comboBox.ButtonArea.X - 1, comboBox.ButtonArea.Top, comboBox.ButtonArea.X - 1, comboBox.ButtonArea.Bottom); } bool is_flat = style == FlatStyle.Flat || style == FlatStyle.Popup; if (!is_flat && clippingArea.IntersectsWith (comboBox.TextArea)) ControlPaint.DrawBorder3D (g, comboBox.TextArea, Border3DStyle.Sunken); }
private int RadiobuttonBaselineOffset(ContentAlignment alignment, FlatStyle flatStyle) { if ((alignment & DesignerUtils.anyMiddleAlignment) != ((ContentAlignment) 0)) { if (flatStyle == FlatStyle.System) { return -1; } return 0; } if (((flatStyle == FlatStyle.Standard) || (flatStyle == FlatStyle.Flat)) || (flatStyle == FlatStyle.Popup)) { if ((alignment & DesignerUtils.anyTopAlignment) == ((ContentAlignment) 0)) { return -2; } return 2; } if (flatStyle == FlatStyle.System) { return 0; } return 0; }
public ComboBox () { items = new ObjectCollection (this); DropDownStyle = ComboBoxStyle.DropDown; item_height = FontHeight + 2; background_color = ThemeEngine.Current.ColorWindow; border_style = BorderStyle.None; drop_down_height = default_drop_down_height; flat_style = FlatStyle.Standard; /* Events */ MouseDown += new MouseEventHandler (OnMouseDownCB); MouseUp += new MouseEventHandler (OnMouseUpCB); MouseMove += new MouseEventHandler (OnMouseMoveCB); MouseWheel += new MouseEventHandler (OnMouseWheelCB); MouseEnter += new EventHandler (OnMouseEnter); MouseLeave += new EventHandler (OnMouseLeave); KeyDown +=new KeyEventHandler(OnKeyDownCB); }
public DataGridViewButtonColumn () { base.CellTemplate = new DataGridViewButtonCell(); flatStyle = FlatStyle.Standard; text = String.Empty; }
private static RadioButton MakeButton (int x, int y, Size size, String text, FlatStyle style, bool setStyle, Appearance appearance, bool setAppearance) { RadioButton b = new RadioButton(); b.Location = new Point(x, y); b.Size = size; b.Text = text; if(setAppearance) { b.Appearance = appearance; } if(setStyle) { b.FlatStyle = style; } return b; }
/// <summary> /// </summary> /// <param name="flatStyle"></param> /// <returns></returns> public Padding GetPadding(FlatStyle flatStyle) { return _padding; }
private void CL_Draw_Button(Graphics dc, Rectangle buttonRectangle, FlatStyle flat_style, bool is_entered, bool is_enabled, bool is_pressed, Color first_gradient_color, Color second_gradient_color, bool paint_acceptbutton_black_border) { Rectangle lgbRectangle = new Rectangle (buttonRectangle.X + 3, buttonRectangle.Y + 3, is_pressed ? buttonRectangle.Width - 5 : buttonRectangle.Width - 6, buttonRectangle.Height - 6); if (flat_style != FlatStyle.Popup || ((flat_style == FlatStyle.Popup) && is_entered)) { LinearGradientBrush lgbr; if (flat_style == FlatStyle.Flat) { lgbr = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 3), new Point (buttonRectangle.X, buttonRectangle.Bottom - 3), second_gradient_color, first_gradient_color); } else { lgbr = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 3), new Point (buttonRectangle.X, buttonRectangle.Bottom - 3), first_gradient_color, second_gradient_color); } dc.FillRectangle (lgbr, lgbRectangle); lgbr.Dispose (); Point[] points_top = { new Point (buttonRectangle.X + 2, buttonRectangle.Y + 2), new Point (buttonRectangle.X + 3, buttonRectangle.Y + 1), new Point (buttonRectangle.Right - 4, buttonRectangle.Y + 1), new Point (buttonRectangle.Right - 3 , buttonRectangle.Y + 2) }; Point[] points_bottom = { new Point (buttonRectangle.X + 2, buttonRectangle.Bottom - 3), new Point (buttonRectangle.X + 3, buttonRectangle.Bottom - 2), new Point (buttonRectangle.Right - 4, buttonRectangle.Bottom - 2), new Point (buttonRectangle.Right - 3, buttonRectangle.Bottom - 3) }; Point[] points_top_outer = { new Point (buttonRectangle.X + 1, buttonRectangle.Y + 1), new Point (buttonRectangle.X + 2, buttonRectangle.Y), new Point (buttonRectangle.Right - 3, buttonRectangle.Y), new Point (buttonRectangle.Right - 2 , buttonRectangle.Y + 1) }; Point[] points_bottom_outer = { new Point (buttonRectangle.X + 1, buttonRectangle.Bottom - 2), new Point (buttonRectangle.X + 2, buttonRectangle.Bottom - 1), new Point (buttonRectangle.Right - 3, buttonRectangle.Bottom - 1), new Point (buttonRectangle.Right - 2, buttonRectangle.Bottom - 2) }; Pen pen = null; // normal border if (is_enabled) { Color top_color = Color.Black; Color bottom_color = Color.Black; if (!paint_acceptbutton_black_border) { top_color = is_pressed ? border_pressed_dark_color : border_normal_dark_color; bottom_color = is_pressed ? border_pressed_light_color : border_normal_light_color; } pen = ResPool.GetPen (top_color); dc.DrawLines (pen, points_top); pen = ResPool.GetPen (bottom_color); dc.DrawLines (pen, points_bottom); using (LinearGradientBrush lgbr2 = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 3), new Point (buttonRectangle.X, buttonRectangle.Bottom - 3), top_color, bottom_color)) { using (Pen lgbrpen = new Pen (lgbr2)) { dc.DrawLine (lgbrpen, buttonRectangle.X + 1, buttonRectangle.Y + 3, buttonRectangle.X + 1, buttonRectangle.Bottom - 3); dc.DrawLine (lgbrpen, buttonRectangle.Right - 2, buttonRectangle.Y + 3, buttonRectangle.Right - 2, buttonRectangle.Bottom - 3); } } } else { Point[] points_button_complete = { new Point (buttonRectangle.X + 1, buttonRectangle.Y + 3), new Point (buttonRectangle.X + 3, buttonRectangle.Y + 1), new Point (buttonRectangle.Right - 4, buttonRectangle.Y + 1), new Point (buttonRectangle.Right - 2, buttonRectangle.Y + 3), new Point (buttonRectangle.Right - 2, buttonRectangle.Bottom - 4), new Point (buttonRectangle.Right - 4, buttonRectangle.Bottom - 2), new Point (buttonRectangle.X + 3, buttonRectangle.Bottom - 2), new Point (buttonRectangle.X + 1, buttonRectangle.Bottom - 4), new Point (buttonRectangle.X + 1, buttonRectangle.Y + 3) }; pen = ResPool.GetPen (pressed_inner_border_dark_color); dc.DrawLines (pen, points_button_complete); } // outer border pen = ResPool.GetPen (button_outer_border_dark_color); dc.DrawLines (pen, points_top_outer); pen = ResPool.GetPen (button_outer_border_light_color); dc.DrawLines (pen, points_bottom_outer); using (LinearGradientBrush lgbr2 = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 2), new Point (buttonRectangle.X, buttonRectangle.Bottom - 1), button_outer_border_dark_color, button_outer_border_light_color)) { using (Pen lgbrpen = new Pen(lgbr2)) { dc.DrawLine (lgbrpen, buttonRectangle.X, buttonRectangle.Y + 2, buttonRectangle.X, buttonRectangle.Bottom - 3); dc.DrawLine (lgbrpen, buttonRectangle.Right - 1, buttonRectangle.Y + 2, buttonRectangle.Right - 1, buttonRectangle.Bottom - 3); } } // inner border pen = ResPool.GetPen (is_pressed ? pressed_inner_border_dark_color : inner_border_dark_color); if (!is_pressed) { dc.DrawLine (pen, buttonRectangle.Right - 3, buttonRectangle.Y + 3, buttonRectangle.Right - 3, buttonRectangle.Bottom - 4); } dc.DrawLine (pen, buttonRectangle.X + 3, buttonRectangle.Bottom - 3, buttonRectangle.Right - 4, buttonRectangle.Bottom - 3); pen = ResPool.GetPen (is_pressed ? pressed_inner_border_dark_color : Color.White); dc.DrawLine (pen, buttonRectangle.X + 2, buttonRectangle.Y + 3, buttonRectangle.X + 2, buttonRectangle.Bottom - 4); dc.DrawLine (pen, buttonRectangle.X + 3 , buttonRectangle.Y + 2, buttonRectangle.Right - 4, buttonRectangle.Y + 2); // edges pen = ResPool.GetPen (edge_top_inner_color); dc.DrawLine (pen, buttonRectangle.X + 1, buttonRectangle.Y + 2, buttonRectangle.X + 2, buttonRectangle.Y + 1); dc.DrawLine (pen, buttonRectangle.Right - 3, buttonRectangle.Y + 1, buttonRectangle.Right - 2, buttonRectangle.Y + 2); pen = ResPool.GetPen (button_edge_top_outer_color); dc.DrawLine (pen, buttonRectangle.X, buttonRectangle.Y + 1, buttonRectangle.X + 1, buttonRectangle.Y); dc.DrawLine (pen, buttonRectangle.Right - 2, buttonRectangle.Y, buttonRectangle.Right - 1, buttonRectangle.Y + 1); pen = ResPool.GetPen (edge_bottom_inner_color); dc.DrawLine (pen, buttonRectangle.X + 1, buttonRectangle.Bottom - 3, buttonRectangle.X + 2, buttonRectangle.Bottom - 2); dc.DrawLine (pen, buttonRectangle.Right - 2, buttonRectangle.Bottom - 3, buttonRectangle.Right - 3, buttonRectangle.Bottom - 2); pen = ResPool.GetPen (button_edge_bottom_outer_color); dc.DrawLine (pen, buttonRectangle.X, buttonRectangle.Bottom - 2, buttonRectangle.X + 1, buttonRectangle.Bottom - 1); dc.DrawLine (pen, buttonRectangle.Right - 1, buttonRectangle.Bottom - 2, buttonRectangle.Right - 2, buttonRectangle.Bottom - 1); } }
public Label () { // Defaults in the Spec autosize = false; TabStop = false; string_format = new StringFormat(); string_format.FormatFlags = StringFormatFlags.LineLimit; TextAlign = ContentAlignment.TopLeft; image = null; UseMnemonic = true; image_list = null; image_align = ContentAlignment.MiddleCenter; SetUseMnemonic (UseMnemonic); flat_style = FlatStyle.Standard; SetStyle (ControlStyles.Selectable, false); SetStyle (ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor #if NET_2_0 | ControlStyles.OptimizedDoubleBuffer #else | ControlStyles.DoubleBuffer #endif , true); HandleCreated += new EventHandler (OnHandleCreatedLB); }