/********************************************************************* * * _DrawScreen */ static void _DrawScreen(void) { GUI_RECT Rect; int yd; GUI_DrawBitmap(&_bmSeggerLogo_50x25, 10, 10); GUI_SetFont(GUI_FONT_20B_ASCII); GUI_DispStringHCenterAt("Antialiased text sample", 190, 5); GUI_SetFont(GUI_FONT_13_ASCII); GUI_DispStringHCenterAt("Shows antialiased text on different backgrounds.", 190, 25); Rect.x0 = 0; Rect.y0 = 43; Rect.x1 = 59; Rect.y1 = Rect.y0 + 95; yd = (Rect.y1 - Rect.y0) / 3; // // 4 bit antialiasing sample // _DrawText("Antialiased text\n (4 bpp)", &Rect); GUI_SetFont(&_FontAA4_32); _DrawSample(&Rect, yd); // // 2 bit antialiasing sample // GUI_MoveRect(&Rect, 0, 101); _DrawText("Antialiased text\n (2 bpp)", &Rect); GUI_SetFont(&_FontAA2_32); _DrawSample(&Rect, yd); }
// 게임화면 int MyDraw5() { int i; //적 그리기 for(i=0; i<10; i++) { if(1 == g_aH[i].life) //살아있는것만 그려줌 { _DrawText(g_aH[i].x,g_aH[i].y,g_aH[i].msg); //구조체의 장점을 알 수 있는 라인 잘 보셈 } } /////졸라맨그리기 _DrawText(g_G.x,g_G.y,"★"); ////점수 찍기 //sprintf(temp, "score:%d", g_score); //_DrawText(70,2,temp); // return 0; }
void CTrashCleanCtrl::_DrawTextInfor(CDC& dc, CRect& rcItem, LPTRASH_ITEM lpItem) { CRect rcDraw(rcItem); HFONT hFont = KuiFontPool::GetFont(TRUE, FALSE, FALSE); if (lpItem->bShowDetail) { _DrawText(dc, rcDraw, lpItem->strItemName, DEF_TRASH_DEFAULT_TEXT_CLR, hFont); ::CopyRect(lpItem->rcText, rcDraw); } else { rcDraw.top += (rcItem.Height() / 2) - (DEF_ICON_HEIGHT / 2); rcDraw.bottom = rcItem.top + (rcItem.Height() / 2); _DrawText(dc, rcDraw, lpItem->strItemName, DEF_TRASH_DEFAULT_TEXT_CLR, hFont); CRect rcBrief(rcItem); HFONT briefFont = KuiFontPool::GetFont(FALSE, FALSE, FALSE); rcBrief.top += (rcItem.Height() / 2) + 3; rcBrief.bottom = rcItem.top + (rcItem.Height() / 2) + (DEF_ICON_HEIGHT / 2); _DrawText(dc, rcBrief, lpItem->strBrief, DEF_TRASH_DETAIL_TEXT_CLR, briefFont); } // 绘制信息 rcDraw.left = rcDraw.right; rcDraw.right = lpItem->rcBox.right; _DrawItemStatus(dc, rcDraw, lpItem); }
// exit int MyDraw4() { _DrawText(10,5,"게임종료"); return 0; }
void Draw() { char temp[20]; sprintf(temp,"key:%d",g_key); _DrawText(70,5,temp); if(g_level == 1) //메인 { MyDraw1(); } else if(g_level == 2) // 줄거리 { MyDraw2(); } else if(g_level == 3) // 도움말 { MyDraw3(); } else if(g_level == 4) // exit { MyDraw4(); } else if(g_level == 5) // 게임화면 { MyDraw5(); } /* else if(g_level == 5) { MyDraw6(); } else if(g_level == 5) { MyDraw7(); } else if(g_level == 5) { MyDraw8(); } else if(g_level == 5) { MyDraw9(); } else if(g_level == 5) { MyDraw9(); } else if(g_level == 5) { MyDraw9(); } */ }
void CTrashCleanCtrl::_DrawItemStatus(CDC& dc, CRect& rcDraw, LPTRASH_ITEM lpItem) { KAppRes& res = KAppRes::Instance(); HFONT hFontNormal = KuiFontPool::GetFont(FALSE, FALSE, FALSE); switch (lpItem->nStatus) { case Empty_Info: break; case WaitScan: { // CString str = res.GetString("IDS_WAIT_SCAN"); // _DrawText(dc, rcDraw, str, DEF_TRASH_STATUS_TEXT_CLR, hFontNormal); } break; case Scaning: { // CString str = res.GetString("IDS_TRASH_SCANING"); // _DrawText(dc, rcDraw, str, DEF_TRASH_STATUS_TEXT_CLR, hFontNormal); } break; case FinishScan: { int iCount; ULONGLONG totalSize = 0; UINT totalCount = 0; int counter = 0; CString strStatus; for (iCount = 0; iCount < (int)lpItem->vecItems.size(); ++iCount) { if (lpItem->vecItems[iCount].bChecked && lpItem->vecItems[iCount].nStatus == FinishScan) { counter ++; totalSize += lpItem->vecItems[iCount].uTotalSize; totalCount += lpItem->vecItems[iCount].nFileNum; } } if (counter == 0) break; _GetItemStatusString(lpItem->uItemId, strStatus, counter, totalCount, totalSize); _DrawText(dc, rcDraw, strStatus, DEF_TRASH_STATUS_TEXT_CLR, hFontNormal); } break; default: break; } }
void CWBProcess::OnToolBoxItemClick( int nId ) { if (m_bCtrlTxt) { m_bCtrlTxt = false; if ( GetInterfacePtr() ) { GetInterfacePtr()->CtlGetTxt(m_CtrlAttr.ctText.tdText); _DrawText(m_CtrlAttr.ctText.tdText, m_MouseIni, m_MousePos, m_CurFont, m_CurColor); } } m_CurIdent = nId; if ( GetInterfacePtr() ) GetInterfacePtr()->ToolBoxItemSel( nId ); }
void CTrashCleanCtrl::_DrawDetailItem(CDC& dc, CRect& rcItem, LPTrashDetailItem lpDetailItem) { CRect rcDraw(rcItem); COLORREF clrText = DEF_TRASH_DETAIL_TEXT_CLR; HFONT hFont = KuiFontPool::GetFont(FALSE, FALSE, FALSE); rcDraw.left = rcItem.left; rcDraw.top = m_nTotalHeight; rcDraw.bottom = rcDraw.top + DEF_DETAIL_ITEM_HEIGHT; rcDraw.right = m_rcClient.right; _DrawCheckBox(dc, rcDraw, lpDetailItem->rcCheck, lpDetailItem); rcDraw.left = lpDetailItem->rcCheck.right + DEF_CHECK_TO_TEXT - 3; rcDraw.top = m_nTotalHeight - 3; rcDraw.bottom = rcDraw.top + DEF_DETAIL_ITEM_HEIGHT + 6; rcDraw.right = m_rcClient.right - 40; ::CopyRect(lpDetailItem->rcSelected, rcDraw); if (m_nSelectedIndex == lpDetailItem->nItemId) { _DrawSelectedBox(dc, rcDraw, lpDetailItem); clrText = RGB(0,0,0); } else if (m_nHoverIndex == lpDetailItem->nItemId) { _DrawHoverBox(dc, rcDraw, lpDetailItem); } rcDraw.left = lpDetailItem->rcCheck.right + DEF_CHECK_TO_TEXT; rcDraw.top = m_nTotalHeight; rcDraw.bottom = rcDraw.top + DEF_DETAIL_ITEM_HEIGHT; rcDraw.right = m_rcClient.right; _DrawText(dc, rcDraw, lpDetailItem->strName, clrText, hFont); lpDetailItem->rcCheck.right = rcDraw.right; // 根据状态 绘制 _DrawDetailItemStatus(dc, rcDraw, lpDetailItem); }
void CTrashCleanCtrl::_DrawCheckDetail(CDC& dc, CRect& rcItem, LPTrashDetailItem lpDetailItem) { HFONT hFont = KuiFontPool::GetFont(FALSE, TRUE, FALSE); CRect rcDraw(rcItem); COLORREF clrText; CString strText = KAppRes::Instance().GetString("IDS_TRASH_CHECK_DETAIL"); // 查看详情 if (lpDetailItem->bInDetail && m_nHoverIndex == lpDetailItem->nItemId) { clrText = RGB(255, 23, 23); } else { clrText = RGB(77, 112, 150); } rcDraw.left = rcDraw.right - 70; _DrawText(dc, rcDraw, strText, clrText, hFont); ::CopyRect(lpDetailItem->rcDetail, rcDraw); }
void CWBProcess::OnMouseLButtonDown( MouseFlag flag, PtPos& point ) { m_bLeftDown = true; if (GetInterfacePtr()) { RcPos rcMouse; PtPos fp; rcMouse.SetAttr(point.X, point.Y, point.X, point.Y); switch (m_CurIdent) { case ID_WB_POS: GetInterfacePtr()->EdtKillArea(); break; case ID_WB_TXT: if (m_bCtrlTxt) { m_bCtrlTxt = false; if ( GetInterfacePtr() ) { GetInterfacePtr()->CtlGetTxt(m_CtrlAttr.ctText.tdText); _DrawText(m_CtrlAttr.ctText.tdText, m_MouseIni, m_MousePos, m_CurFont, m_CurColor); } } break; case ID_WB_DEL: m_CtrlAttr.Clear(); m_CtrlAttr.Init (WB_DEL, 0, m_CurLine+DIF_PEN, rcMouse); m_CtrlAttr.ctColor.SetAttr(m_DelColor.cdRed, m_DelColor.cdGreen, m_DelColor.cdBlue); fp.SetAttr(point.X, point.Y); m_CtrlAttr.ctPoints.InsPoint(fp); m_CtrlAttr.ctPos.SetAttr(point.X, point.Y, point.X, point.Y); break; case ID_WB_PEN: m_CtrlAttr.Clear(); m_CtrlAttr.Init (WB_PEN, 0, m_CurLine, rcMouse); m_CtrlAttr.ctColor.SetAttr(m_CurColor.cdRed, m_CurColor.cdGreen, m_CurColor.cdBlue); fp.SetAttr(point.X, point.Y); m_CtrlAttr.ctPoints.InsPoint(fp); m_CtrlAttr.ctPos.SetAttr(point.X, point.Y, point.X, point.Y); break; case ID_WB_MRK: m_CtrlAttr.Clear(); m_CtrlAttr.Init (WB_MRK, 0, m_CurLine+DIF_PEN, rcMouse); m_CtrlAttr.ctColor.SetAttr(m_MrkColor.cdRed, m_MrkColor.cdGreen, m_MrkColor.cdBlue); fp.SetAttr(point.X, point.Y); m_CtrlAttr.ctPoints.InsPoint(fp); m_CtrlAttr.ctPos.SetAttr(point.X, point.Y, point.X, point.Y); break; default: {} // this line avoids switch warnings in gcc. } m_MouseIni.SetAttr(point.X, point.Y); m_MousePos.SetAttr(point.X, point.Y); } }
void CTrashSkipCtrl::_DrawHeader(CDC& dc, CRect& rcDraw) { CDC dcTemp; CRect rcBack(rcDraw); HFONT hFont; CString strNum; dcTemp.CreateCompatibleDC( dc ); HBITMAP hOldBitmap = dcTemp.SelectBitmap(m_bmpHeadBack); rcBack.bottom = DEF_HEAD_HEIGHT; dc.StretchBlt(rcBack.left, rcBack.top, rcBack.Width(), rcBack.Height(), dcTemp, 0, 0, 1, DEF_HEAD_HEIGHT, SRCCOPY); rcDraw.top = 0; rcDraw.left = DEF_LEFT_SPACE; rcDraw.bottom = rcDraw.top + DEF_HEAD_HEIGHT; hFont = KuiFontPool::GetFont(FALSE, FALSE, FALSE, 0); // _DrawText(dc, rcDraw, L"清理时已跳过", RGB(0,0,0), hFont); // // strNum.Format(L"%d", GetSize()); // // rcDraw.left = rcDraw.right + 5; // rcDraw.right = m_rcClient.right; // // _DrawText(dc, rcDraw, strNum, RGB(255,0,0), hFont); // // rcDraw.left = rcDraw.right + 5; rcDraw.right = m_rcClient.right; if (m_nCountdownNum >= 0) { CString strFormat = L"%d "; CString strText; _DrawText(dc, rcDraw, L"已关闭所有程序,",RGB(0,0,0), hFont); rcDraw.left = rcDraw.right; rcDraw.right = m_rcClient.right; strText.Format(strFormat, m_nCountdownNum); _DrawText(dc, rcDraw, strText, RGB(0xE4,0x5C,0x27), KuiFontPool::GetFont(TRUE, FALSE, FALSE, 2)); rcDraw.left = rcDraw.right; rcDraw.right = m_rcClient.right; _DrawText(dc, rcDraw, L"秒后自动重新扫描!", RGB(0,0,0), hFont); } else { _DrawText(dc, rcDraw, L"关闭下列程序再重新扫描,还可以释放约", RGB(0,0,0), hFont); ULONGLONG totalSize = 0; CString strSize; _GetTotalSize(totalSize); GetFileSizeTextString(totalSize, strSize); rcDraw.left = rcDraw.right + 5; rcDraw.right = m_rcClient.right; _DrawText(dc, rcDraw, strSize, RGB(255,0,0), hFont); rcDraw.left = rcDraw.right + 5; rcDraw.right = m_rcClient.right; _DrawText(dc, rcDraw, L"磁盘空间。", RGB(0,0,0), hFont); } }
// 도움말 int MyDraw3() { _DrawText(0,0,"○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●"); _DrawText(0,1,"● ○"); _DrawText(0,2,"○ ●"); _DrawText(0,3,"● ○"); _DrawText(0,4,"○ ●"); _DrawText(0,5,"● ○"); _DrawText(0,6,"○ ●"); _DrawText(0,7,"● ○"); _DrawText(0,8,"○ ●"); _DrawText(0,9,"● ○"); _DrawText(0,10,"○ ●"); _DrawText(0,11,"● ○"); _DrawText(0,12,"○ ●"); _DrawText(0,13,"● ○"); _DrawText(0,14,"○ ●"); _DrawText(0,15,"● ○"); _DrawText(0,16,"○ ●"); _DrawText(0,17,"● ○"); _DrawText(0,18,"○ ●"); _DrawText(0,19,"● ○"); _DrawText(0,20,"○ ●"); _DrawText(0,21,"● ○"); _DrawText(0,22,"○ ●"); _DrawText(0,23,"● ○"); _DrawText(0,24,"○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●"); return 0; }
// 메인 int MyDraw1() { char temp[20]; _DrawText(0,0,"○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●"); _DrawText(0,1,"● ○"); _DrawText(0,2,"○ ■■ ■■ ■ ■ ■ ■ ●"); _DrawText(0,3,"● ■□□■□□■ ■■■■■ ■ ■■■■■ ■ ■■■■■ ■ ○"); _DrawText(0,4,"○ ■□□□□■ ■ ■ ■ ■ ■ ■ ■ ●"); _DrawText(0,5,"● ■□□□■ ■ ■ ■ ■ ■ ■■■ ■ ■ ○"); _DrawText(0,6,"○ ■□□■ ■■■■■ ■ ■ ■ ■ ■ ●"); _DrawText(0,7,"● ■■ ■ ■ ■ ○"); _DrawText(0,8,"○ ●"); _DrawText(0,9,"● << S T A R T >> ○"); _DrawText(0,10,"○ << 줄 거 리 >> ●"); _DrawText(0,11,"● << 도 움 말 >> ○"); _DrawText(0,12,"○ << E X I T >> ●"); _DrawText(0,13,"● ○"); _DrawText(0,14,"○ ●"); _DrawText(0,15,"● ○"); _DrawText(0,16,"○ ┌────┐ ♡ ♡ ♡ ♡ ●"); _DrawText(0,17,"● │ 학 교 │ ♡ ♡ ♡ ♡ ○"); _DrawText(0,18,"○ └─┐┌─┘ ♡ ♡ ♡ ♡ ●"); _DrawText(0,19,"● ┌┴┴┐ ♡ ♡ ♡ ♡ ○"); _DrawText(0,20,"○ ┌─┘ └─┐ ♡ ♡ ♡ ♡ ∩∩ ●"); _DrawText(0,21,"● │ │ ↖◎↗ ↖◎↗ ↖◎↗ ↖◎↗ (ºº) ○"); _DrawText(0,22,"○ │ │ ▩ ▩ ▩ ▩ ┌▩┘ ●"); _DrawText(0,23,"● └──────┘ @ @ @ @ @ @ @ @ ┘┘ ○"); _DrawText(0,24,"○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●"); _DrawTextColor(29,9 + g_a * 1,"☞",10); _DrawTextColor(48,9 + g_a * 1,"☜",10); //남은시간 찍기 sprintf(temp,"남은시간 : %d",g_time1); _DrawText(60,10,temp); return 0; }
void CTrashCleanCtrl::_DrawDetailItemStatus(CDC& dc,CRect& rcDraw,LPTrashDetailItem lpDetailItem) { KAppRes& res = KAppRes::Instance(); HFONT hFont = KuiFontPool::GetFont(FALSE, FALSE, FALSE); COLORREF clrText; if (m_nSelectedIndex == lpDetailItem->nItemId) { clrText = RGB(0,0,0); } else { clrText = DEF_TRASH_DETAIL_TEXT_CLR; } switch (lpDetailItem->nStatus) { case Empty_Info: break; case Scaning: { CString strFormat = res.GetString("IDS_TRASH_SCANING"); CString strFileNum; CString strSize; CString str; GetFileCountText(lpDetailItem->nFileNum, strFileNum); GetFileSizeTextString(lpDetailItem->uTotalSize, strSize); rcDraw.left += 175; rcDraw.right = m_rcClient.right; str.Format(strFormat, strFileNum, strSize); _DrawText(dc, rcDraw, str, clrText, hFont); } break; case Clearing: { CString strFormat = res.GetString("IDS_TRASH_CLEANING"); CString strFileNum; CString strSize; CString str; GetFileCountText(lpDetailItem->nFileNum, strFileNum); GetFileSizeTextString(lpDetailItem->uTotalSize, strSize); rcDraw.left += 175; rcDraw.right = m_rcClient.right; str.Format(strFormat, strFileNum, strSize); _DrawText(dc, rcDraw, str, clrText, hFont); } break; case FinishScan: { // if (!lpDetailItem->bChecked) // break; if (m_nSelectedIndex == lpDetailItem->nItemId && lpDetailItem->nFileNum > 0) { CRect rcDetail(rcDraw); rcDetail.right = m_rcClient.right - 40; _DrawCheckDetail(dc, rcDetail, lpDetailItem); } CString strFileNum; CString strCount; GetFileCountText(lpDetailItem->nFileNum, strCount); strFileNum.Format(L"%s个", strCount); rcDraw.left += 100; rcDraw.right = rcDraw.left + 100; // _DrawTextRight(dc, rcDraw, strFileNum, DEF_TRASH_DETAIL_TEXT_CLR, hFont); COLORREF oldClr = dc.SetTextColor(clrText); HFONT oldFont = dc.SelectFont(hFont); dc.DrawText(strFileNum, (int)_tcslen(strFileNum), rcDraw, DT_RIGHT|DT_VCENTER|DT_SINGLELINE); rcDraw.left += 70; rcDraw.right = rcDraw.left + 100; CString strSize; GetFileSizeTextString(lpDetailItem->uTotalSize, strSize); dc.DrawText(strSize, (int)_tcslen(strSize), rcDraw, DT_RIGHT|DT_VCENTER|DT_SINGLELINE); // _DrawTextRight(dc, rcDraw, strSize, DEF_TRASH_DETAIL_TEXT_CLR, hFont); dc.SelectFont(oldFont); dc.SetTextColor(oldClr); } break; case FinishClear: { CString strFinish = res.GetString("IDS_TRASH_FINISH_CLEAR"); rcDraw.left += 175; rcDraw.right = m_rcClient.right; _DrawText(dc, rcDraw, strFinish, clrText, hFont); } break; case SkipRunning: { CString strSkip = res.GetString("IDS_TRASH_RUNNING"); rcDraw.left += 175; rcDraw.right = m_rcClient.right; _DrawText(dc, rcDraw, strSkip, DEF_TRASH_STATUS_TEXT_CLR, hFont); } break; default: break; } }
void CDlgTipDetail::OnPaint(CDCHandle dc) { PAINTSTRUCT ps; HDC hDC = ::BeginPaint( m_hWnd, &ps ); Gdiplus::Graphics grap(hDC); Gdiplus::Image *pImg = NULL; CDC memDC(hDC); int nDownHeightPos = m_rcClient.Height() - 27; memDC.SetBkMode(TRANSPARENT); pImg = BkPngPool::Get(IDP_VUL_TIP_HEAD); grap.DrawImage(pImg, 0,0); pImg = BkPngPool::Get(IDP_VUL_TIP_DOWN); grap.DrawImage(pImg, 0, nDownHeightPos); pImg = BkPngPool::Get(IDP_VUL_TIP_CLOSE); if (m_nCloseState == -1) { grap.DrawImage(pImg, m_rcCloseBtn.left, m_rcCloseBtn.top); } CRect rcGrant(0,84, DEF_VUL_TIP_DETAIL_WIDTH, nDownHeightPos); _DrawGradualColorRect(memDC, rcGrant,RGB(0xE4, 0xF0, 0xFE), RGB(0xD7, 0xE6, 0xF9), TRUE); _DrawLine(memDC, CPoint(0,0), CPoint(0,m_rcClient.Height()), RGB(0x87, 0x98, 0xA8)); _DrawLine(memDC, CPoint(DEF_VUL_TIP_DETAIL_WIDTH - 1, 0), CPoint(DEF_VUL_TIP_DETAIL_WIDTH - 1, m_rcClient.Height()), RGB(0x87, 0x98, 0xA8)); HFONT hHeadFont = BkFontPool::GetFont(TRUE, FALSE, FALSE, 1); HFONT hNormalFont = BkFontPool::GetFont(FALSE, FALSE, FALSE); CString strTitle; CString strTmp = BkString::Get(IDS_VULFIX_5019); FormatKBString(m_pItemData->nID, strTitle); strTitle = strTmp + _T(":") + strTitle; CRect rcText(13, 10, 220, 25); CRect rcTemp; _DrawText(memDC, rcText, strTitle, RGB(0x0, 0x0, 0x0), hHeadFont); rcText.SetRect(15, 32, 200, 47); strTmp = BkString::Get(IDS_VULFIX_5021); strTitle = strTmp + _T(":") + m_pItemData->strPubDate; _DrawText(memDC, rcText, strTitle, RGB(0x44, 0x61, 0x83), hNormalFont); // 大小 rcText.SetRect(275,32,DEF_VUL_TIP_DETAIL_WIDTH,47); FormatSizeString(m_pItemData->nFileSize, strTitle); strTmp = BkString::Get(IDS_VULFIX_5124); strTitle = strTmp + strTitle; _DrawText(memDC, rcText, strTitle, RGB(0x44, 0x61, 0x83), hNormalFont); // 绘制小点 和 描述文字 pImg = BkPngPool::Get(IDP_VUL_TIP_POINT); CRect rcContent(15, 72, DEF_VUL_TIP_DETAIL_WIDTH, 72 + 15); if (!m_pItemData->strMSID.IsEmpty()) { grap.DrawImage(pImg, rcContent.left, rcContent.top + 5); strTmp = BkString::Get(IDS_VULFIX_5123); strTmp += m_pItemData->strMSID; rcContent.left += 10; _DrawText(memDC, rcContent, strTmp, RGB(0,0,0), hNormalFont); rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 15; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; } grap.DrawImage(pImg, rcContent.left, rcContent.top + 5); rcContent.left += 10; strTmp = BkString::Get(IDS_VULFIX_5125); _DrawText(memDC, rcContent, strTmp, RGB(0,0,0), hNormalFont); rcContent.left = rcContent.right; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; CString strAff = m_pItemData->strAffects; if (strAff.GetLength() < 25) { _DrawText(memDC, rcContent, strAff, RGB(255, 0, 0), hNormalFont); } else { strTmp = strAff.Mid(0, 25); _DrawText(memDC, rcContent, strTmp, RGB(255, 0, 0), hNormalFont); strAff = strAff.Mid(25); while(1) { if (strAff.GetLength() > 0) { int len = strAff.GetLength(); rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 25; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; if (strAff.GetLength() > 30) len = 30; strTmp = strAff.Mid(0, len); _DrawText(memDC, rcContent, strTmp, RGB(255, 0, 0), hNormalFont); strAff = strAff.Mid(len); } else { break; } } } // 描述 rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 15; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; grap.DrawImage(pImg, rcContent.left, rcContent.top + 5); rcContent.left += 10; strTmp = BkString::Get(IDS_VULFIX_5172); _DrawText(memDC, rcContent, strTmp, RGB(0,0,0), hNormalFont); rcContent.left = rcContent.right; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; CString strDes = m_pItemData->strDesc; if (strDes.GetLength() < 25) { _DrawText(memDC, rcContent, strDes, RGB(0, 0, 0), hNormalFont); } else { HFONT oldFont = memDC.SelectFont(hNormalFont);; int len = 25; strTmp = strDes.Mid(0, len); int nCount = 0; while(1) { CSize nSize; memDC.GetTextExtent(strTmp, -1, &nSize); if (rcContent.left + nSize.cx < DEF_VUL_TIP_DETAIL_WIDTH - 30) { if (len < strDes.GetLength()) { ++len; strTmp = strDes.Mid(0, len); } else { break; } } else break; } _DrawText(memDC, rcContent, strTmp, RGB(0, 0, 0), hNormalFont); strDes = strDes.Mid(len); while(1) { if (nCount >= 2) { break; } if (strDes.GetLength() > 0) { int len = strDes.GetLength(); rcContent.left = 25; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; if (strDes.GetLength() > 30) len = 30; else break; strTmp = strDes.Mid(0, len); // 文字可能是混合的,从个数到计算长度来确定本行的个数。 while(1) { CSize nSize; memDC.GetTextExtent(strTmp, -1, &nSize); if (rcContent.left + nSize.cx < DEF_VUL_TIP_DETAIL_WIDTH - 30) { if (len < strDes.GetLength()) { ++len; strTmp = strDes.Mid(0, len); } else { break; } } else break; } if (len == strDes.GetLength()) break; rcContent.top += 17; rcContent.bottom += 17; _DrawText(memDC, rcContent, strTmp, RGB(0, 0, 0), hNormalFont); strDes = strDes.Mid(len); } else { break; } nCount ++; } memDC.SelectFont(oldFont); } CSize nSize; rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 25; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; memDC.GetTextExtent(strDes, -1, &nSize); if (rcContent.left + nSize.cx > DEF_VUL_TIP_DETAIL_WIDTH - 90) rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH - 90; _DrawText(memDC, rcContent, strDes, RGB(0, 0, 0), hNormalFont); rcContent.left = rcContent.right; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; _DrawText(memDC, rcContent, BkString::Get(IDS_VULFIX_5128), RGB(0x33, 0x62, 0x9A), BkFontPool::GetFont(FALSE, TRUE ,FALSE)); ::CopyRect(m_rcDetail, rcContent); // draw link HFONT hLinkFont = BkFontPool::GetFont(FALSE, TRUE, FALSE); CRect rcLink; COLORREF clrLink = RGB(0x33, 0x62, 0x9A); rcLink.SetRect(15, m_rcClient.Height() - 20, 300, m_rcClient.Height() - 5); _DrawText(memDC, rcLink, BkString::Get(IDS_VULFIX_5170), clrLink, hLinkFont); ::CopyRect(m_rcQuestion, rcLink); rcLink.left = 250; rcLink.right = DEF_VUL_TIP_DETAIL_WIDTH; _DrawText(memDC, rcLink, BkString::Get(IDS_VULFIX_5129), clrLink, hLinkFont); ::CopyRect(m_rcOfficial, rcLink); rcLink.left = 325; rcLink.right = DEF_VUL_TIP_DETAIL_WIDTH; _DrawText(memDC, rcLink, BkString::Get(IDS_VULFIX_5171), clrLink, hLinkFont); ::CopyRect(m_rcIgnoreVul, rcLink); ::EndPaint( m_hWnd, &ps ); }