private UpDown32Style _upDownStyle = UpDown32Style.Default; //Initializer #endregion Fields #region Constructors public KRBTabControl() { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.ResizeRedraw | ControlStyles.UserMouse, true); this.Size = new Size() //Object Initializer { Width = 300, Height = 200 }; this.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 += new EventHandler(CONTROL_INVALIDATE_UPDATE); _hatcher = new Hatcher(Color.White, Color.Gainsboro, HatchStyle.DashedVertical); _hatcher.HatchChanged += new EventHandler(CONTROL_INVALIDATE_UPDATE); _gradientCaption = new CaptionGradient(); _gradientCaption.GradientChanged += new EventHandler(CONTROL_INVALIDATE_UPDATE); _captionButtons = new ButtonsCaption(); _captionButtons.ButtonsColorChanged += new EventHandler(CONTROL_INVALIDATE_UPDATE); _captionRandomizer = new RandomizerCaption(); _captionRandomizer.CaptionRandomizerChanged += new EventHandler(CONTROL_INVALIDATE_UPDATE); this.AllowDrop = true; // For drag and drop tab pages.You can change this from control's property. }
private RandomizerCaption FromString(object value) { string[] result = ((string)value).Split(','); if (result.Length != 6) throw new ArgumentException("Could not convert to value"); try { RandomizerCaption randomizer = new RandomizerCaption(); ByteConverter byteConverter = new ByteConverter(); BooleanConverter booleanConverter = new BooleanConverter(); // Retrieve the values of the object. randomizer.Red = (byte)byteConverter.ConvertFromString(result[0]); randomizer.Green = (byte)byteConverter.ConvertFromString(result[1]); randomizer.Blue = (byte)byteConverter.ConvertFromString(result[2]); randomizer.Transparency = (byte)byteConverter.ConvertFromString(result[3]); randomizer.IsRandomizerEnabled = (bool)booleanConverter.ConvertFromString(result[4]); randomizer.IsTransparencyEnabled = (bool)booleanConverter.ConvertFromString(result[5]); return randomizer; } catch (Exception) { throw new ArgumentException("Could not convert to value"); } }