如何在控件上绘制已经定义好的BITMAP结构数据
希望实现的程序功能主要是读取一个tga文件并转换文件信息到BITMAP结构中。现在我已经把TGA格式数据转换到BITMAP结构中了,但是在空间上看不到绘制结果。绘制方法:
void CPreViewDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CPoint pt;
CSize size;
CRect rect;
GetClientRect(rect);
bitmap.CreateBitmapIndirect(&m_bmpColor);
pt.x = 0;
pt.y = 0;
size.cx = rect.Width();
size.cy = rect.Height();
dc.DrawState(pt,size,&bitmap,DST_BITMAP);
// Do not call CDialog::OnPaint() for painting messages
}
其中m_bmpColor是已经定义过了的BITMAP结构。
如果调用资源里的Bitmap位图就可以显示。
void CPreViewDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CPoint pt;
CSize size;
BITMAP Color;
CBitmap bitmap;
CRect rect;
GetClientRect(rect);
bitmap.LoadBitmap(IDB_BITMAP2);
bitmap.GetBitmap(&Color);
pt.x = 0;
pt.y = 0;
size.cx = rect.Width();
size.cy = rect.Height();
dc.DrawState(pt,size,&bitmap,DST_BITMAP);
// Do not call CDialog::OnPaint() for painting messages
}
希望能得到解答
void CPreViewDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CPoint pt;
CSize size;
CRect rect;
GetClientRect(rect);
bitmap.CreateBitmapIndirect(&m_bmpColor);
pt.x = 0;
pt.y = 0;
size.cx = rect.Width();
size.cy = rect.Height();
dc.DrawState(pt,size,&bitmap,DST_BITMAP);
// Do not call CDialog::OnPaint() for painting messages
}
其中m_bmpColor是已经定义过了的BITMAP结构。
如果调用资源里的Bitmap位图就可以显示。
void CPreViewDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CPoint pt;
CSize size;
BITMAP Color;
CBitmap bitmap;
CRect rect;
GetClientRect(rect);
bitmap.LoadBitmap(IDB_BITMAP2);
bitmap.GetBitmap(&Color);
pt.x = 0;
pt.y = 0;
size.cx = rect.Width();
size.cy = rect.Height();
dc.DrawState(pt,size,&bitmap,DST_BITMAP);
// Do not call CDialog::OnPaint() for painting messages
}
希望能得到解答
...全文
相关推荐
博客《自定义控件三部曲之绘图篇(十七)——为Bitmap添加阴影并封装控件》对应源码
博客《自定义控件三部曲之绘图篇(十七)——为Bitmap添加阴影并封装控件》对应源码,博客地址:http://blog.csdn.net/harvic880925/article/details/51889104
Bitmap类和PictureBox控件实现显示,保存
Bitmap类和PictureBox控件实现显示,保存源码
Android 刮刮卡效果 自定义控件实现
资源为博客的实例代码: http://blog.csdn.net/lmj623565791/article/details/40162163 有问题请博客留言
Delphi增强型BitMap控件
增强型BitMap控件,在delohi下使用的组件。
Bitmap绘制颜色过滤
Bitmap绘制,包括颜色过滤矩阵,光照、混合模式。并设置染色模式。


图形处理/算法

