Beispiel #1
0
        /// <summary></summary>
        private void hideTextBox()
        {
            if (registerTextBox != null)
            {
                registerLabel.Show();

                if (string.IsNullOrEmpty(registerTextBox.Text))
                {
                    clearRegister();
                }
                else
                {
                    int registerValue;

                    try
                    {
                        registerValue = int.Parse(registerTextBox.Text);
                    }
                    catch (FormatException)
                    {
                        registerTextBox.Text = string.Empty;
                        registerValue        = 0;
                    }

                    if (registerValue >= MapInfo.Range.X && registerValue <= MapInfo.Range.Y)
                    {
                        registerLabel.Text = registerTextBox.Text;
                        registerLabel.SetControlsStyle(ControlsStyle.LabelNormal);
                    }
                    else
                    {
                        ShowMessage(string.Format("Допустимый диапазон значений:\r\n{0}-{1}",
                                                  MapInfo.Range.X,
                                                  MapInfo.Range.Y));
                    }
                }

                MainProcess.RemoveControl((Control)registerTextBox.GetControl());
                registerTextBox = null;
            }
        }
Beispiel #2
0
        public override void OnHotKey(KeyAction TypeOfAction)
        {
            switch (TypeOfAction)
            {
            case KeyAction.F9:

                if (CurrentControl != null)
                {
                    ShowMessage(string.Format("Left = {0}\r\nTop = {1}\r\nWidth = {2}\r\nHeight = {3}", CurrentControl.Left, CurrentControl.Top, CurrentControl.Width, CurrentControl.Height));
                }
                break;

            case KeyAction.F8:

                if (CurrentControl != null)
                {
                    Control cont = CurrentControl;
                    MainProcess.SelectNextControl(ref CurrentControl);
                    CurrentControl.Paint    += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject);
                    ControlColor             = CurrentControl.BackColor;
                    CurrentControl.BackColor = System.Drawing.Color.Red;
                    CurrentControl.Refresh();

                    MainProcess.RemoveControl(cont);
                }
                break;

            case KeyAction.F10:

                MainProcess.CreateLabel("label", 5, 70, 100, ControlsStyle.LabelNormal);
                if (CurrentControl == null)
                {
                    MainProcess.SelectNextControl(ref CurrentControl);
                    CurrentControl.Paint    += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject);
                    ControlColor             = CurrentControl.BackColor;
                    CurrentControl.BackColor = System.Drawing.Color.Red;
                    CurrentControl.Refresh();
                }
                break;

            case KeyAction.Complate:

                MainProcess.CreateTextBox(5, 100, 150, "ñreateTextBox", ControlsStyle.TextBoxNormal);
                if (CurrentControl == null)
                {
                    MainProcess.SelectNextControl(ref CurrentControl);
                    CurrentControl.Paint    += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject);
                    ControlColor             = CurrentControl.BackColor;
                    CurrentControl.BackColor = System.Drawing.Color.Red;
                    CurrentControl.Refresh();
                }
                break;

            case KeyAction.F12:

                var t = MainProcess.CreateTable("WareList", 30);
                if (CurrentControl == null)
                {
                    MainProcess.SelectNextControl(ref CurrentControl);
                    CurrentControl.Paint    += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject);
                    ControlColor             = CurrentControl.BackColor;
                    CurrentControl.BackColor = System.Drawing.Color.Red;
                    CurrentControl.Refresh();
                }
                t.Show();
                break;

            case KeyAction.F5:

                if (CurrentControl != null)
                {
                    CurrentControl.BackColor = ControlColor;
                    CurrentControl.Paint    -= new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject);
                }

                MainProcess.SelectNextControl(ref CurrentControl);
                CurrentControl.Paint    += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject);
                ControlColor             = CurrentControl.BackColor;
                CurrentControl.BackColor = System.Drawing.Color.Red;
                CurrentControl.Refresh();
                break;

            case KeyAction.Recount:

                MoveObjectsState = !MoveObjectsState;
                break;

            case KeyAction.UpKey:

                if (CurrentControl == null)
                {
                    break;
                }

                if (MoveObjectsState)
                {
                    CurrentControl.Top--;
                }
                else
                {
                    CurrentControl.Height--;
                }
                break;

            case KeyAction.DownKey:

                if (CurrentControl == null)
                {
                    break;
                }
                if (MoveObjectsState)
                {
                    CurrentControl.Top++;
                }
                else
                {
                    CurrentControl.Height++;
                }
                break;

            case KeyAction.LeftKey:

                if (CurrentControl == null)
                {
                    break;
                }

                if (MoveObjectsState)
                {
                    CurrentControl.Left--;
                }
                else
                {
                    CurrentControl.Width--;
                }
                break;

            case KeyAction.RightKey:

                if (CurrentControl == null)
                {
                    break;
                }
                if (MoveObjectsState)
                {
                    CurrentControl.Left++;
                }
                else
                {
                    CurrentControl.Width++;
                }
                break;
            }
        }