CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] MFC Image control border

  1. #1
    Join Date
    May 2019

    [RESOLVED] MFC Image control border

    Hi there,

    I'm trying to draw whole images with GDI+ and set them to CStatic or CButton via HDC. I make this, so that the drawed image is scalable, when the parent dialog is resized. I have derived a class from CStatic and in the method where I draw the image, these are the final lines:

    CDC *df = this->GetDC();
    HDC dci = *df;
    CRect recToDraw;
    Gdiplus::Graphics ghc(dci);
    ghc.DrawImage(bitmap, Gdiplus::RectF(0, 0, recToDraw.Width(), recToDraw.Height()));
    This works fine, but around the controls on the dialog is still a border (see attached image, ignore the awful colors, they are for better contrast while still in development). I don't understand why it is there (window styles are disabled) and I hope, somebody got any trick for me to get rid of that border

    Name:  button.png
Views: 114
Size:  3.9 KB

  2. #2
    Join Date
    May 2019

    Re: [RESOLVED] MFC Image control border

    Seems like GDI+ does this border and there is no fault in CStatic. Modified the coordinates of drawing rectangle, so the "border" is outside of the control itself. Looks good.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)