public MaterialSingleLineTextField() { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); animationManager = new AnimationManager() { Increment = 0.06, AnimationType = AnimationType.EaseInOut, InterruptAnimation = false }; animationManager.OnAnimationProgress += sender => Invalidate(); baseTextBox = new BaseTextBox { BorderStyle = BorderStyle.None, Font = SkinManager.ROBOTO_REGULAR_11, ForeColor = SkinManager.GetMainTextColor(), Location = new Point(0, 0), Width = Width, Height = Height - 5, }; if (!Controls.Contains(baseTextBox) && !DesignMode) { Controls.Add(baseTextBox); } baseTextBox.GotFocus += (sender, args) => animationManager.StartNewAnimation(AnimationDirection.In); baseTextBox.LostFocus += (sender, args) => animationManager.StartNewAnimation(AnimationDirection.Out); BackColorChanged += (sender, args) => { baseTextBox.BackColor = BackColor; baseTextBox.ForeColor = SkinManager.GetMainTextColor(); }; }
public MaterialSingleLineTextField() { AnimationManager.AnimationProgress progress = null; EventHandler handler = null; EventHandler handler2 = null; EventHandler handler3 = null; base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); AnimationManager manager = new AnimationManager(true) { Increment = 0.06, AnimationType = AnimationType.EaseInOut, InterruptAnimation = false }; this.animationManager = manager; if (progress == null) { progress = sender => base.Invalidate(); } this.animationManager.OnAnimationProgress += progress; BaseTextBox box = new BaseTextBox { BorderStyle = BorderStyle.None, Font = this.SkinManager.ROBOTO_REGULAR_11, ForeColor = this.SkinManager.GetMainTextColor(), Location = new Point(0, 0), Width = base.Width, Height = base.Height - 5 }; this.baseTextBox = box; if (!(base.Controls.Contains(this.baseTextBox) || base.DesignMode)) { base.Controls.Add(this.baseTextBox); } if (handler == null) { handler = (sender, args) => this.animationManager.StartNewAnimation(AnimationDirection.In, null); } this.baseTextBox.GotFocus += handler; if (handler2 == null) { handler2 = (sender, args) => this.animationManager.StartNewAnimation(AnimationDirection.Out, null); } this.baseTextBox.LostFocus += handler2; if (handler3 == null) { handler3 = delegate(object sender, EventArgs args) { this.baseTextBox.BackColor = this.BackColor; this.baseTextBox.ForeColor = this.SkinManager.GetMainTextColor(); }; } base.BackColorChanged += handler3; }
public MaterialSingleLineTextField() { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.SupportsTransparentBackColor, false); animationManager = new AnimationManager { Increment = 0.06, AnimationType = AnimationType.EaseInOut, InterruptAnimation = false }; animationManager.OnAnimationProgress += sender => Invalidate(); baseTextBox = new BaseTextBox { BorderStyle = BorderStyle.None, Font = MaterialSkinManager.ROBOTO_REGULAR_11, ForeColor = MaterialSkinManager.GetPrimaryTextColor(), Location = new Point(0, 0), Width = Width, Height = Height - 5 }; if (!Controls.Contains(baseTextBox) && !DesignMode) { Controls.Add(baseTextBox); } baseTextBox.GotFocus += (sender, args) => animationManager.StartNewAnimation(AnimationDirection.In); baseTextBox.LostFocus += (sender, args) => animationManager.StartNewAnimation(AnimationDirection.Out); baseTextBox.KeyDown += (sender, args) => _baseKeyDown(args); baseTextBox.KeyUp += (sender, args) => _baseKeyUp(args); baseTextBox.KeyPress += (sender, args) => _baseKeyPress(args); BackColorChanged += (sender, args) => { baseTextBox.BackColor = BackColor; baseTextBox.ForeColor = MaterialSkinManager.GetPrimaryTextColor(); }; //Fix for tabstop baseTextBox.TabStop = true; this.TabStop = false; }
public MaterialSingleLineTextField() { base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer, true); this._animationManager = new AnimationManager(true) { Increment = 0.06, AnimationType = AnimationType.EaseInOut, InterruptAnimation = false }; this._animationManager.OnAnimationProgress += delegate { base.Invalidate(); }; this._baseTextBox = new BaseTextBox { BorderStyle = BorderStyle.None, Font = this.SkinManager.ROBOTO_REGULAR_11, ForeColor = this.SkinManager.GetPrimaryTextColor(), Location = new Point(0, 0), Width = base.Width, Height = base.Height - 5 }; if (!base.Controls.Contains(this._baseTextBox) && !base.DesignMode) { base.Controls.Add(this._baseTextBox); } this._baseTextBox.GotFocus += delegate { this._animationManager.StartNewAnimation(AnimationDirection.In, null); }; this._baseTextBox.LostFocus += delegate { this._animationManager.StartNewAnimation(AnimationDirection.Out, null); }; base.BackColorChanged += delegate { this._baseTextBox.BackColor = this.BackColor; this._baseTextBox.ForeColor = this.SkinManager.GetPrimaryTextColor(); }; this._baseTextBox.TabStop = true; base.TabStop = false; }
public MaterialSingleLineTextField() { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); _animationManager = new AnimationManager { Increment = 0.06, AnimationType = AnimationType.EaseInOut, InterruptAnimation = false }; _animationManager.OnAnimationProgress += sender => Invalidate(); _baseTextBox = new BaseTextBox { BorderStyle = BorderStyle.None, Font = SkinManager.TEXT_FONT, ForeColor = SkinManager.GetPrimaryTextColor(), Location = new Point(0, 0), Width = Width, Height = Height - 5 }; if (!Controls.Contains(_baseTextBox) && !DesignMode) { Controls.Add(_baseTextBox); } _baseTextBox.GotFocus += (sender, args) => _animationManager.StartNewAnimation(AnimationDirection.In); _baseTextBox.LostFocus += (sender, args) => _animationManager.StartNewAnimation(AnimationDirection.Out); BackColorChanged += (sender, args) => { _baseTextBox.BackColor = BackColor; _baseTextBox.ForeColor = SkinManager.GetPrimaryTextColor(); }; //Fix for tabstop _baseTextBox.TabStop = true; this.TabStop = false; }