Delphi achieved using the Windows GDI text italic

Delphi achieved using the Windows GDI text italic
Summary
Delphi achieved using the Windows GDI text italic

TForm1.FormPaint Procedure (Sender: TObject);
var
  FLogFont: tagLogFontW;
  hTempFont, hPrevFont: the HFONT; // font handle
  hTempDC: HDC; // device context or graphics device handle
  TempString: string; // Text output
the begin
  FLogFont. lfHeight: = 10; // character height
  FLogFont.lfWidth: = 10; // word width
  FLogFont.lfWeight: = 1; // font stroke thickness extent
  FLogFont.lfUnderline: = 0; // not underlined
  FLogFont.lfStrikeOut: = 0 ; // no strikethrough
  FLogFont.lfItalic: = 0; // no italics
  FLogFont.lfCharSet: = GB2312_CHARSET; // characters
  FLogfont.lfEscapement: = 450; // slope
  // FLogFont.lfOrientation: = 450; / / values with the direction of inclination
  FLogFont.lfFaceName: = 'Arial'; Font name //
  // Create logical Font
  hTempFont: = CreateFontIndirect (FLogFont);
  TempString: = 'test';

  hTempDC: = GetDC (Handle); // remove the device window the current font, and replaced with a new Font
  hPrevFont: = SelectObject (hTempDC, hTempFont ); // set the device window text color
  SetTextColor (hTempDc, clRed);
  the TextOut (hTempDc , 200 is, 200 is, the PChar (tempString), the Length (tempString));
  the SelectObject (hTempDc, hPrevFont);
  the DeleteObject (hTempFont);
  the ReleaseDC (the Handle, hTempDC);
End;

Guess you like

Origin www.cnblogs.com/blogpro/p/11426661.html