public EnumerationTypeEditor() { InitializeComponent(); using (Graphics g = CreateGraphics()) { var textSize = g.MeasureString(TEXT, Font); m_textHeight = textSize.Height; m_textWidth = textSize.Width; } m_name = new MyTextBox(drawWindow1, NameArea, MyTextBox.InputFormEnum.Text); m_name.Colors.BorderPen = Colors.ControlBorder; m_default = new MyComboBox <Or <string, Guid> >(drawWindow1, DefaultArea, true); m_default.Colors.BorderPen = Colors.ControlBorder; m_default.Renderer = Colors.ContextMenu; drawWindow1.MouseDown += (a, args) => drawWindow1.Focus(); //TODO: is this redundant? drawWindow1.Paint += (a, args) => Paint(args.Graphics); drawWindow1.GotFocus += (a, b) => { forwardTab.TabStop = false; backwardTab.TabStop = false; }; forwardTab.GotFocus += (a, b) => { MyControls.ForwardFocus(); drawWindow1.Focus(); }; //Focus draw window so we dont keep giving focus to forwardTab backwardTab.GotFocus += (a, b) => { MyControls.BackwardFocus(); drawWindow1.Focus(); }; //Focus draw window so we dont keep giving focus to backwardTab this.Leave += (a, b) => { forwardTab.TabStop = true; backwardTab.TabStop = true; }; forwardTab.Size = Size.Empty; forwardTab.Location = new Point(-1, -1); backwardTab.Size = Size.Empty; backwardTab.Location = new Point(-1, -1); MyControls = new ControlSet(m_name, m_default, m_values); MyControls.RegisterCallbacks(drawWindow1); MyControls.RequestedAreaChanged += ResetSize; ResetSize(); this.PaddingChanged += (a, b) => ResetSize(); }