Clicky

so far I did this much. I can compile it but when I run it, I don't see anything


procedure DrawBowTie( const xPaper: TImage ;   // to draw upon
                      const xColor: TColor ) ; // the pen color

// Procedure to draw a BowTie on an Image.
// The BowTie occupies from 1/4 to 3/4 of the Width of the Image,
// and from 1/4 to 3/4 of the Height, with the pinch in the middle
// of the Image.
// Coordinates of the vertexes are calculated from the 1/4 values,
// plus value, Mid, for the pinch area.

var W1Q, H1Q, Mid: integer ;
begin
     W1Q := xPaper.Width div 4 ;  // 1/4 of the Width
     //  2 * W1Q is 2/4 (or 1/2) of the Width
     //  3 * W1Q is 3/4          of the Width

     H1Q := xPaper.Height div 4 ; // 1/4 of the Height
     //  2 * H1Q is 2/4 (or 1/2) of the Height
     //  3 * H1Q is 3/4          of the Height

     Mid := xPaper.Height div 20; // 1/20 of the Height (for Bow "Pinch")

     xPaper.Canvas.Pen.Color := xColor ;  // set drawing color

     xPaper.Canvas.Polygon( [point(  W1Q,  H1Q),      //upper left
                             point(2*W1Q,2*H1Q-Mid),  //upper middle pinch
                             point(3*W1Q,  H1Q),      //upper right
                             point(3*W1Q,3*H1Q),      //lower right
                             point(2*W1Q,2*H1Q+Mid),  //lower middle pinch
                             point(  W1Q,3*H1Q)] )    //lower left

end ;

asked 10/25/2010 08:02

ali_t89's gravatar image

ali_t89 ♦♦


7 Answers:
FYI, I ran your code on Delphi 7, all was fine.
link
kambiz's gravatar image

kambiz

I don't have Delphi 7..but thanks anyways. I don't understand why a Bowtie Polygon doesn't show when I do it!
link
ali_t89's gravatar image

ali_t89

What's version of your Delphi?
Have you tried to draw on an empty TImage instance?
link
kambiz's gravatar image

kambiz

im using the delphi application on borland development studio 2006 it doesn't clarify the version of delphi but it says borland version 10.0
link
ali_t89's gravatar image

ali_t89

no I havent tried to draw anything because when I run it. It doesn't have anything to draw on. TImage doesn't show up
link
ali_t89's gravatar image

ali_t89

Maybe by mistake you set the visible property of TImage to False.

I checked your code by dropping a TImage on a form and calling your function inside OnCreate event of the form.

procedure TForm1.FormCreate(Sender: TObject);
begin
  DrawBowTie(Image1, clBlack);
end;

 
The screenshot
The screenshot
 
link
kambiz's gravatar image

kambiz

thanks man now I have the image
link
ali_t89's gravatar image

ali_t89

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×1

Asked: 10/25/2010 08:02

Seen: 460 times

Last updated: 10/25/2010 03:19