如题,使用GDI+对路径作纹理填充时,GDI对象狂增。
代码如下
//纹理填充,从DLL中读取纹理位图数据,生成一个Pattern画刷
#ifdef _DEBUG
static CDllResource ResDll("GraphResD.dll");
#else
static CDllResource ResDll("GraphRes.dll");
#endif
HBITMAP hBitmap = ResDll.LoadBitmap(TxtStyle.FillStyle.pattern_style);
if( hBitmap == NULL )
return ;
Bitmap* pBmp = NULL;
pBmp = Bitmap::FromHBITMAP(hBitmap,NULL);
ASSERT(pBmp);
//Image* pImage = Gdiplus::Image::
TextureBrush tb(pBmp);
GraphicsPath path;
SetFontPath(pszTxt,TxtStyle,path);
Graphics graph(pDC->GetSafeHdc());
graph.SetSmoothingMode(SmoothingModeAntiAlias); //抗锯齿
//graph.SetCompositingMode(CompositingModeSourceCopy);
graph.FillPath(&tb, &path);
SAFEDELETE(pBmp);
大伙帮忙看看问题出在了哪儿
代码如下
//纹理填充,从DLL中读取纹理位图数据,生成一个Pattern画刷
#ifdef _DEBUG
static CDllResource ResDll("GraphResD.dll");
#else
static CDllResource ResDll("GraphRes.dll");
#endif
HBITMAP hBitmap = ResDll.LoadBitmap(TxtStyle.FillStyle.pattern_style);
if( hBitmap == NULL )
return ;
Bitmap* pBmp = NULL;
pBmp = Bitmap::FromHBITMAP(hBitmap,NULL);
ASSERT(pBmp);
//Image* pImage = Gdiplus::Image::
TextureBrush tb(pBmp);
GraphicsPath path;
SetFontPath(pszTxt,TxtStyle,path);
Graphics graph(pDC->GetSafeHdc());
graph.SetSmoothingMode(SmoothingModeAntiAlias); //抗锯齿
//graph.SetCompositingMode(CompositingModeSourceCopy);
graph.FillPath(&tb, &path);
SAFEDELETE(pBmp);
大伙帮忙看看问题出在了哪儿
解决方案 »
- VC修改SQL数据库 ADO
- 向父窗口发送消息的问题
- windows中如何遍历目录?
- 在socket编程中如何对结构化数据处理。请给个例子,希望通用些的。
- 微软专家在吗?请教一个CImage类的问题?为何对同一个流操作会有两种不同的结果呢?hr=m_pImage->Save(fStream,".jpg");//ok hr=m_pImage->L
- 如何将CString转换为LPSTR?又如何将LPSTR转换为CString?
- 简单问题,怎么使用全局变量
- 请问如何得到鼠标所在的窗口句柄
- 关于用 VC 6.0 做 ActiveX 控件
- 如何做到Spliter左边TreeView右边是FormView(多个)???
- 如何通过hook CreateCompatibleBitmap实现反截屏
- 关于纯虚函数的问题
DeleteObject(hBitmap);
就可以了;
结贴。