void __Free() { for (int i = 0;i < __m_nCapacity;i++) { DEL_P(__m_pArray[i].pData); } DEL_P(__m_pArray); __m_nCapacity = __m_nHead = __m_nTail = 0; }
SizeF GDIPluseExt::GetBounds(CString strText,CString strFont,INT nfontsize) { StringFormat strformat; GraphicsPath path; #ifdef _UNICODE FontFamily fontFamily(strFont); path.AddString(strText,strText.GetLength(), &fontFamily, FontStyleRegular, (REAL)nfontsize, PointF(0,0), &strformat ); #else //字符转换 int font_len = strFont.GetLength(); WCHAR* pfont_w = new WCHAR[font_len]; MultiByteToWideChar(CP_ACP,0,strFont.GetBuffer(),-1,pfont_w,font_len); strFont.ReleaseBuffer(); //字符转换 int text_len = strText.GetLength(); WCHAR* ptext_w = new WCHAR[text_len]; MultiByteToWideChar(CP_ACP,0,strText.GetBuffer(),-1,ptext_w,text_len); strText.ReleaseBuffer(); FontFamily fontFamily(pfont_w); Font font(&fontFamily, (REAL)nfontsize, FontStyleRegular, UnitPixel); path.AddString(ptext_w,wcsnlen_s(ptext_w,text_len), &fontFamily, font.GetStyle(), font.GetSize(), PointF(0,0), &strformat ); DEL_P(ptext_w); DEL_P(pfont_w); #endif RectF rcBound; // 获取边界范围 path.GetBounds(&rcBound); TRACE("Round_Size:%d\r\n",rcBound.Width); // 返回文本的宽高 return SizeF(rcBound.Width,rcBound.Height); }
SizeF GDIPluseExt::GetTextBounds(const Font& font,const StringFormat& strFormat,CString szText) { #ifndef _UNICODE //字符转换 int str_len = szText.GetLength(); WCHAR* pstr_w = new WCHAR[str_len]; MultiByteToWideChar(CP_ACP,0,szText.GetBuffer(),-1,pstr_w,str_len); szText.ReleaseBuffer(); GraphicsPath graphicsPathObj; FontFamily fontfamily; font.GetFamily(&fontfamily); graphicsPathObj.AddString(pstr_w,-1,&fontfamily,font.GetStyle(),font.GetSize(),PointF(0,0),&strFormat); DEL_P(pstr_w); #else GraphicsPath graphicsPathObj; FontFamily fontfamily; font.GetFamily(&fontfamily); graphicsPathObj.AddString(szText,-1,&fontfamily,font.GetStyle(),font.GetSize(),PointF(0,0),&strFormat); #endif RectF rcBound; // 获取边界范围 graphicsPathObj.GetBounds(&rcBound); // 返回文本的宽高 return SizeF(rcBound.Width,rcBound.Height); }
VOID CProcessControl::ShowProcessWindow(int nIndex, BOOL bshow) { ADD_CHECKLOG_UINT(nIndex); m_cSection.Lock(); PWATCH_PROCESS_INFORMATION p = GetWatchData(nIndex); p->bview = bshow; PSHOWPROCESSWINDOW pData= new SHOWPROCESSWINDOW; pData->bShow = bshow; pData->nPid = p->proinfo.dwProcessId; m_cSection.Unlock(); ::EnumWindows((WNDENUMPROC)EnumShowPro, (LPARAM)pData); DEL_P(pData); }
COptionDlg::~COptionDlg() { DEL_P(m_ptbpage_Routine); DEL_P(m_ptbpage_Program); DEL_P(m_ptbpage_Log); }
BOOL GDIPluseExt::DrawBoardsText(Graphics& gp,PointF startpf,CString strText,CString strFont,INT nfontsize,Color textcolor,Color boardscolor) { gp.SetSmoothingMode(SmoothingModeAntiAlias); gp.SetInterpolationMode(InterpolationModeHighQualityBicubic); #ifdef _UNICODE StringFormat strformat; FontFamily fontFamily(strFont); GraphicsPath path; path.AddString(strText,strText.GetLength(), &fontFamily, FontStyleRegular, (REAL)nfontsize, startpf, &strformat ); for(int i=1; i < 4; ++i) { Pen pen(boardscolor, (REAL)i); pen.SetLineJoin(LineJoinRound); gp.DrawPath(&pen, &path); } SolidBrush textBrush(textcolor); gp.FillPath(&textBrush, &path); #else //字符转换 int font_len = strFont.GetLength(); WCHAR* pfont_w = new WCHAR[font_len]; MultiByteToWideChar(CP_ACP,0,strFont.GetBuffer(),-1,pfont_w,font_len); strFont.ReleaseBuffer(); //字符转换 int text_len = strText.GetLength(); WCHAR* ptext_w = new WCHAR[text_len]; MultiByteToWideChar(CP_ACP,0,strText.GetBuffer(),-1,ptext_w,text_len); strText.ReleaseBuffer(); FontFamily fontFamily(pfont_w); Font font(&fontFamily, (REAL)nfontsize, FontStyleRegular, UnitPixel); GraphicsPath path; StringFormat strformat; path.AddString(ptext_w,wcsnlen_s(ptext_w,text_len), &fontFamily, font.GetStyle(), font.GetSize(), startpf, &strformat ); for(int i=1; i < 4; ++i) { Pen pen(boardscolor,(REAL)i); pen.SetLineJoin(LineJoinRound); gp.DrawPath(&pen, &path); } SolidBrush textBrush(textcolor); gp.FillPath(&textBrush, &path); DEL_P(ptext_w); DEL_P(pfont_w); #endif return TRUE; }
CTransformData::~CTransformData() { freedata<WATCH_PROCESS_INFORMATION>(m_pWatchData); freedata<ConfigData>(m_pConfigData); DEL_P(m_pWatchData); DEL_P(m_pConfigData); }
CProcessControl::~CProcessControl() { CLOSE_HANDLE(m_hCloseWndEvent); UnInitialize(); DEL_P(m_pIniFile); DEL_P(m_pTransformData); }