Solved

redrawing an image??

Posted on 1998-11-21
10
194 Views
Last Modified: 2013-11-20
I have an image which is put in a static control after a button is pressed. When I re-size the application window the image disappears.

What can I do to stop this from happening??
0
Comment
Question by:ross_nolan
  • 4
  • 2
  • 2
  • +2
10 Comments
 

Expert Comment

by:wyhjin
ID: 1325101
Please add the image to that static control again in the on-paint messge handler.
0
 

Author Comment

by:ross_nolan
ID: 1325102
I have already tried calling the buttons click method from the on_paint method, but kept getting an assertion error!!

Any ideas??
0
 
LVL 12

Expert Comment

by:migel
ID: 1325103
You can manually update static window by InvalidateRect and UpdateWindow functions
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 2

Expert Comment

by:wyy_cq
ID: 1325104
CStatic can be the bitmap container.
when you create the static control you need to set the SS_BITMAP flag .
and you need to load a bitmap and call CStatic::SetBitmap(...)

the code:
CBitmap bm;
bm.LoadBitmap(...);
static.SetBitmap(bm.Detach());

0
 

Author Comment

by:ross_nolan
ID: 1325105
Sorry but I tried the followinf code and it didn't work:

if (doc->desk != NULL)
{
  CBitmap bm;
  CStatic* box = (CStatic*)CDesktopView::GetDlgItem
    (IDC_PIC2_STATIC);
  bm.LoadBitmap(IDC_PIC2_STATIC);
  box->SetBitmap((HBITMAP )bm.operator HBITMAP());
}

Any ideas???
0
 
LVL 12

Expert Comment

by:migel
ID: 1325106
Can you check position of the static control? May be with main window resizing  static has been moved outside parent client area?
0
 
LVL 3

Accepted Solution

by:
plaroche earned 70 total points
ID: 1325107
Your code doesn't work because your bitmap goes away. Try this:

if (doc->desk != NULL)
{
  CBitmap bm;
  CStatic* box = (CStatic*)CDesktopView::GetDlgItem
    (IDC_PIC2_STATIC);
  bm.LoadBitmap(IDC_PIC2_STATIC);
  box->SetBitmap(bm.Detach());
}

0
 

Author Comment

by:ross_nolan
ID: 1325108
Sorry I get this error message when I put in the bm.Detach() method in the SetBitmap method as a parameter:

'SetBitmap' : cannot convert parameter 1 from 'void *' to 'struct HBITMAP__ *'

Any ideas????
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1325109
Cast the return value of Detach() with a HBITMAP....
0
 

Author Comment

by:ross_nolan
ID: 1325110
I tried adding in the return value of HBITMAP to the Detach() method but there was no difference

Please help!!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 32
Named range not carried over 10 63
matchUp  challenge 6 62
wordcount challenge 11 121
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question