Files
PiperFeladat/Feladat1/UI/MainWindow/LineDrawer.cs
2025-09-28 00:53:10 +02:00

33 lines
815 B
C#

using Gdk;
using Gtk;
namespace Feladat1.UI.MainWindow;
public partial class MainWindow
{
private DrawingArea canvas;
private const string canvasId = "canvas";
private Adjustment lineWidthAdjustment;
private const string lineWidthAdjustmentId = "adjustment";
private double[] pointX = { 100, 100 };
private double[] pointY = {200, 200};
private double lineWidth = 5;
private void Draw(DrawingArea drawingArea, Cairo.Context cr, int width, int height)
{
cr.SetSourceRgb(1, 1, 1);
cr.Arc(pointX[0], pointX[1], 10, 0, 2 * Math.PI);
cr.Arc(pointY[0], pointY[1], 10, 0, 2 * Math.PI);
cr.Fill();
cr.LineWidth = lineWidth;
cr.MoveTo(pointX[0], pointX[1]);
cr.LineTo(pointY[0], pointY[1]);
cr.Stroke();
}
}