P
petkowwa
Guest
this is button to draw shapes:
private void drawBtn_Click(object sender, EventArgs e)
{
label1.Text = "Click somewhere to draw shape. The shape drawing when click with mouse.";
option2Moving = false;
option4ShowAreas = false;
Form2 drawoptions = new Form2();
drawoptions.ShowDialog();
}
this is my Shapes class:
abstract class Shapes
{
public int a { get; set; }
public int b { get; set; }
public int c { get; set; }
public Point Location { get; set; }
public Color color { get; set; }
public string PenColor { get; set; }
public string FillColor { get; set; }
public int X1 { get; set; }
public int Y1 { get; set; }
public int X2 { get; set; }
public int Y2 { get; set; }
public abstract void Paint(Graphics graphics);
public abstract bool ConteinsCordinate(Point point);
public abstract double P();
public abstract double S();
}
i have 3 figures: triangle, rectangle and circle, i will post circle class (form example):
class Circle : Shapes
{
public override void Paint(Graphics graphics)
{
using (var Pen = new Pen(color, 2))
{
graphics.DrawEllipse(Pen, Location.X, Location.Y, a, a);
}
}
public override bool ConteinsCordinate(Point point)
{
double radios = a / 2;
double centerx = Location.X + radios;
double centery = Location.Y + radios;
double calculate = Math.Sqrt(((point.X - centerx) * (point.X - centerx)) + ((point.Y - centery) * (point.Y - centery)));
if (calculate > radios)
{
return false;
}
return true;
}
public override double P()
{
return 2 * Math.PI * a / 2;
}
public override double S()
{
return Math.PI * a / 2 * a / 2;
}
}
and my questions are: can someone help me to change color of drawn shapes, i have a button to do that:
private void colorBtn_Click(object sender, EventArgs e)
{
}
but i don't know what write here..
and i have one more question: when it's drawn shapes and i want delete them.. i must press "Remove" button before click on the shape, that i would delete.. can someone help me with that? there is my code for "remove" button:
private void removeBtn_Click(object sender, EventArgs e)
{
label1.Text = "Click on shape to remove it.";
option2Moving = false;
option4ShowAreas = false;
option3Remove = true;
Form2.triangle = false;
Form2.rectangle = false;
Form2.circle = false;
}
Continue reading...
private void drawBtn_Click(object sender, EventArgs e)
{
label1.Text = "Click somewhere to draw shape. The shape drawing when click with mouse.";
option2Moving = false;
option4ShowAreas = false;
Form2 drawoptions = new Form2();
drawoptions.ShowDialog();
}
this is my Shapes class:
abstract class Shapes
{
public int a { get; set; }
public int b { get; set; }
public int c { get; set; }
public Point Location { get; set; }
public Color color { get; set; }
public string PenColor { get; set; }
public string FillColor { get; set; }
public int X1 { get; set; }
public int Y1 { get; set; }
public int X2 { get; set; }
public int Y2 { get; set; }
public abstract void Paint(Graphics graphics);
public abstract bool ConteinsCordinate(Point point);
public abstract double P();
public abstract double S();
}
i have 3 figures: triangle, rectangle and circle, i will post circle class (form example):
class Circle : Shapes
{
public override void Paint(Graphics graphics)
{
using (var Pen = new Pen(color, 2))
{
graphics.DrawEllipse(Pen, Location.X, Location.Y, a, a);
}
}
public override bool ConteinsCordinate(Point point)
{
double radios = a / 2;
double centerx = Location.X + radios;
double centery = Location.Y + radios;
double calculate = Math.Sqrt(((point.X - centerx) * (point.X - centerx)) + ((point.Y - centery) * (point.Y - centery)));
if (calculate > radios)
{
return false;
}
return true;
}
public override double P()
{
return 2 * Math.PI * a / 2;
}
public override double S()
{
return Math.PI * a / 2 * a / 2;
}
}
and my questions are: can someone help me to change color of drawn shapes, i have a button to do that:
private void colorBtn_Click(object sender, EventArgs e)
{
}
but i don't know what write here..
and i have one more question: when it's drawn shapes and i want delete them.. i must press "Remove" button before click on the shape, that i would delete.. can someone help me with that? there is my code for "remove" button:
private void removeBtn_Click(object sender, EventArgs e)
{
label1.Text = "Click on shape to remove it.";
option2Moving = false;
option4ShowAreas = false;
option3Remove = true;
Form2.triangle = false;
Form2.rectangle = false;
Form2.circle = false;
}
Continue reading...