Home > Software engineering >  How to use the TextOut output without a word of gray?
How to use the TextOut output without a word of gray?

Time:09-23

Using TextOut output text on the screen, there will be a gray, the color of a word, how can the output word without gray?

CodePudding user response:

refer to the original poster xxxcyy 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?

Vector fonts when zooming in or out, it should do "smoothing", of course can produce some of the "color",

You can try the output to a buffer "DC", then binarization processing, and output to the display,
But it may appear obvious sawtooth, smaller may distortion is serious,

CodePudding user response:

Image way according to see directly

CodePudding user response:

Sure was using GDI output, GDI is pure tooth of ribbon, but also the background color,
Feel you output the text of transparency, adjust color, see is RGB or ARGB,

CodePudding user response:

VB 6.0
Declare the Function TextOutA Lib "gdi32" (ByVal HDC As Long, ByVal nXStart As Long, ByVal nYStart As Long, ByVal lpString As String, ByVal cchString As Long) As Long

Directly on the HDC operation
TextOut frmPeerB. HDC, (cx) iWidth - sTextSize./2, 1, tmp_string, AskLength (tmp_string)

CodePudding user response:

FrmPeerB. The Font="bold"
FrmPeerB. FontSize=20
FrmPeerB. ForeColor=RGB (255, 255, 255)
Tmp_string="test"

CodePudding user response:

Close the control panel configuration related to word definition in it?

CodePudding user response:

With the Form. A Print or a PictureBox. Printf instead?

CodePudding user response:

refer to 7th floor zhao4zhong1 response:
with Form, Print or PictureBox. Printf instead?

There is a gray output

CodePudding user response:

refer to 6th floor zhao4zhong1 response:
closed control panel configuration associated with literal definition in it?

For example:
Under WinXP, my computer, properties, advanced, performance, setting, visual effects, smooth edge of the screen font?

CodePudding user response:

Or GDI +,
 # 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
  • Related