private CaptionGradient FromString(object value) { string[] result = ((string)value).Split(','); if (result.Length != 8) throw new ArgumentException("Could not convert to value"); try { CaptionGradient gradient = new CaptionGradient(); // Retrieve the colors ColorConverter converter = new ColorConverter(); gradient.ActiveCaptionColorStart = (Color)converter.ConvertFromString(result[0]); gradient.ActiveCaptionColorEnd = (Color)converter.ConvertFromString(result[1]); gradient.InactiveCaptionColorStart = (Color)converter.ConvertFromString(result[2]); gradient.InactiveCaptionColorEnd = (Color)converter.ConvertFromString(result[3]); gradient.CaptionGradientStyle = (LinearGradientMode)Enum.Parse(typeof(LinearGradientMode), result[4], true); gradient.InactiveCaptionTextColor = (Color)converter.ConvertFromString(result[5]); gradient.ActiveCaptionTextColor = (Color)converter.ConvertFromString(result[6]); gradient.ActiveCaptionFontStyle = (FontStyle)Enum.Parse(typeof(FontStyle), result[7], true); return gradient; } catch (Exception) { throw new ArgumentException("Could not convert to value"); } }
private UpDown32Style _upDownStyle = UpDown32Style.Default; //Initializer #endregion Fields #region Constructors public KrbTabControl() { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.ResizeRedraw | ControlStyles.UserMouse, true); Size = new Size //Object Initializer { Width = 300, Height = 200 }; ItemSize = new Size { Width = 0, Height = 26 }; _tabGradient = new GradientTab(Color.White, Color.Gainsboro, LinearGradientMode.Horizontal, Color.Black, Color.Black, FontStyle.Regular); //Instantiate _tabGradient.GradientChanged += CONTROL_INVALIDATE_UPDATE; _hatcher = new Hatcher(Color.White, Color.Gainsboro, HatchStyle.DashedVertical); _hatcher.HatchChanged += CONTROL_INVALIDATE_UPDATE; _gradientCaption = new CaptionGradient(); _gradientCaption.GradientChanged += CONTROL_INVALIDATE_UPDATE; _captionButtons = new ButtonsCaption(); _captionButtons.ButtonsColorChanged += CONTROL_INVALIDATE_UPDATE; _captionRandomizer = new RandomizerCaption(); _captionRandomizer.CaptionRandomizerChanged += CONTROL_INVALIDATE_UPDATE; AllowDrop = true; // For drag and drop tab pages.You can change this from control's property. }