Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace ellipse
- {
- public partial class Form1 : Form
- {
- public int xE = 200;
- public int yE = 200;
- public int widthE = 100;
- public int heightE = 60;
- Pen pen;
- Graphics g;
- private void trackBar2_Scroll(object sender, EventArgs e)
- {
- if (checkBox1.Checked)
- {
- trackBar2.Value = trackBar1.Value;
- trackBar1.Value = trackBar2.Value;
- }
- widthE = trackBar1.Value * 10;
- heightE = trackBar2.Value * 10;
- g.Clear(Color.White);
- g.DrawEllipse(pen, xE - widthE, yE - heightE, widthE * 2, heightE * 2);
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox1.Checked)
- {
- trackBar2.Value = trackBar1.Value;
- trackBar2_Scroll(sender, e);
- }
- }
- public Form1()
- {
- InitializeComponent();
- pen = new Pen(Color.Black, 1);
- g = this.CreateGraphics();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment