Feladat2 done
This commit is contained in:
32
Feladat1/UI/MainWindow/LineDrawer.cs
Normal file
32
Feladat1/UI/MainWindow/LineDrawer.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user