EVC中CStatic显示BITMAP
来源:互联网 发布:对抗网络 编辑:程序博客网 时间:2024/05/23 11:33
我的解决方法:
CStatic* m_picture=(CStatic *)GetDlgItem(IDC_STATIC_TEST);
HBITMAP bitmap;
bitmap=(HBITMAP)::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_OFF));
m_picture->ModifyStyle(0,SS_BITMAP|SS_CENTERIMAGE);
m_picture->SetBitmap(bitmap);
一位好友的解决方法:
// EVC+CStatic+BITMAP
HBITMAP hbitmap = 0 ;
hbitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_TEST),IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR) ;
if (hbitmap)
{
m_ctrlStaticTest.SetBitmap(hbitmap) ; // m_ctrlStaticTest是CStatic的控制变量
}
datoucaicai 2008年07月20日 23点25分26秒 说:
假设CStatic控件ID为IDC_STATIC_TEST,属性Type为Bitmap,
m_ctrlStaticTest为CStatic控件关联的控制变量CStatic m_ctrlStaticTest ; //成员变量定义
DDX_Control(pDX, IDC_STATIC_TEST, m_ctrlStaticTest ); //变量关联
// 贴图代码
HBITMAP hbitmap = 0 ;
hbitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_TEST),IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR) ; //IDB_BITMAP_TEST 为位图ID
if (hbitmap)
{
m_ctrlStaticTest.SetBitmap(hbitmap) ; // m_ctrlStaticTest是CStatic的控制变量
}
// LoadImage中的0,0的意思,msdn解释如下:
cxDesired
[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
cyDesired
[in] Specifi
datoucaicai 2008年07月20日 23点26分00秒 说:
cxDesired
[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
cyDesired
[in] Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height.
datoucaicai 2008年07月20日 23点29分33秒 说:
// 如果这样还不行的话,那直接在CStatic的属性中Image选IDC_STATIC_TEST试试看能不能显示出图片来
CStatic* m_picture=(CStatic *)GetDlgItem(IDC_STATIC_TEST);
HBITMAP bitmap;
bitmap=(HBITMAP)::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_OFF));
m_picture->ModifyStyle(0,SS_BITMAP|SS_CENTERIMAGE);
m_picture->SetBitmap(bitmap);
一位好友的解决方法:
// EVC+CStatic+BITMAP
HBITMAP hbitmap = 0 ;
hbitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_TEST),IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR) ;
if (hbitmap)
{
m_ctrlStaticTest.SetBitmap(hbitmap) ; // m_ctrlStaticTest是CStatic的控制变量
}
datoucaicai 2008年07月20日 23点25分26秒 说:
假设CStatic控件ID为IDC_STATIC_TEST,属性Type为Bitmap,
m_ctrlStaticTest为CStatic控件关联的控制变量CStatic m_ctrlStaticTest ; //成员变量定义
DDX_Control(pDX, IDC_STATIC_TEST, m_ctrlStaticTest ); //变量关联
// 贴图代码
HBITMAP hbitmap = 0 ;
hbitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_TEST),IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR) ; //IDB_BITMAP_TEST 为位图ID
if (hbitmap)
{
m_ctrlStaticTest.SetBitmap(hbitmap) ; // m_ctrlStaticTest是CStatic的控制变量
}
// LoadImage中的0,0的意思,msdn解释如下:
cxDesired
[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
cyDesired
[in] Specifi
datoucaicai 2008年07月20日 23点26分00秒 说:
cxDesired
[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
cyDesired
[in] Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height.
datoucaicai 2008年07月20日 23点29分33秒 说:
// 如果这样还不行的话,那直接在CStatic的属性中Image选IDC_STATIC_TEST试试看能不能显示出图片来
- EVC中CStatic显示BITMAP
- 在CStatic中显示 数字
- evc 改变CStatic中的文字
- EVC中实现中文显示
- VS2005中CStatic控件显示背景图
- MFC在CStatic中显示图片
- ListView中显示bitmap
- 在CStatic静态文本框中,显示位图,控制位图大小
- VC6.0 在CStatic控件中显示指定图片
- 在CStatic静态文本框中,显示位图,控制位图大小
- CStatic显示bmp文件
- 【动态】CStatic显示图片
- evc中BMP文件的读取与显示资料集
- 在UI中显示Bitmap
- 在UI中显示Bitmap
- 在UI中显示Bitmap
- ListView中显示Bitmap图像
- 【VC】 CStatic 控件绘制BITMAP的方法。。
- 写有效率的SQL查询(III)
- 写有效率的SQL查询(IV)
- 复制构造函数的疑惑
- 写有效率的SQL查询(V)
- 写有效率的SQL查询(VI)
- EVC中CStatic显示BITMAP
- AES类使用方法(内函简单示例)
- 初学 Java 简单的一道题
- tracert用法
- 网站改造完了
- 使用Google Gears 心得
- 如何查看ubuntu的内核版本和发行版本号?
- 史玉柱大打怀旧牌 行业变动前夜抢占细分市场
- 微软"云计算"产品 Live Mesh 英文帐户已开放使用