Exemple #1
0
 /// <summary>
 /// Dá focus do daného buttonu
 /// </summary>
 /// <param name="button"></param>
 protected void SetFocusTo(WinButtonBase button)
 {
     if (button != null && button.Visible)
     {
         button.Focus();
     }
 }
Exemple #2
0
        /// <summary>
        /// Zajistí zobrazení jednoho buttonu
        /// </summary>
        /// <param name="button"></param>
        /// <param name="buttons"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="spaceBefore"></param>
        /// <param name="buttonWidth"></param>
        /// <param name="spaceWidth"></param>
        private void _ShowButton(WinButtonBase button, GUI.GuiDialogButtons buttons, ref float x, float y, float buttonWidth, float spaceBefore, float spaceWidth)
        {
            GUI.GuiDialogButtons buttonValue = (button.Tag is GUI.GuiDialogButtons ? (GUI.GuiDialogButtons)button.Tag : GUI.GuiDialogButtons.None);
            bool isVisible = ((buttons & buttonValue) != 0);

            button.Visible = isVisible;
            if (isVisible)
            {
                x += spaceBefore;
                int ix = (int)Math.Round(x, 0);
                int iy = (int)Math.Round(y, 0);
                int iw = (int)Math.Round(buttonWidth, 0);
                button.Bounds = new Rectangle(ix, iy, iw, ButtonItemHeight);
                x             = x + buttonWidth + spaceWidth;
            }
        }
Exemple #3
0
        /// <summary>
        /// Vytvoří Button z daných dat, přidá jej do ButtonPanel.Controls a vrátí jej
        /// </summary>
        /// <param name="value"></param>
        /// <param name="image"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        private WinButtonBase _PrepareButton(GUI.GuiDialogButtons value, string image, string text)
        {
            WinButtonBase button = new WinButtonBase()
            {
                Size    = new Size(110, 32),
                Text    = text,
                Image   = Application.App.ResourcesApp.GetImage(image),
                Visible = false,
                Tag     = value
            };

            button.Click    += _Button_Click;
            button.GotFocus += _Button_GotFocus;
            this.ButtonsPanel.Controls.Add(button);
            this._WinButtonList.Add(button);
            return(button);
        }
Exemple #4
0
        /// <summary>
        /// Handler události Button.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _Button_Click(object sender, EventArgs e)
        {
            WinButtonBase button = sender as WinButtonBase;

            if (button == null)
            {
                return;
            }
            if (!(button.Tag is GUI.GuiDialogButtons))
            {
                return;
            }

            GUI.GuiDialogButtons result = (GUI.GuiDialogButtons)button.Tag;
            this._CallButtonClick(result);

            if (this.CloseOnClick)
            {
                this._GuiResult = result;
                this.Close();
            }
        }