Advertisement

01.28.2007 at 06:02PM PST, ID: 22140094
[x]
Attachment Details

How to draw a perpendicular line?

Asked by Manjesh in Graphics & Game Programming

Tags: line, perpendicular, draw

Hi All,
  I would like draw a line from a given POINT to any other given shape like LINE or ARC at 90 degrees( Rigth angle ) . Is there any C# graphics command which would help acheive this. I have experimented with GraphicsPath , Region.etc.. but could not come up with a solution.

In the below mentioned sample code , I would like to draw a perpendicular line from an given point to anyside of the rectangle.

Sample Code

        private void button1_Click(object sender, EventArgs e)
        {

            Graphics g = this.CreateGraphics();
            Matrix m = new Matrix();
            m.Rotate(25); // axis of rotation..

            GraphicsPath Path = new GraphicsPath();
            Path.AddRectangle(new Rectangle(200, 100, 200, 200));
            PointF[] regionPts = Path.PathPoints;

            m.TransformPoints( regionPts );

            Brush b = new SolidBrush(Color.Beige);

            g.FillPolygon(b, regionPts);
           
        }

If experts could guide me regarding the problem it would be great.


Thanks for your earliest attention.

                        . (Given  Point)                                             . (Given point)
                        |                                                                 \                                                
                        |                                                                   \  ( Line I want to draw)
                        | ( Line I want to draw )                                    \        /                                
                        |  90 Degree                                                      \ 90 / ( Given Arc )
         -----------------------------( Given Line )                                  \  /
                                                                                                    /
                                                                                                  / Start Free Trial
[+][-]02.02.2007 at 11:24AM PST, ID: 18455308

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.02.2007 at 12:11PM PST, ID: 18455717

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.02.2007 at 12:14PM PST, ID: 18455737

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2007 at 03:35PM PST, ID: 18472326

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2007 at 06:15PM PST, ID: 18473089

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.06.2007 at 08:35AM PST, ID: 18477434

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Graphics & Game Programming
Tags: line, perpendicular, draw
Sign Up Now!
Solution Provided By: JoseParrot
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.08.2007 at 02:22PM PST, ID: 18497792

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.08.2007 at 10:35AM PST, ID: 18681350

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32