All pastes #145861 Raw Edit

Gopneg

public text v1 · immutable
#145861 ·published 2006-08-23 05:36 UTC
rendered paste body

procedure TForm1.Button1Click(Sender: TObject);
var DC: HDC;
    hWindows: DWORD;
    hToolBar: DWORD;
    hCombo: DWORD;
    hFnt: HFONT;
    hFntOld: HFONT;
    Font: TFont;
begin
  DC := ComboBox1.Canvas.Handle;// {}GetDC(hCombo);
  Font := TFont.Create;
  hFntOld := CreateFont(12, 6, 0, 0, 10, 1, 1, 1, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH or FF_MODERN, 'Arial');
  try
    hFnt := SelectObject(DC, hFntOld);
    if hFnt = 0 then
       begin
         ShowMessage(SysErrorMessage(GetLastError));
         exit;
       end;
    Font.Handle := hFnt;
    Label1.Caption := Font.Name;
  finally
    DeleteObject(hFntOld);
    Font.Free;
  end;

  ReleaseDC(hCombo, DC);
end;