本文整理汇总了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);
}