如何从vc ++ 2008对话框中隐藏图像. [英] how to hide the image from the dialog vc++ 2008.

查看:115
本文介绍了如何从vc ++ 2008对话框中隐藏图像.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好..
MFC 2008中如何在if-else条件下隐藏和显示图像

解决方案

嘿,根据我的理解,您想在单击按钮时隐藏和显示图像.
所以下面的代码只是建议
在对话框.h文件中定义CPitureEx的对象.
像下面一样,

CPictureEx m_piture;



在对话框的OnInitDialog()中,只需提供以下代码行

if (m_Picture.Load(MAKEINTRESOURCE(IDR_FELIX),_T("GIF")))
m_Picture.Draw();   ///you can provide bitmap ID If you want draw bitmap


单击"HideShow()"按钮时不可以

HideShow()
{
  if(m_Picture.IsWindowVisible())
  {
      m_Picture.ShowWindow(0);
   }
   else
   {
    m_Picture.ShowWindow(1);
   } 
}


有关更多信息,您可能会看到此示例
支付图片 [ ^ ]


如果您谈论的是标题栏中的图标,则可以执行以下操作:

显示图标:

//get the main application icon for example
HICON m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
//set big icon
SetIcon(m_hIcon, TRUE);
//set small icon
SetIcon(m_hIcon, FALSE);



隐藏图标:

//set big icon
SetIcon(NULL, TRUE);
//set small icon
SetIcon(NULL, FALSE);


不,我只在对话框中显示图像.此后,我想在单击按钮时隐藏. blockquote>

hello..
how to hide and show the image with in if-else condition im MFC 2008

解决方案

Hey What i understand according to this you want hide and show image on button click.
so following code is just suggestion
define object of CPitureEx in your dialog .h file.
like following,

CPictureEx m_piture;



in OnInitDialog() of you dialog just provide this lines of codes

if (m_Picture.Load(MAKEINTRESOURCE(IDR_FELIX),_T("GIF")))
m_Picture.Draw();   ///you can provide bitmap ID If you want draw bitmap


No on click of your HideShow() button

HideShow()
{
  if(m_Picture.IsWindowVisible())
  {
      m_Picture.ShowWindow(0);
   }
   else
   {
    m_Picture.ShowWindow(1);
   } 
}


For more information you may see this example
Dispaying Image[^]


If you are talking about the icon in the title bar, then you can do something like that:

To show the icon:

//get the main application icon for example
HICON m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
//set big icon
SetIcon(m_hIcon, TRUE);
//set small icon
SetIcon(m_hIcon, FALSE);



To hide the icon:

//set big icon
SetIcon(NULL, TRUE);
//set small icon
SetIcon(NULL, FALSE);


No,i just show the image in dialog box..after that i want to hide when we click on the button..vis versa i want to show..


这篇关于如何从vc ++ 2008对话框中隐藏图像.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆