Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
762
UltraPictureBox client size?
posted

I have a panel with an UltraPictureBox in my WinForms application for annotating selections; when the user clicks an item I draw text or a picture to the box. This works great with pictures, but when I draw text it appears blurry with little jags in it. It looks like the text has been shrunken ever so slightly.

I am creating a Graphics canvas the size of the pictureBox content area to draw my text, how can this be a different size? The code is like:

Bitmap detailImage = new Bitmap(_ultraPictureBox.ClientSize.Width, _ultraPictureBox.ClientSize.Height);
using (Graphics g = Graphics.FromImage(detailImage))
{
    g.FillRectangle(Brushes.Grey, 0, 0, detailImage.Width, detailImage.Height);
    g.DrawString(annotation, _ultraPictureBox.Font, Brushes.Black, annotationPos);
}

The pictureBox is the same size as the ClientSize, and it has no padding, borders, or shadow.  Yet if I fill the detailImage above with a color, there is a thin white strip around my image inside the pictureBox. Where is this coming from and how do I get rid of it?

Parents
No Data
Reply
  • 37774
    posted

     I just tried this and it was working fine for me.  Do you get the same result in a new UltraPictureBox with the default properties?  Is there anything else that you're doing that could account for this?  Do you have the BorderStyle property set?  If you have something like one of the rounded styles, this would explain the excess padding.

    -Matt

Children