如何使用 MFC 应用程序 (C++ Visual Studio 2010) 中的按钮更改图像的可见属性?
我正在尝试制作一个程序,当按下应用程序中某个名为“隐藏”的按钮时,图像就会消失。
我知道在 Windows 窗体应用程序中它会是这样的:
pictureBox1->Visible=true/false;
但是该代码在 MFC 中不起作用
我在 MFC 中的代码是
Cstatic pictureBox1 =(Cstatic)Getdialogitem(IDC_IMAGE1);
pictureBox1->Visible=false;
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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
或
在 MFC 中,简单地将成员变量设置为新值并不能完成任何操作;您需要调用将执行特定操作的函数。
Try
or
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.