예제 #1
0
        private static Rectangle CreateGlyphButtonTextRectangle(Control control, Size glyphSize)
        {
            //Spacing between the edge of the glyph and the outer edge of the check area.
            //1px padding + 1px for the glyph border.
            const int GLYPH_ADDITIONNAL_SPACE = 2;
            //Some mysterious spacing on the left and right sides of the text.
            const int TEXT_LATTERAL_PADDING = 1;

            Rectangle contentRect   = LayoutAndPaintUtils.InflateRectangle(control.ClientRectangle, control.Padding);
            Size      checkAreaSize = new Size(glyphSize.Width + GLYPH_ADDITIONNAL_SPACE, glyphSize.Height + GLYPH_ADDITIONNAL_SPACE);
            Point     textRectLocation;

            if (control.RightToLeft != RightToLeft.Yes)
            {
                textRectLocation = new Point(contentRect.X + checkAreaSize.Width + TEXT_LATTERAL_PADDING, contentRect.Y);
            }
            else
            {
                textRectLocation = new Point(contentRect.X + TEXT_LATTERAL_PADDING);
            }
            Size      textRectSize = new Size(contentRect.Width - checkAreaSize.Width - 2 * TEXT_LATTERAL_PADDING, contentRect.Height);
            Rectangle textRect     = new Rectangle(textRectLocation, textRectSize);

            return(textRect);
        }
예제 #2
0
        private static Rectangle CreateGlyphButtonTextRectangle(Control control, Size glyphSize)
        {
            //Spacing between the edge of the glyph and the outer edge of the check area.
            //1px padding + 1px for the glyph border.
            const int glyphAdditionnalSpace = 2;
            //Some mysterious spacing on the left and right sides of the text.
            const int textLatteralPadding = 1;

            Rectangle contentRect      = LayoutAndPaintUtils.InflateRectangle(control.ClientRectangle, control.Padding);
            Size      checkAreaSize    = new Size(glyphSize.Width + glyphAdditionnalSpace, glyphSize.Height + glyphAdditionnalSpace);
            var       textRectLocation =
                control.RightToLeft != RightToLeft.Yes ?
                new Point(contentRect.X + checkAreaSize.Width + textLatteralPadding, contentRect.Y) :
                new Point(contentRect.X + textLatteralPadding);
            Size      textRectSize = new Size(contentRect.Width - checkAreaSize.Width - 2 * textLatteralPadding, contentRect.Height);
            Rectangle textRect     = new Rectangle(textRectLocation, textRectSize);

            return(textRect);
        }
예제 #3
0
 private static Rectangle CreatePushButtonTextRectangle(Control control)
 {
     return(LayoutAndPaintUtils.InflateRectangle(control.ClientRectangle, control.Padding));
 }