首页 > 代码库 > MFC Picture控件加载图片
MFC Picture控件加载图片
CStatic *pPic = (CStatic*)GetDlgItem(IDC_PICTURE); CBitmap bitmap; bitmap.LoadBitmapW(IDB_BITMAP2); pPic->SetBitmap((HBITMAP)bitmap.GetSafeHandle());
//在Picture的Type调为Bitmap
像素修改:
CStatic *pPic = (CStatic*)GetDlgItem(IDC_PICTURE); CBitmap bitmap; bitmap.LoadBitmapW(IDB_BITMAP2); BITMAP mBitmap; bitmap.GetBitmap(&mBitmap); HBITMAP hBitmap = (HBITMAP)bitmap.GetSafeHandle(); CImage image; image.Attach(hBitmap); int mWidth = image.GetWidth(); int mHeight = image.GetHeight(); _cprintf("width = %d\nheight = %d\n", image.GetWidth(), image.GetHeight()); for (int i = 0; i < mWidth; i++) { for (int j = 0; j < mHeight; j++) { if (i>=10&&i<=30) image.SetPixel(i, j, RGB(20,50,90)); } } CDialogEx::OnPaint(); CClientDC dc(this);//选定当前画图环境 DrawLine(&dc); pPic->SetBitmap(hBitmap);
MFC Picture控件加载图片
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。