Esempio n. 1
0
        internal void ChangeZoomOnButtonClick(decimal v)
        {
            // this sentinel flag is not useful because inside the ToolStripTrackBarItem
            // a ChangeByUser flag is used
            //ZoomManagedByButtonsOrImport = true;

            decimal newFactor = RoundZoomFactor(tstb.Value / 100M) + v;
            if (ZoomPercentIsValid((int)(newFactor * 100)))
            {
                tstb.SyncSetValue((int)(newFactor * 100));
                //if (tstb.Value != (int)(newFactor * 100))
                //{
                //    EventHandler evt = delegate (object sender, EventArgs e)
                //    {
                //        ZoomManagedByButtonsOrImport = false;
                //    };
                //    tstb.Scroll += evt;
                //    tstb.Value = (int)(newFactor * 100);
                //    tstb.Scroll -= evt;
                //}

                SuspendLayoutIfPossible();

                ZoomPercentChanged?.Invoke(this, EventArgs.Empty);
                ValuePropagationRequested?.Invoke(this, EventArgs.Empty);
                SettingUpdateRequested?.Invoke(this, EventArgs.Empty);

                ResumeLayoutIfPossible();
            }

            //ZoomManagedByButtonsOrImport = false;
        }
Esempio n. 2
0
        private void Tstb_Scroll(object sender, EventArgs e)
        {
            //if (!ZoomManagedByButtonsOrImport)
            //{
                SuspendLayoutIfPossible();

                ZoomPercentChanged?.Invoke(this, EventArgs.Empty);
                ValuePropagationRequested?.Invoke(this, EventArgs.Empty);
                SettingUpdateRequested?.Invoke(this, EventArgs.Empty);

                tscb.Text = $"{Convert.ToInt32(tstb.Value)}%";

                ResumeLayoutIfPossible();
            //}
        }