Пример #1
0
 private void SetButtonText()
 {
     button1.Text =
         "Form.FormBoderStyle = " + FormBorderStyle.ToString() + "\n" +
         "Form.Size = " + Size.ToString() + "\n" +
         "Form.ClientSize = " + ClientSize.ToString();
 }
Пример #2
0
        /// <summary>
        /// Rescales.  Only used for dpiAware=true/pm.
        /// </summary>
        private void rescale()
        {
#if doLogging
            logger.log("rescale prevDpi=" + previousDpi
                       + " curDpi=" + currentDpi);
            logger.logControls("rescale (Before) ClientSize=" + ClientSize.ToString());
#endif
            if (previousDpi == 0 || currentDpi == 0)
            {
                return;
            }
            if (initialFont != null)
            {
                float size = initialFont.SizeInPoints * currentDpi / initialDpi;
                Font = new Font(initialFont.Name, size);
            }
            float scale = currentDpi / previousDpi;
#if false
            // Doesn't work
            Scale(new SizeF(scale, scale));
#elif false
            // Doesn't work similar to above
            int width  = (int)Math.Round(ClientSize.Width * currentDpi / previousDpi);
            int height = (int)Math.Round(ClientSize.Height * currentDpi / previousDpi);
#elif true
            int width  = (int)Math.Round(initialSize.Width * currentDpi / initialDpi);
            int height = (int)Math.Round(initialSize.Height * currentDpi / initialDpi);
            ClientSize = new Size(width, height);
#endif
#if doLogging
            logger.logControls("rescale (After) ClientSize=" + ClientSize.ToString());
#endif
        }
Пример #3
0
        /// <summary>
        /// Client size changed
        /// </summary>
        /// <param name="e">event args</param>
        protected override void OnClientSizeChanged(EventArgs e)
        {
            base.OnClientSizeChanged(e);
            if (_firstClientChangedCall)
            {
                _designTimeAspectRatio = (float)ClientSize.Height / ClientSize.Width;

                Log.Debug("HIHIHI ClientSize: " + ClientSize.ToString());
                _firstClientChangedCall = false;
            }
        }