Time:09-23
CodePudding user response:
using TextOut output text on the screen, there will be a gray, the color of a word, how can the output word without gray?
with Form, Print or PictureBox. Printf instead?
closed control panel configuration associated with literal definition in it?
# include & lt; Windows. H> #include Using the namespace Gdiplus; # pragma comment (lib, "gdiplus. Lib") VOID OnPaint (HDC HDC) {Graphics Graphics (HDC); Pen Pen (Color (255, 0, 0, 255)); FontFamily FontFamily (L "tahoma"); The Font Font (& amp; FontFamily, 12, FontStyleRegular UnitPixel); PointF pointF1 (30.0 f to 60.0 f), pointF2 (230.0 f to 60.0 f); SolidBrush SolidBrush (Color (255, 0, 0, 255)); StringFormat StringFormat; WCHAR testString []=L "Hello034 StringFormat. SetFormatFlags (StringFormatFlagsDirectionVertical); Graphics. SetSmoothingMode (SmoothingModeDefault); Graphics. DrawLine (& amp; Pen, 0, 0, 200, 100); Graphics. DrawEllipse (& amp; Pen, 10, 10, 190, 90); Graphics. SetTextRenderingHint (TextRenderingHintSystemDefault); Graphics. DrawString (testString, 1, & amp; The font, pointF1, & amp; StringFormat, & amp; SolidBrush); Graphics. SetSmoothingMode (SmoothingModeHighQuality); Graphics. DrawLine (& amp; Pen, 200, 0, 400, 100); Graphics. DrawEllipse (& amp; Pen, 210, 10, 190, 90); Graphics. SetTextRenderingHint (TextRenderingHintAntiAlias); Graphics. DrawString (testString, 1, & amp; The font, pointF2, & amp; StringFormat, & amp; SolidBrush); } LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM) {HDC HDC. PAINTSTRUCT ps; The switch (the message) {In case the WM_PAINT: HDC=BeginPaint (hWnd, & amp; Ps); OnPaint (HDC); EndPaint (hWnd, & amp; Ps); return 0; Case WM_DESTROY: The PostQuitMessage (0); return 0; Default: Return DefWindowProc (hWnd, message, wParam, lParam); } } INT WINAPI WinMain (HINSTANCE HINSTANCE, HINSTANCE, PSTR, INT iCmdShow) {The HWND HWND; MSG MSG. WNDCLASS WNDCLASS; The GdiplusStartupInput GdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup (& amp; GdiplusToken, & amp; GdiplusStartupInput, NULL); WndClass. Style=CS_HREDRAW | CS_VREDRAW; WndClass. LpfnWndProc=WndProc; WndClass. CbClsExtra=0; WndClass. CbWndExtra=0; WndClass. HInstance=hInstance; WndClass. HIcon=LoadIcon (NULL, IDI_APPLICATION); WndClass. HCursor=LoadCursor (NULL, IDC_ARROW); WndClass. HbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH); WndClass. LpszMenuName=NULL; WndClass. LpszClassName=TEXT (" GettingStarted "); RegisterClass (& amp; WndClass); HWnd=CreateWindow (The TEXT (" GettingStarted "),//the window class name The TEXT (" Getting Started "),//window caption WS_OVERLAPPEDWINDOW,//the window style CW_USEDEFAULT,//initial position x CW_USEDEFAULT,//initial position y CW_USEDEFAULT,//initial size x CW_USEDEFAULT,//initial y size NULL,//the parent window handle Window menu handle NULL,//HInstance,//program instance handle NULL);//creation parameters ShowWindow (hWnd, iCmdShow); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
Page link:https//www.codepudding.com/Softwareengineering/23941.html