Thema: Delphi wiedermal VCC - > Delphi

Einzelnen Beitrag anzeigen

Horst0815

Registriert seit: 23. Mai 2011
Ort: Görlitz
150 Beiträge
 
Delphi XE Starter
 
#1

wiedermal VCC - > Delphi

  Alt 30. Okt 2011, 19:55
hab einige Probleme folgenden cpp Code nach Delphi zu konvertieren

Code:
void CScanPassDlg::OnPaint()
{
   if (IsIconic())
   {
      CPaintDC dc(this); // device context for painting

      SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

      // Center icon in client rectangle
      int cxIcon = GetSystemMetrics(SM_CXICON);
      int cyIcon = GetSystemMetrics(SM_CYICON);
      CRect rect;
      GetClientRect(&rect);
      int x = (rect.Width() - cxIcon + 1) / 2;
      int y = (rect.Height() - cyIcon + 1) / 2;

      // Draw the icon
      dc.DrawIcon(x, y, m_hIcon);
   }
   else
   {
      CDialog::OnPaint();
   }
}

meine Versuche mit




Delphi-Quellcode:
procedure TForm1.FormPaint(Sender: TObject);
var
  cxIcon, cyIcon, X, Y: Integer;
  rect: TRECT;
  DC: HDC;
begin
  if IsIconic(m_hWnd) then
  begin
    // CPaintDC dc(this); // device context for painting
    // SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0);
    // Center icon in client rectangle
    cxIcon := GetSystemMetrics(SM_CXICON);
    cyIcon := GetSystemMetrics(SM_CYICON);
    rect := GetClientRect;
    X := (rect.Width - cxIcon + 1) div 2;
    Y := (rect.Height - cyIcon + 1) div 2;
    DC.DrawIcon(X, Y, m_hIcon);
  end
  else
    exit;
end;
scheitern an

DC: HDC; erzeugt [DCC Fehler] main.pas(118): E2007 Konstante oder Typenbezeichner erwartet

wo ist das Problem
  Mit Zitat antworten Zitat