var
winDC: HDC;
Font, oldFont: HFONT;
s: String;
r: TRECT;
myPen, oldPen: HPEN;
begin
r.Top := 10;
r.Left := 10;
r.Right := 100;
r.Bottom := 50;
s := 'dkfjavgkdjfbvkjadf';
winDC := GetDC(
Handle);
SetBkColor(winDC,
RGB(255,0,0));
SetTextColor(winDC,
RGB(0,255,0));
Font := CreateFont(-MulDiv(12, GetDeviceCaps(winDC, LOGPIXELSY), 72),
0, 0, 0, 0, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,
'MS Sans Serif');
oldFont := SelectObject(winDC, Font);
DrawText(winDC, PChar(s), Length(s), r, DT_TOP or DT_RIGHT);
SelectObject(winDC, oldFont);
DeleteObject(Font);
myPen := CreatePen(PS_DASHDOTDOT, 1,
RGB(0,255,0));
oldPen := SelectObject(winDC, myPen);
MoveToEx(winDC, 50, 50, nil);
LineTo(winDC, 150,150);
SelectObject(winDC, oldPen);
DeleteObject(myPen);
ReleaseDC(
Handle, winDC);
end;