Board index » cppbuilder » Won't draw on my form

Won't draw on my form

Hi,
I'm trying to test this in my form but
it doesn't draw anything.
I need to later port this to plain C (Borland C++).

Am I missing something?

void __fastcall TForm1::Button1Click(TObject *Sender)
{
      HWND hWnd = Application->Handle;
      HDC  hDC = GetDC(hWnd);

      Arc(hDC,
      50, 50, 150, 150,
      150, 50,
      50, 50);

      MoveToEx(hDC, 0, 20, NULL);
      LineTo(hDC, 100, 20);
      ReleaseDC( hWnd, hDC);

Quote
}

 

Re:Won't draw on my form


Quote
>      HWND hWnd = Application->Handle;

Change to:

HWND hWnd = GetForegroundWindow();

Armando

Re:Won't draw on my form


Hi !

<Vic Bucklings> a crit dans le message : 80tj8f$5t...@forums.borland.com...

Quote
> Hi,
> I'm trying to test this in my form but
> it doesn't draw anything.
> I need to later port this to plain C (Borland C++).

> Am I missing something?

    Why don't you use the Canvas property of your form ?

    I think it will be easier.

        Zylwee.

Other Threads