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

Thread: Picture Control Using [URGENT]

  1. #1
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Exclamation Picture Control Usage [URGENT]

    How can i do review a picture which already save in the resource ID by using "picture" control and how can i do to change the any picture easly? that is picture1, and picture2... I want to show them by using picture control. On the Dialog Based Application?
    Last edited by Hakan Bulut; December 27th, 2007 at 05:38 AM.

  2. #2
    Join Date
    May 2006
    Location
    Norway
    Posts
    1,709

    Re: Picture Control Using [URGENT]

    1) Rename your picture control to something else than IDC_STATIC

    2) Create a member variable of the control (of control type). For instance m_picture

    3) In your dialogs header file, declare the CBitmaps you need:
    Code:
    private:
     CBitmap Bmp1, Bmp2;
    4) In your dialogs OnInitDialog, load the bitmaps
    Code:
    Bmp1.LoadBitmap(IDB_BITMAP1);
     Bmp2.LoadBitmap(IDB_BITMAP2);
    5) Whenever you want to change the bitmap.
    Code:
    m_picture.SetBitmap(Bmp2); // or Bmp1

    Laitinen

  3. #3
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Re: Picture Control Using [URGENT]

    Thank you. but it does not work..

    I has been tried to this:
    Code:
     
    HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), 
    						MAKEINTRESOURCE(IDB_BITMAP2),
    						IMAGE_BITMAP, 
    						0,0, 
    						LR_LOADMAP3DCOLORS);
     
    CStatic* pSt = (CStatic*) GetDlgItem(IDC_STATIC);
    pSt->SetBitmap(hBmp);
    pSt->UpdateWindow();
    pSt->InvalidateRect(NULL);
    But it does not work too.
    Last edited by Hakan Bulut; December 27th, 2007 at 05:04 AM.

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)