TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dmitrij Solov
NA
43
6.6k
Drawing to the screen-new
Nov 10 2016 5:12 PM
Hello, I want to draw an ellipse to the screen and then fill it. I have the following code, but the program doesn't run fast, I have to minimize and to maximize the window in order to draw the ellipse. I just want the program to run fast.
using
System;
using
System.ComponentModel;
using
System.Drawing;
using
System.Windows.Forms;
//Ellipse Issue
namespace
WDrawingToTheScreen
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
{
this
.pictureBox1.Paint +=
new
System.Windows.Forms.PaintEventHandler(
this
.FillEllipseRectangle);
}
private
void
FillEllipseRectangle(
object
sender, PaintEventArgs e)
{
MessageBox.Show(
"very well done!"
);
Pen itsme =
new
Pen(Color.Green, 3);
//Draw the ellipse
int
x = 5;
int
y = 5;
int
width = 200;
int
height = 100;
rect =
new
Rectangle(x, y, width, height);
e.Graphics.DrawEllipse(itsme, rect);
//fill the ellipse
int
x1= 5;
int
y1 = 5;
int
width1 = 200;
int
height1 = 100;
rect1 =
new
Rectangle(x1, y1, width1, height1);
SolidBrush redBrush =
new
SolidBrush(Color.Red);
e.Graphics.FillEllipse(redBrush,
this
.rect1);
}
public
System.Drawing.Rectangle rect {
get
;
set
; }
public
System.Drawing.Rectangle rect1 {
get
;
set
; }
}
}
Reply
Answers (
1
)
C# get the value of certain item in listbox
gridview row color change when condition is true