/// <summary> /// Initializes a new instance of the Panel class. /// </summary> public Panel() : base() { this.Style = PanelStyle.Custom; KryptonManager.GlobalPaletteChanged += new EventHandler(KryptonManager_GlobalPaletteChanged); _borderColor = KryptonHelper.GetBorderColor(); }
/// <summary> /// Sets the background colour. /// </summary> private void SetBackgroundColour() { if (Style == PanelStyle.Custom) { base.BackColor = _backColor; } else { base.BackColor = KryptonHelper.GetPanelColor(Style); } Invalidate(); }
/// <summary> /// Sets the background colour. /// </summary> private void SetBackgroundColour() { if (this.Style == PanelStyle.Custom) { base.BackColor = _backColor; return; } else { base.BackColor = KryptonHelper.GetPanelColor(this.Style); } }
/// <summary> /// Gets the forecolor of the text. /// </summary> /// <returns>The fore color</returns> private Color GetForeColor() { if (this.Style == TitleStyle.Custom) { return(_foreColor); } var palette = KryptonHelper.GetCurrentPalette(); var headingColor = Color.Black; var subheadingColor = Color.Black; if (palette == PaletteMode.Office2007Black || palette == PaletteMode.Office2007Blue || palette == PaletteMode.Office2007Silver) { headingColor = KryptonManager.GetPaletteForMode(palette).GetContentShortTextColor1(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); subheadingColor = KryptonManager.GetPaletteForMode(palette).GetContentShortTextColor1(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); } else if (palette == PaletteMode.ProfessionalOffice2003 || palette == PaletteMode.ProfessionalSystem) { headingColor = SystemColors.ControlText; subheadingColor = SystemColors.ControlText; } else if (palette == PaletteMode.SparkleBlue || palette == PaletteMode.SparkleOrange || palette == PaletteMode.SparklePurple) { headingColor = Color.White; subheadingColor = Color.White; } else if (palette == PaletteMode.Office2010Black || palette == PaletteMode.Office2010Blue || palette == PaletteMode.Office2010Silver) { headingColor = KryptonManager.GetPaletteForMode(palette).GetContentShortTextColor1(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); subheadingColor = KryptonManager.GetPaletteForMode(palette).GetContentShortTextColor1(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); } if (this.Style == TitleStyle.Subheading) { return(subheadingColor); } else if (this.Style == TitleStyle.Heading) { return(headingColor); } return(_foreColor); }
/// <summary> /// Sets the state of the control based on the current theme. /// </summary> private void SetThemeState() { if (DesignMode) { return; } var palette = KryptonHelper.GetCurrentPalette(); base.TrackProgressColor = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.ButtonStandalone, PaletteState.Pressed); base.TrackBorderColor = KryptonHelper.GetBorderColor(); base.ButtonBorderColor = KryptonHelper.GetBorderColor(); SetBackgroundColour(); Invalidate(); }
private void SetThemeColors() { var palette = KryptonHelper.GetCurrentPalette(); if (palette == PaletteMode.SparkleBlue || palette == PaletteMode.SparkleOrange || palette == PaletteMode.SparklePurple) { _lightColor = SystemColors.ControlDark; _darkColor = Color.FromArgb(24, 32, 48); } else { _lightColor = KryptonManager.GetPaletteForMode(palette).GetBackColor2(PaletteBackStyle.TabCustom3, PaletteState.Normal); _darkColor = SystemColors.ControlDark; } this.Invalidate(); }
/// <summary> /// Sets the state of the control based on the current theme. /// </summary> private void SetThemeState() { if (DesignMode) { return; } var palette = KryptonHelper.GetCurrentPalette(); var color = KryptonManager.GetPaletteForMode(palette) .GetBackColor2(PaletteBackStyle.PanelAlternate, PaletteState.Normal); BackColor = color; pnlSlider.BackColor = color; pnlVolume.BackColor = color; slider.BackColor = color; sldVolume.BackColor = color; _volumeColor1 = KryptonManager.GetPaletteForMode(palette) .GetBackColor1(PaletteBackStyle.ButtonStandalone, PaletteState.Pressed); _volumeColor2 = KryptonManager.GetPaletteForMode(palette) .GetBackColor2(PaletteBackStyle.ButtonStandalone, PaletteState.Pressed); }
/// <summary> /// Determines whether this combobox is valid, based on the IsRequired field and the Text value /// </summary> /// <returns>Returns true if the combobox is valid</returns> public bool IsValid() { var isValid = true; if (this.IsRequired && this.Text == "") { // if required and no value, is not valid isValid = false; } else if (this.MinLength > 0 && this.Text.Length < this.MinLength) { // text is not long enough isValid = false; } else if (this.EntryType == TextEntryType.Integer) { // if not valid int, or less than minvalue, // or more than maxvalue, is not valid var intValue = 0; var validInt = int.TryParse(this.Text, out intValue); if (!validInt || intValue < this.MinimumValue || intValue > this.MaximumValue) { isValid = false; if (this.Text == "" && !this.IsRequired) { isValid = true; } } } // validate the contents of the combobox using the regular expression provided if (this.RegularExpression != string.Empty) { var regex = new Regex(this.RegularExpression); isValid = regex.IsMatch(this.Text); } // if control is valid so far, raise custom validate event if (CustomValidate != null && isValid) { var cancelEventArgs = new CancelEventArgs(false); CustomValidate(this, cancelEventArgs); isValid = !cancelEventArgs.Cancel; } if (isValid) { if (this.ErrorProvider != null) { this.ErrorProvider.SetError(this, ""); } this.StateCommon.ComboBox.Back.Color1 = this.StateActive.ComboBox.Back.Color1; } else { SetError(this.ErrorMessage); this.StateCommon.ComboBox.Back.Color1 = KryptonHelper.GetErrorBackgroundColor(); } return(isValid); }
/// <summary> /// Sets the background colour. /// </summary> private void SetForeColor() { if (this.Style == LabelStyle.Custom) { base.ForeColor = _foreColor; return; } var palette = KryptonHelper.GetCurrentPalette(); var textColor = Color.Black; var captionColor = Color.Black; var headingColor = Color.Black; if (palette == PaletteMode.Office2007Black || palette == PaletteMode.Office2007Blue || palette == PaletteMode.Office2007Silver) { textColor = Color.FromArgb(64, 64, 64); captionColor = KryptonManager.GetPaletteForMode(palette).GetContentShortTextColor1(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); //headingColor = KryptonManager.GetPaletteForMode(palette).GetContentShortTextColor1(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); headingColor = Color.Black; } else if (palette == PaletteMode.ProfessionalOffice2003 || palette == PaletteMode.ProfessionalSystem) { textColor = SystemColors.ControlText; captionColor = SystemColors.ControlText; headingColor = SystemColors.ControlText; } else if (palette == PaletteMode.SparkleBlue || palette == PaletteMode.SparkleOrange || palette == PaletteMode.SparklePurple) { textColor = Color.White; captionColor = Color.White; headingColor = Color.White; } else if (palette == PaletteMode.Office2010Black || palette == PaletteMode.Office2010Blue || palette == PaletteMode.Office2010Silver) { textColor = Color.FromArgb(64, 64, 64); if (palette == PaletteMode.Office2010Black) { textColor = Color.White; } captionColor = KryptonManager.GetPaletteForMode(palette).GetContentShortTextColor1(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); headingColor = headingColor = Color.Black; } if (this.Style == LabelStyle.Text) { base.ForeColor = textColor; } else if (this.Style == LabelStyle.Caption) { base.ForeColor = captionColor; } else if (this.Style == LabelStyle.Heading) { base.ForeColor = headingColor; } }
/// <summary> /// Handles the GlobalPaletteChanged event of the KryptonManager control. /// </summary> private void KryptonManager_GlobalPaletteChanged(object sender, EventArgs e) { _borderColor = KryptonHelper.GetBorderColor(); SetBackgroundColour(); }