本文整理汇总了C++中StringFormat::GenericTypographic方法的典型用法代码示例。如果您正苦于以下问题:C++ StringFormat::GenericTypographic方法的具体用法?C++ StringFormat::GenericTypographic怎么用?C++ StringFormat::GenericTypographic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringFormat
的用法示例。
在下文中一共展示了StringFormat::GenericTypographic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WndProc
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code that uses hdc here...
{
Graphics graphics(hdc);
Color color;
color.SetFromCOLORREF(params.m_ccBackground.rgbResult);
graphics.Clear(color);
HFONT fnIndirect = CreateFontIndirect(params.m_cf.lpLogFont);
Font font(hdc, fnIndirect);
if (params.m_bAntialiasing)
graphics.SetSmoothingMode(SmoothingModeHighQuality);
Matrix matrix;
RectF rect;
graphics.MeasureString(params.m_text.c_str(), params.m_text.length(), &font, params.m_pStart, &rect);
matrix.Translate(params.m_pStart.X + rect.Width / 2, params.m_pStart.Y + rect.Height / 2);
matrix.Rotate(params.m_fRotAngle);
matrix.Scale(params.m_fScale, params.m_fScale, MatrixOrderAppend);
graphics.MultiplyTransform(&matrix);
StringFormat strformat;
GraphicsPath path;
FontFamily fnFamily;
font.GetFamily(&fnFamily);
path.AddString(params.m_text.c_str(), params.m_text.length(), &fnFamily, font.GetStyle(), font.GetSize(), PointF(-rect.Width / 2, -rect.Height / 2), strformat.GenericTypographic());
color.SetFromCOLORREF(params.m_ccCircuit.rgbResult);
Pen pen(color, 3);
pen.SetLineJoin(LineJoinRound);
graphics.DrawPath(&pen, &path);
color.SetFromCOLORREF(params.m_ccFill.rgbResult);
SolidBrush brush(color);
graphics.FillPath(&brush, &path);
Region region(&path);
hRgn = region.GetHRGN(&graphics);
graphics.ResetTransform();
RECT rc;
GetWindowRect(hWnd, &rc);
POINT pt;
pt.x = rc.left;
pt.y = rc.top;
ScreenToClient(hWnd, &pt);
matrix.Translate((REAL)-pt.x, (REAL)-pt.y, MatrixOrderAppend);
region.Transform(&matrix);
HRGN hRgnFr = region.GetHRGN(&graphics);
OffsetRect(&rc, -rc.left, -rc.top);
/*HRGN hRgnWnd = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
CombineRgn(hRgn, hRgn, hRgnWnd, RGN_XOR);
CombineRgn(hRgnFr, hRgnFr, hRgnWnd, RGN_XOR);*/
SetWindowRgn(hWnd, params.m_bNonRectRg ? hRgnFr : NULL, TRUE);
}
EndPaint(hWnd, &ps);
}
//.........这里部分代码省略.........