using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace lab12
{
public partial class PatternPenDialog : Form
{
//Form1 MainForm = new Form1();
Pen My_Pen;
float[] Patter = new float[] { 1.0F, 1.0F, 1.0F, 1.0F };
float OffSet = new float();
public PatternPenDialog()
{
InitializeComponent();
My_Pen = new Pen(Brushes.Black, 3);
OffSet = 1.0F;
My_Pen.DashPattern = Patter;
}
private void button1_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void button2_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
private void Drawing(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(My_Pen, new Point(50, 100), new Point(250, 100));
}
public float[] GetPenPattern()
{
return Patter;
}
public float GetPenOffSet()
{
return OffSet;
}
private void ValuePatternChange(object sender, EventArgs e)
{
NumericUpDown temp = sender as NumericUpDown;
Patter[Convert.ToInt32(temp.Tag)] = (float)temp.Value;
My_Pen.DashPattern = Patter;
Invalidate();
}
private void DashOffSetChange(object sender, EventArgs e)
{
NumericUpDown temp = sender as NumericUpDown;
OffSet = (float)temp.Value;
My_Pen.DashOffset = OffSet;
Invalidate();
}
}
}