Click here to Skip to main content
15,904,023 members
Home / Discussions / C#
   

C#

 
GeneralRe: A good way to store this information? Pin
stephen.darling18-Oct-10 5:00
stephen.darling18-Oct-10 5:00 
AnswerRe: A good way to store this information? Pin
W Balboos, GHB20-Oct-10 1:29
W Balboos, GHB20-Oct-10 1:29 
GeneralRe: A good way to store this information? Pin
stephen.darling20-Oct-10 7:40
stephen.darling20-Oct-10 7:40 
QuestionDynamic array of PictureBoxes with scroll-bars? Pin
DaveGriffith15-Oct-10 15:59
DaveGriffith15-Oct-10 15:59 
AnswerRe: Dynamic array of PictureBoxes with scroll-bars? Pin
Luc Pattyn15-Oct-10 17:27
sitebuilderLuc Pattyn15-Oct-10 17:27 
AnswerRe: Dynamic array of PictureBoxes with scroll-bars? Pin
DaveGriffith17-Oct-10 10:33
DaveGriffith17-Oct-10 10:33 
GeneralRe: Dynamic array of PictureBoxes with scroll-bars? Pin
Luc Pattyn17-Oct-10 10:41
sitebuilderLuc Pattyn17-Oct-10 10:41 
GeneralRe: Dynamic array of PictureBoxes with scroll-bars? Pin
forkus200024-Oct-10 19:15
forkus200024-Oct-10 19:15 
GeneralRe: Dynamic array of PictureBoxes with scroll-bars? Pin
Luc Pattyn25-Oct-10 2:09
sitebuilderLuc Pattyn25-Oct-10 2:09 
QuestionEllipse Pin
WebMaster15-Oct-10 15:17
WebMaster15-Oct-10 15:17 
AnswerRe: Ellipse Pin
Richard Andrew x6415-Oct-10 16:16
professionalRichard Andrew x6415-Oct-10 16:16 
GeneralMessage Removed Pin
15-Oct-10 16:30
WebMaster15-Oct-10 16:30 
GeneralRe: Ellipse Pin
Richard Andrew x6415-Oct-10 16:33
professionalRichard Andrew x6415-Oct-10 16:33 
GeneralRe: Ellipse Pin
WebMaster15-Oct-10 16:47
WebMaster15-Oct-10 16:47 
GeneralRe: Ellipse Pin
Richard Andrew x6415-Oct-10 16:53
professionalRichard Andrew x6415-Oct-10 16:53 
GeneralRe: Ellipse Pin
WebMaster15-Oct-10 17:01
WebMaster15-Oct-10 17:01 
GeneralRe: Ellipse Pin
Richard Andrew x6415-Oct-10 17:03
professionalRichard Andrew x6415-Oct-10 17:03 
GeneralRe: Ellipse Pin
Richard Andrew x6415-Oct-10 17:36
professionalRichard Andrew x6415-Oct-10 17:36 
GeneralRe: Ellipse Pin
WebMaster16-Oct-10 8:24
WebMaster16-Oct-10 8:24 
AnswerRe: Ellipse Pin
Not Active16-Oct-10 8:47
mentorNot Active16-Oct-10 8:47 
GeneralRe: Ellipse Pin
WebMaster16-Oct-10 9:02
WebMaster16-Oct-10 9:02 
GeneralRe: Ellipse Pin
Lamrin17-Oct-10 0:09
Lamrin17-Oct-10 0:09 
Hi Friend!

Are you trying to draw an ellipse like this ?

public partial class Form1 : Form
   {
       Rectangle SelectionRectangle = new Rectangle();
       string SelectedShape = "None";

       public Form1()
       {
           InitializeComponent();
       }

       private void Form1_MouseDown(object sender, MouseEventArgs e)
       {
           // If the current selected shape is 'Ellipse', then set the selection
           // rectangle's top-left position to mouse co-ordinates and set the width and
           // height to zero
           if (SelectedShape == "Ellipse")
           {
               SelectionRectangle.Width = 0;
               SelectionRectangle.Height = 0;
               SelectionRectangle.X = e.X;
               SelectionRectangle.Y = e.Y;
           }
       }

       private void Form1_MouseMove(object sender, MouseEventArgs e)
       {
           // If the mouse left button the pressed and the mouse is dragged, then capture
           // the mouse co-ordinates and resize the rectangle
           if (e.Button == MouseButtons.Left)
           {
               SelectionRectangle.Width = e.X - SelectionRectangle.Left; // EndPoint.X - StartPoint.Y;
               SelectionRectangle.Height = e.Y - SelectionRectangle.Top; // EndPoint.Y - StartPoint.Y;
               // ask Windows to redraw the form background
               Invalidate();
               Update();
           }
       }

       private void Form1_MouseUp(object sender, MouseEventArgs e)
       {
           // Capture the mouse position only if the current selected shape is 'Rectangle'
           // Else ignore
           if (SelectedShape == "Ellipse")
           {
               SelectionRectangle.Width = e.X - SelectionRectangle.Left; //EndPoint.X - StartPoint.X;
               SelectionRectangle.Height = e.Y - SelectionRectangle.Top; //EndPoint.Y - StartPoint.Y;
               Invalidate();
               Update();
           }

       }

       // Click 'Button2' to start drawing the ellipse
       private void button2_Click(object sender, EventArgs e)
       {
           SelectedShape = "Ellipse";
       }

       // Click 'Button2' to stop drawing the ellipse
       private void button1_Click(object sender, EventArgs e)
       {
           SelectedShape = "None";
       }

       private void Form1_Paint(object sender, PaintEventArgs e)
       {
           if ((SelectedShape == "Ellipse") && (SelectionRectangle != null))
           {
               Graphics g = e.Graphics;
               g.DrawEllipse(Pens.Black, SelectionRectangle);
               // If you do not want to draw the bounding rectangle, just comment out
               // the next line
               g.DrawRectangle(Pens.Gray, SelectionRectangle);
           }
       }

GeneralRe: Ellipse Pin
WebMaster17-Oct-10 7:57
WebMaster17-Oct-10 7:57 
GeneralRe: Ellipse Pin
WebMaster17-Oct-10 8:05
WebMaster17-Oct-10 8:05 
GeneralRe: Ellipse Pin
Lamrin17-Oct-10 15:46
Lamrin17-Oct-10 15:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.