本文整理汇总了C++中gdiplus::StringFormat::SetTabStops方法的典型用法代码示例。如果您正苦于以下问题:C++ StringFormat::SetTabStops方法的具体用法?C++ StringFormat::SetTabStops怎么用?C++ StringFormat::SetTabStops使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdiplus::StringFormat
的用法示例。
在下文中一共展示了StringFormat::SetTabStops方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
void OnPaint(HDC hdc)
{
Graphics g(hdc);
gOffScreenGraphics->Clear(Color::White);
Gdiplus::SolidBrush* redBrush = new Gdiplus::SolidBrush(Gdiplus::Color::Red);
gOffScreenGraphics->FillRectangle(redBrush, (150 + (20 * showJoystickId)), 40, 20, 12);
delete redBrush;
Gdiplus::Font fontJoyState(L"MS ゴシック", 9);
Gdiplus::Font fontJoyCaps(L"MS ゴシック", 12);
Gdiplus::Font fontJoyInfoEx(L"MS ゴシック", 30);
Gdiplus::SolidBrush blackBrush(Color(255, 0, 0, 0));
Gdiplus::StringFormat format;
format.SetAlignment(StringAlignmentNear);
Gdiplus::StringFormat formatState;
formatState.SetAlignment(StringAlignmentNear);
REAL* tabMargins = (REAL*) malloc(sizeof(REAL) * (joyGetNumDevs() + 1));
tabMargins[0] = 150;
for (unsigned int i = 1; i < joyGetNumDevs() + 1; i++) { tabMargins[i] = 20; }
formatState.SetTabStops(0, (joyGetNumDevs() + 1), tabMargins);
free(tabMargins);
gOffScreenGraphics->DrawString(
joyStateString.ToString().c_str(),
-1,
&fontJoyState,
RectF(0.0f, 0.0f, (float)GetSystemMetrics(SM_CXSCREEN) / 2, (float)GetSystemMetrics(SM_CYSCREEN)),
&format,
&blackBrush);
basic_stringstream<TCHAR> stream;
stream << _T("表示JoystickID:") << showJoystickId;
gOffScreenGraphics->DrawString(
stream.str().c_str(),
-1,
&fontJoyState,
RectF(0.0f, 24.0f, (float)GetSystemMetrics(SM_CXSCREEN) / 2, (float)GetSystemMetrics(SM_CYSCREEN)),
&format,
&blackBrush);
gOffScreenGraphics->DrawString(
joyStateString.ToStateTabSplitString().c_str(),
-1,
&fontJoyState,
RectF(0.0f, 40.0f, (float)GetSystemMetrics(SM_CXSCREEN) / 2, (float)GetSystemMetrics(SM_CYSCREEN)),
&formatState,
&blackBrush);
gOffScreenGraphics->DrawString(
joyCapsString.ToString(&joyCaps).c_str(),
-1,
&fontJoyCaps,
RectF(0.0f, 100.0f, (float)GetSystemMetrics(SM_CXSCREEN) / 2, (float)GetSystemMetrics(SM_CYSCREEN)),
&format,
&blackBrush);
gOffScreenGraphics->DrawString(
joyInfoExString.ToString(&joyInfoEx).c_str(),
-1,
&fontJoyInfoEx,
RectF((float)GetSystemMetrics(SM_CXSCREEN) / 2, 100.0f, (float)GetSystemMetrics(SM_CXSCREEN) / 2, (float)GetSystemMetrics(SM_CYSCREEN)),
&format,
&blackBrush);
g.DrawImage(gOffScreenBitmap, 0, 0);
return;
}