###### Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

Deciding to stick with EE.

Mohamed Asif

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
###### Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

# How do I create and draw a BowTie polygon on Delphi

Delphi
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 ;