/// <summary> /// When the control is entered and get the focus, a textbox window control is added to the /// windows host control. /// </summary> public override void OnEnter(IHost host) { if (box == null) { box = new TextBox(); box.Font = Font; box.BorderStyle = BorderStyle.None; box.TextChanged += new EventHandler(box_TextChanged); box.KeyDown += new KeyEventHandler(box_KeyDown); box.KeyPress += new KeyPressEventHandler(box_KeyPress); box.GotFocus += new EventHandler(box_GotFocus); box.LostFocus += new EventHandler(box_LostFocus); box.BackColor = BackColor; } Rectangle r = HostBounds; r.Inflate((int)(3 * -ScaleFactor.Width), (int)-ScaleFactor.Height); box.Text = Text; int dy = (r.Height - box.Height) / 2; r.Y += dy; box.Bounds = r; host.AddControl(box); box.Focus(); Invalidate(); base.OnEnter(host); }
/// <summary> /// When the control is entered and get the focus, a textbox window control is added to the /// windows host control. /// </summary> public override void OnEnter(IHost host) { if (box == null) { box = new TextBox(); box.Font = Font; box.BorderStyle = BorderStyle.None; box.TextChanged += new EventHandler(box_TextChanged); box.KeyDown += new KeyEventHandler(box_KeyDown); box.KeyPress += new KeyPressEventHandler(box_KeyPress); box.GotFocus += new EventHandler(box_GotFocus); box.LostFocus += new EventHandler(box_LostFocus); box.BackColor = BackColor; } Rectangle r = HostBounds; r.Inflate((int)(3 * -ScaleFactor.Width), (int)-ScaleFactor.Height); box.Text = Text; int dy = (r.Height - box.Height) / 2; r.Y += dy; box.Bounds = r; host.AddControl(box); box.Focus(); Invalidate(); base.OnEnter(host); }