本文整理匯總了C++中XString::Replace方法的典型用法代碼示例。如果您正苦於以下問題:C++ XString::Replace方法的具體用法?C++ XString::Replace怎麽用?C++ XString::Replace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XString
的用法示例。
在下文中一共展示了XString::Replace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: PaintMe
void PaintMe(HWND hwnd)
{
HDC hDC;
PAINTSTRUCT ps;
RECT rcWindow;
HFONT hSysFont, hFont, hFontOld;
LOGFONT lfFont;
COLORREF crText;
TCHAR szTextBuffer[50], szTextBuffer2[50], szInternetTime[5];
XString xsTextBuffer;
int iFontSizePixel;
GetWindowRect(hwnd, &rcWindow);
OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
hDC = BeginPaint(hwnd, &ps);
SetBkMode(hDC, TRANSPARENT);
if (bSelected == TRUE) {
HBRUSH hBrush = GetSysColorBrush(COLOR_HIGHLIGHT);
FillRect(hDC, &rcWindow, hBrush);
DeleteObject(hBrush);
}
if (g_iTextSize == 0)
{
SHGetUIMetrics(SHUIM_FONTSIZE_PIXEL, &iFontSizePixel, sizeof(iFontSizePixel), NULL);
}
else
{
iFontSizePixel = MulDiv(g_iTextSize + MIN_FONT_SIZE - 1, DRA::LogPixelsY(), 72);
}
hSysFont = (HFONT) GetStockObject(SYSTEM_FONT);
GetObject(hSysFont, sizeof(LOGFONT), &lfFont);
//memset(&lfFont, 0, sizeof(LOGFONT));
lfFont.lfWeight = FW_SEMIBOLD;
lfFont.lfHeight = -iFontSizePixel;
hFont = CreateFontIndirect(&lfFont);
hFontOld = (HFONT) SelectObject(hDC, hFont);
crText = SendMessage(GetParent(hwnd), TODAYM_GETCOLOR, (WPARAM) TODAYCOLOR_TEXT, NULL);
SetTextColor(hDC, crText);
InflateRect(&rcWindow, -2, 0);
_itot(g_iInternetTime, szInternetTime, 10);
//_ttoi
_tcscpy(szTextBuffer, _T("a\0"));
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, g_xsLeftFormat.Replace(_T("'"), _T("'''")).GetBuffer(), szTextBuffer, sizeof szTextBuffer);
GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, szTextBuffer, szTextBuffer2, sizeof szTextBuffer2);
xsTextBuffer = XString(szTextBuffer2).Replace(_T("@"), XString(_T("@"), szInternetTime));
DrawText(hDC, xsTextBuffer.GetBuffer(), -1, &rcWindow, DT_VCENTER | DT_LEFT);
_tcscpy(szTextBuffer, _T("a\0"));
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, g_xsRightFormat.Replace(_T("'"), _T("'''")).GetBuffer(), szTextBuffer, sizeof szTextBuffer);
GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, szTextBuffer, szTextBuffer2, sizeof szTextBuffer2);
xsTextBuffer = XString(szTextBuffer2).Replace(_T("@"), XString(_T("@"), szInternetTime));
DrawText(hDC, xsTextBuffer.GetBuffer(), -1, &rcWindow, DT_VCENTER | DT_RIGHT);
SelectObject(hDC, hFontOld);
DeleteObject(hFont);
EndPaint(hwnd, &ps);
}