Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

redrawing an image??

Posted on 1998-11-21
10
202 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 52
sumNumber challenge 16 138
ffmpeg - "rtsp://...... Operation not permitted" 4 86
matchUp  challenge 6 69
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

860 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