UpdateFont() private method

private UpdateFont ( ) : void
return void
Esempio n. 1
0
        private Size UpdatePromptSizing()
        {
            // Update size of the message label but with a maximum width
            using (Graphics g = CreateGraphics())
            {
                // Find size of the label when it has a maximum length of 250, this tells us the height
                // required to fully show the label with the prompt.
                _labelPrompt.UpdateFont();
                Size messageSize = g.MeasureString(_prompt, _labelPrompt.Font, 250).ToSize();

                // Work out DPI adjustment factor
                messageSize.Width  = (int)(messageSize.Width * DpiHelper.Default.DpiScaleFactor);
                messageSize.Height = (int)(messageSize.Height * DpiHelper.Default.DpiScaleFactor);

                _labelPrompt.Location = new Point(GAP, GAP);
                _labelPrompt.Size     = new Size(255, Math.Max(messageSize.Height, _buttonCancel.Bottom - _buttonOK.Top));

                return(new Size(_labelPrompt.Right, _labelPrompt.Bottom));
            }
        }