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();
        }
Example #2
0
 public void StartRenaming(int cursorPos, Control control)
 {
     if (m_textBox == null)
     {
         var area     = m_area();
         var indent   = CalculateIndent(area);
         var textArea = CalculateTextArea(area, indent);
         m_textBox      = new MyTextBox(control, () => new RectangleF(textArea.Location.Plus(ToControlTransform().OffsetX, ToControlTransform().OffsetY), textArea.Size), MyTextBox.InputFormEnum.FileName, null, x => new SimpleTextBoxBorderDrawer(x), 4, Fonts.Default);
         m_textBox.Text = PermanentText;
         m_textBox.SetCursorPosition(cursorPos);
         m_textBox.Colors.Background = Color.Transparent;
         m_textBox.Colors.BorderPen  = Pens.Transparent;
         MyTextBox.SetupCallbacks(control, m_textBox);
         m_textBox.GotFocus();
     }
 }
        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();
        }