Exemplo n.º 1
0
        private void drawingPanel_MouseClick(object sender, MouseEventArgs e)
        {
            if (selectionMode == Mode.TextBox)
            {
                FlexibleTextBoxControl textbox = new FlexibleTextBoxControl();
                textbox.Location = e.Location;
                drawingPanel.Controls.Add(textbox);

                // Return to Select Mode
                SetSelectionMode();
            }
        }
Exemplo n.º 2
0
        private void drawingPanel_DragDrop(object sender, DragEventArgs e)
        {
            // Literally means, If we dragged from propertiesListBox on top right of form
            if (e.Data.GetData(e.Data.GetFormats()[0]) is string)
            {
                var selectedListItem = e.Data.GetData(typeof(string)).ToString();

                #region Old method - no resize
                // TextBox txt = new TextBox();
                // txt.Width = 370;
                // txt.Height = 30;
                // txt.ReadOnly = true;
                // txt.Text = selectedListItem;
                // var locationOnForm = drawingPanel.PointToClient(new Point(e.X, e.Y));

                // if (locationOnForm.X + txt.Width > drawingPanel.Width)
                //     locationOnForm.X = drawingPanel.Width - txt.Width;

                // if (locationOnForm.Y + txt.Height > drawingPanel.Height)
                //     locationOnForm.Y = drawingPanel.Height - txt.Height;

                // if (locationOnForm.X < 0)
                //     locationOnForm.X = 0;

                // if (locationOnForm.Y < 0)
                //     locationOnForm.Y = 0;

                // var x = locationOnForm.X / 8 * 8;
                // var y = locationOnForm.Y / 8 * 8;

                // var snappedLocation = new Point(x, y);

                // txt.Location = snappedLocation;

                // txt.Parent = drawingPanel;

                // txt.MouseDown += c_MouseDown;
                // txt.KeyPress += t_KeyPress;
                // txt.KeyDown += t_KeyDown;
                #endregion

                FlexibleTextBoxControl txt = new FlexibleTextBoxControl();
                txt.ReadOnly = true;
                txt.Text     = selectedListItem;
                txt.Parent   = drawingPanel;

                // Add newly generated textbox to this panel
                drawingPanel.Controls.Add(txt);
                // then remove this label from our list box
                RemoveAndRebindPropertiesListBoxDataGrid(selectedListItem);
            }
        }
Exemplo n.º 3
0
        /// <summary> If Mode is TextBox Mode, insert new FlexibleTextBox at click point
        /// </summary>
        /// <param name="sender"> Control</param>
        /// <param name="e"> Event Info </param>
        private void Pad_MouseClick(object sender, MouseEventArgs e)
        {
            if (Mode == Mode.TextBox)
            {
                FlexibleTextBoxControl textbox = new FlexibleTextBoxControl();
                textbox.Location = e.Location;
                Pad.Controls.Add(textbox);

                // Return to Select Mode
                btnSelectMode.PerformClick();
                btnSelectMode.Select();
            }
        }