如何将图像添加到我的GUI应用程序 [英] How to add Image to my GUI application

查看:88
本文介绍了如何将图像添加到我的GUI应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我在Visual Studio 2005(c ++)中开发了一个基于MFC/GUI的应用程序.我需要在我的应用程序中添加一个徽标或图像.请让我知道一些教程或网站来检查此问题. >解决方案

我们过去在MDI应用程序中做的在主框架背景的背景上绘制公司徽标的方法是创建一个简单的CWnd派生类并重写用OnEraseBkgnd(CDC * pDC)方法绘制素材.

我们将该类链接到当前主机框架类的方式:

  class  CMainFrame: public  CMDIFrameWndEx
{
///  ...
 CMDIClient m_MDIClient; //  CMDIClient可以在应用程序背景上绘制.
///  ...
} 



  int  CMainFrame :: OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//  ...很多代码... 

// 安装此主框架的视图.
VERIFY(m_MDIClient.mbSubclassWindow( this ));

//  ...很多代码... 
} 



如我所写,绘图是在CMDIClient :: OnEraseBkgnd()方法中完成的.
如果您正在基于对话框的应用程序,那么您应该能够从上面的内容中适应(或获得灵感).


这应该可以帮助您入门.

祝你好运.


您想在哪里添加徽标?

作为启动画面?在关于"框中?作为标题栏中的图标?其他地方
?




如果您要更改GUI应用程序图标,请在这里回答

更改MFC应用程序和对话框的ICON [ ^ ]

Hi guys,
I developed one MFC/GUI based application in visual studio 2005(c++) . I need to add one logo or image to my application.Pls let me know some tutorial or site to check for this ....pls Help me it is some what urgent ..Thanks in advance''

解决方案

What we used to do for a MDI application to draw our company logo on the background of the main frame background, was to create a simple CWnd derived class and override the OnEraseBkgnd(CDC* pDC) method to draw our stuff.

The way we link that class to the current main frame class :

class CMainFrame : public CMDIFrameWndEx
{
///  ...
  CMDIClient m_MDIClient; // CMDIClient is there to draw on the Application background.
/// ...
}



int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// ... lot of code...

	// Install the view of this main frame.
	VERIFY( m_MDIClient.mbSubclassWindow(this) );

// ... lot of code...
}



As I wrote, the drawing is done in the CMDIClient::OnEraseBkgnd() method.

If you are doing a dialog based application, you should be able to adapt (or get inspiration) from the above.


THis should get you started.

Good luck.


Where do you want to add your logo ?

As a splash screen ? in the about box ? as icons in the title bar ? somewhere else
?


Hi,

If your requirement is to change the GUI application ICON, here is you answer

Change ICON of MFC Application and Dialog[^]


这篇关于如何将图像添加到我的GUI应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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