[lazarus] TToolbar

Marc Weustink weus at quicknet.nl
Thu Dec 9 16:53:42 EST 1999


At 15:56 09-12-99 -0600, you wrote:
>Can I select a COLOR using that API?  I just glanced at it but didn't see
you changing color at all....

Yes. You can use CreatePenIndirect for pens, CreateBrushIndirect for brushes.

>I have to create a DRAWEDGE function (easy) so I'll maybe use that....

If you look at the MoveToEx and LineTo functions, you can add the api:

function TgtkObject.DrawEdge(hdc: HDC; var Rect: TRect; edge: UINT;
grfFlags: Cardinal): Boolean; 
begin
  WriteLN(Format('[TgtkObject.DrawEdge] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
  Result := IsValidDC(DC);
  if Result
  then with PDeviceContext(DC)^ do 
  begin
    if GC = nil
    then begin
      WriteLn('[TgtkObject.DrawEdge] Uninitialized GC');
      Result := False;
    end
    else begin
      // your routines to select the proper lines.....

      // your call to select a color here
      gdk_draw_line(Drawable, GC, a.X, a.Y, b.X, b.Y);
      // your call to select a color here
      gdk_draw_line(Drawable, GC, a.X, b.Y, b.X, a.Y);
      //Etc ....
      Result := True;
    end;
  end;
end;


Or something like that.

Marc







More information about the Lazarus mailing list