3

I am trying to make a program where an image would disappear when a certain a button called hide in the application is pressed.

I know in Windows form application it would be something like this:

    pictureBox1->Visible=true/false;

But that code wouldn't work in MFC

My code in MFC is

     Cstatic pictureBox1 =(Cstatic)Getdialogitem(IDC_IMAGE1);
     pictureBox1->Visible=false; 
Andrey Belykh
  • 2,578
  • 4
  • 32
  • 46

1 Answers1

8

Try

pictureBox1->ShowWindow(SW_HIDE);

or

pictureBox1->ShowWindow(SW_SHOW);

In MFC, simply setting a member variable to a new value doesn't accomplish anything; you need to call functions that will take specific actions.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622