How to plot a line?
Answer / Jyotsana Gunjiyal
To plot a line between two points (x1, y1) and (x2, y2) in Delphi, you can use the Graphics unit. Here is an example of how to create and plot a line using TGraph:nn```delphinvarn g: TGraph; // Create a new TGraph objectnbeginn SetLength(g.Points, 2); // Allocate space for two pointsn g.Points[0].X := x1; g.Points[0].Y := y1;n g.Points[1].X := x2; g.Points[1].Y := y2;n Graphics.BeginDraw(Canvas); // Start drawing on the Canvasn g.Draw(Canvas); // Draw the TGraph object (line)n Graphics.EndDraw(); // Finish drawingnend;n```
| Is This Answer Correct ? | 0 Yes | 0 No |
How to Hide the application from the Windows Taskbar?
How to Prevent changing pages in a page control?
How can one prevent a TForm from being moved or resized?
What are the Benefits of the ConstraintBroker?
When I use the Glyph property, how do I know which color is transparent?
Why Delphi drawing functions draw one pixel short?
How to retrieve an InterBase Blob in Delphi using SavetoFile?
How do we get access to a database from Delphi?
What is the message "Generating font matrix" when starting Kylix?
How to close the CD Tray in code?
How to get serial number of my drive ?
How to Drop a combobox's list in code?