Draw ellipse with specify x,y,width, height

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I am trying to draw an ellipse with specify x,y,width, and height for
input argument in C# .net (Visual Studio 2005).

It seem it will not draw for me. What am I missing?

See the code below, thanks.


//CODE

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace test
{
public partial class Form1 : Form
{
public Form1()
{

InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
draw(10, 20, 20, 50);
draw(50, 80, 50, 150);
}

private void draw(int x1, int y1, int w, int h)
{
Graphics g = this.CreateGraphics();
g.FillEllipse(Brushes.Blue, x1, y1, w, h);
}

}
}
.



Relevant Pages

  • Re: Drawing Lines On Panels
    ... You need to hook into the Paint event for the Panel. ... private void panel1_Paint ... int, int, int, int)) is currently supported directly through the CF. So if ... > successfully able to draw a line on any component other then the frame ...
    (microsoft.public.pocketpc.developer)
  • Multi Threaded App - Stack Trace Error
    ... public partial class Form1: Form ... private void Form1_Load ... int iF = 0; ...
    (microsoft.public.dotnet.languages.csharp)
  • Custom Draw LIstCtrl and scrolling
    ... I wrote a custom draw CListCtrl that allow to display different row height on windows mobile ... void CListCtrlCommands::OnSize(UINT nType, int cx, int cy) ... CRect rect; ... GetClientRect(&rect); ...
    (microsoft.public.vc.mfc)
  • Re: Graphics help please
    ... I've got something similar, with a 3D turtle. ... You can also draw a line from to, with the ... final int width = 1024; ... static public void main ...
    (comp.lang.java.programmer)
  • Re: First C++ Project
    ... Neither of these two headers are part of standard C++. ... int main ... > draw line; ... it declares. ...
    (alt.comp.lang.learn.c-cpp)