图片控制对象 [英] picture control object

查看:87
本文介绍了图片控制对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个带有图片控件的对话框应用程序.现在我想创建一个图片控件对象.要做到这一点,哪个类应该是该对象的基类.请帮助我...请帮助...

吉耶什.

预先谢谢您.

hi all,
i have one dialog application with a picture control.now i want to create an object of picture control.to do this,which class should be the base class for that object.please help me...please help...

Jijesh.

thank you in advance

推荐答案

没有与图片控制相关的特定类.通常将其视为静态控件.您可以创建CStaic对象,并将图片控件映射到该对象.如果需要进行某种定制,则可以从CStatic中拥有自己的类派生.
在指定您要实际使用图片控件执行的操作时,可以给出进一步的解决方案
There is no specfic class related to picture control. It normally treated like a static control.you can create an object of CStaic and map your picture control to this object. If you need to do some kind of customization you can have your own class dervide from CStatic.
further solutions can be given on specifying that what you are actually trying to do with your picture control


根据建议,您可以使用CStatic类.
您必须:
As suggested, you may use a the CStatic class.
You have to:
  • Load the bitmap from file, using the LoadImage[^] function.
  • Call the CStatic::SetBitmap[^] method.


如果您尝试使用位图,以下代码可能会起作用
if you are trying to use a bitmap.following code may work
CBitmap* pBitmap;
 pBitmap=new CBitmap();
 pBitmap->LoadBitmap(IDB_BITMAP1);
 CDC* pDC = m_PicCtrl.GetDC();
 CRect rect;
 m_PicCtrl.GetClientRect(rect);
 CDC dc;
 dc.CreateCompatibleDC(pDC);
 dc.SelectObject(pBitmap);
 pDC->BitBlt (0, 0, rect.Width(),rect.Height(), &dc,0, 0, SRCCOPY);
 delete pBitmap;
 pBitmap = 0;


使用StretchBlt()代替BitBlt()来调整图片的大小,具体取决于图片控件的大小


use StretchBlt() instead of BitBlt() to adjust the size of image depending on the size of your picture control


这篇关于图片控制对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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