Thread: GDI+ and dilaogs

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    2

    GDI+ and dilaogs

    Hello all,

    I was trying to use GDI+ in the WM_INITDIALOG in a win32 dll project. I wanted to display an image on the dialog using GDI+ before it was diplayed. Nothing appeared...
    this is a small portion of code which i added to the WM_INITDIALOG.

    Graphics g(GetDC(hDlg));
    Image im("pic.png");
    g.DrawImage(&im,100,100,im.getWidth(),im.getHeight ());

    I also tried adding it in WM_PAINT .

    and nothing appears , can anyone help me thnx. By the way the png file is found and i think the drawing functions are correct because they draw the png but not in WM_INITDIALOG nor in WM_PAINT . But maybe i have to put the code in another place for it to work.

    Thnx in andvance..

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Your drawing should usually be done in response to a WM_PAINT event - could you post the exact code for your WM_PAINT handler?
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    2
    Graphics g(GetDC(hDlg));
    Image im(L"pic.png");
    g.DrawImage(&im,100,100,im.GetWidth(),im.GetHeight ());

    This is what im doing in paint, but i think i found out why it was not entering into the WM_PAINT message. I had an AnimateWindow() call in the WM_INITDIALOG message, i think this was preventing it from entering paint the first time. When i removed it it worked.

Popular pages Recent additions subscribe to a feed