Example #1
0
        public NodeTypeEditor()
        {
            InitializeComponent();

            using (Graphics g = CreateGraphics())
            {
                var textSize = g.MeasureString(TEXT, Font);
                m_textHeight = textSize.Height;
                m_textWidth  = textSize.Width;
            }

            m_textBox = new MyTextBox(drawWindow1, TextBoxArea, MyTextBox.InputFormEnum.Text);
            m_textBox.Colors.BorderPen      = Colors.ControlBorder;
            m_textBox.RequestedAreaChanged += () =>
            {
                Size        = m_textBox.RequestedArea.ToSize();
                MinimumSize = new Size(0, Size.Height);
            };

            m_comboBox = new MyComboBox <Guid>(drawWindow1, ComboBoxArea, false);
            m_comboBox.SetupCallbacks();
            m_comboBox.RequestedAreaChanged += () =>
            {
                MinimumSize = new Size(0, (int)m_comboBox.RequestedArea.Height);
                Size        = m_comboBox.RequestedArea.ToSize();
                Refresh();
            };
            m_comboBox.Colors.BorderPen = Colors.ControlBorder;
            m_comboBox.Renderer         = Colors.ContextMenu;

            drawWindow1.MouseDown  += (a, args) => m_textBox.MouseDown(args);
            drawWindow1.MouseUp    += (a, args) => m_textBox.MouseUp(args);
            drawWindow1.MouseMove  += (a, args) => m_textBox.MouseMove(args);
            drawWindow1.MouseClick += (a, args) => m_textBox.MouseClick(args);
            drawWindow1.KeyPress   += (a, args) => m_textBox.KeyPress(args);
            drawWindow1.KeyDown    += (a, args) => m_textBox.KeyDown(args);
            drawWindow1.Paint      += (a, args) => m_textBox.Paint(args.Graphics);
            drawWindow1.GotFocus   += (a, args) => m_textBox.GotFocus();
            drawWindow1.LostFocus  += (a, args) => m_textBox.LostFocus();

            drawWindow1.MouseDown  += (a, args) => m_comboBox.MouseDown(args);
            drawWindow1.MouseUp    += (a, args) => m_comboBox.MouseUp(args);
            drawWindow1.MouseMove  += (a, args) => m_comboBox.MouseMove(args);
            drawWindow1.MouseClick += (a, args) => m_comboBox.MouseClick(args);
            drawWindow1.KeyPress   += (a, args) => m_comboBox.KeyPress(args);
            drawWindow1.KeyDown    += (a, args) => m_comboBox.KeyDown(args);
            drawWindow1.Paint      += (a, args) => m_comboBox.Paint(args.Graphics);
            drawWindow1.GotFocus   += (a, args) => m_comboBox.GotFocus();
            drawWindow1.LostFocus  += (a, args) => m_comboBox.LostFocus();
        }
        public MyLocalizedStringEditor()
        {
            InitializeComponent();

            m_textBox        = new MyTextBox(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height));
            m_textBox.Colors = new MyTextBox.ColorOptions();
            m_textBox.RequestedAreaChanged += () => this.Size = m_textBox.RequestedArea.ToSize();
            m_textBox.Text = "Test String";

            drawWindow1.MouseDown  += (a, args) => m_textBox.MouseDown(args);
            drawWindow1.MouseUp    += (a, args) => m_textBox.MouseUp(args);
            drawWindow1.MouseMove  += (a, args) => m_textBox.MouseMove(args);
            drawWindow1.MouseClick += (a, args) => m_textBox.MouseClick(args);
            drawWindow1.KeyPress   += (a, args) => m_textBox.KeyPress(args);
            drawWindow1.KeyDown    += (a, args) => m_textBox.KeyDown(args);
            drawWindow1.Paint      += (a, args) => m_textBox.Draw(args.Graphics);
            drawWindow1.GotFocus   += (a, args) => m_textBox.GotFocus();
            drawWindow1.LostFocus  += (a, args) => m_textBox.LostFocus();
        }