コード例 #1
0
        /// <summary>
        /// Clicked on zoom button in status bar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        internal void ZoomButtonItem_ItemClick(object sender, ItemClickEventArgs e)
        {
            int pct;

            Query q = QueriesControl.BaseQuery;

            if (q == null)
            {
                return;
            }

            string txt = ZoomPctBarItem.Caption;

            txt = txt.Replace("%", "");
            if (Lex.IsInteger(txt))
            {
                pct = int.Parse(txt);
            }
            else
            {
                pct = q.ViewScale;              // use existing query value if above fails
            }
            DialogResult dr = ZoomDialog.Show(ref pct, new Point(), QueryManager);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            ZoomSliderPct = pct;             // update zoom control display

            if (QueryManager == null || Qrc == null)
            {
                return;
            }

            Qrc.CurrentView.ScaleView(pct);

            return;
        }
コード例 #2
0
/// <summary>
/// Clicked zoom button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void ShowZoomDialog()
        {
            int pct;

            Query q = QueriesControl.BaseQuery;

            if (q == null)
            {
                return;
            }

            string txt = ZoomPctTextEdit.Text;

            txt = txt.Replace("%", "");
            if (Lex.IsInteger(txt))
            {
                pct = int.Parse(txt);
            }
            else
            {
                pct = q.ViewScale;              // use existing query value if above fails
            }
            Point p = new Point(ZoomPctTextEdit.Left, ZoomPctTextEdit.Bottom);

            p = ZoomPctTextEdit.PointToScreen(p);
            DialogResult dr = ZoomDialog.Show(ref pct, p, null);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            ZoomPct = pct;             // update zoom control display

            return;
        }
コード例 #3
0
/// <summary>
/// Show the dialog
/// </summary>

        public static DialogResult Show(
            ref int pct,
            Point location,
            QueryManager qm)
        {
            if (Instance == null)
            {
                Instance = new ZoomDialog();
            }
            ZoomDialog i = Instance;

            i.Qm = qm;

            if (pct == 800)
            {
                i.Zoom800.Checked = true;
            }
            else if (pct == 400)
            {
                i.Zoom400.Checked = true;
            }
            else if (pct == 200)
            {
                i.Zoom200.Checked = true;
            }
            else if (pct == 100)
            {
                i.Zoom100.Checked = true;
            }
            else if (pct == 75)
            {
                i.Zoom75.Checked = true;
            }
            else if (pct == 50)
            {
                i.Zoom50.Checked = true;
            }
            else if (pct == 25)
            {
                i.Zoom25.Checked = true;
            }
            else
            {
                i.ZoomCustom.Checked = true;
            }

            i.ZoomCustomSpinEdit.Text = pct.ToString();

            i.ZoomFitToWidth.Enabled = (i.Qrc != null);

            if (!location.IsEmpty)
            {
                i.StartPosition = FormStartPosition.Manual;
                i.Location      = location;
            }
            else
            {
                i.StartPosition = FormStartPosition.CenterScreen;
            }

            DialogResult dr = i.ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.OK)
            {
                pct = i.Pct;                                    // return new percentage
            }
            return(dr);
        }