我想要做的就是浏览bmp并在基于对话框的应用程序中显示它...如何? [英] All I want to do is browse for a bmp and display it scaled in a dialog based app....how?
问题描述
显然没有办法从文件中手动加载位图并将其缩放到静态控件中。
所有涉及createCompatibleDC(...)的建议只是不工作。
我试过让我的静态控件所有者绘制,创建一个自定义静态类来响应WM_DRAWITEM然后我在CStatic中获取ASSERT失败错误:: OnDrawItem(int nIDCtl,LPDRAWITEMSTRUCT lpDrawItemStruct)
显然我的DDX_Control(pDX,IDC_STATIC_BMP, m_staticBMP / * CBitmapCtrl * /)不起作用....为什么?
我选择的图像可能大于或小于staic控件的尺寸。 br />
您好,
选择文件,使用CFileDialog。要加载,缩放和显示图片,您可以使用CxImage类:
https:// www。 codeproject.com/Articles/1300/CxImage
Apparently there is no possible way to manually load the bitmap from a file and scale it into the static control.
All the suggestions involving createCompatibleDC(...) just don't work.
And I have tried making my static control owner draw, creates a custom static class that responds to WM_DRAWITEM but then I get a ASSERT failure error in CStatic:: OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
So apparently my DDX_Control(pDX, IDC_STATIC_BMP, m_staticBMP/*CBitmapCtrl*/) does not work....why?
The image I select may be larger or smaller than the dimensions of the staic control.
Hello,
to select a file, use CFileDialog. To load, scale and display the picture, you can use CxImage class: https://www.codeproject.com/Articles/1300/CxImage
这篇关于我想要做的就是浏览bmp并在基于对话框的应用程序中显示它...如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!