473,511 Members | 15,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why so much trouble with ellipses?

In a recent post of mine I mentioned the inaccurate shapes drawn by
FillEllipse. In the response that I recieved I was told that DrawArc had
less problems, which I found to be true (I have been using DrawEllipse, but
they seem to have the same results when drawing a complete 360). However,
even with these methods, there are situations where the results are not even
symmetric along both axes (my best example of this is with a width and
height of 6). I know enough about math and computers to be able to figure
out how to write a simple method to create a basic circle or ellipse, so I'm
not going to ask anyone to tell me how to fix it (even though that would be
nice), but I am going to ask why couldn't Microsoft make this simple method
themselves? It's not like this is the first time they ever had to do it.
Heck, they could have just borrowed some code from Paint, I know that that
makes correct circles/ellipses. Do they plan to fix this in a future
version, or is GDI+ such a small part of .NET that they don't care? (I will
admit that I am guilty of still using .NET 1.1, but I still think it should
have been a simple enough task that they could have done it right by now).
What do all of you think?
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jan 13 '06 #1
6 1096
Nathan,

You make me curious I see a lot of crossposting adresses. Feel free to do
that.

The in my idea real newsgroup for this question

microsoft.public.dotnet.framework.drawing

is not in it.

What is the reason for that?

Cor
Jan 13 '06 #2
I am not currently subscribed to that newsgroup, so I guess I forgot to post
to it. But now that I know about it, I guess it would be one of, if not the,
best group for my question. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nathan,

You make me curious I see a lot of crossposting adresses. Feel free to do
that.

The in my idea real newsgroup for this question

microsoft.public.dotnet.framework.drawing

is not in it.

What is the reason for that?

Cor

Jan 13 '06 #3
Hi Nathan

these two thing should help you, you don't need to use them both, it seems
to me that setting the g.SmoothingMode gives better results.

g.PixelOffsetMode = Drawing2D.PixelOffsetMode.Half

g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:uI**************@TK2MSFTNGP14.phx.gbl...
I am not currently subscribed to that newsgroup, so I guess I forgot to post to it. But now that I know about it, I guess it would be one of, if not the, best group for my question. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nathan,

You make me curious I see a lot of crossposting adresses. Feel free to do that.

The in my idea real newsgroup for this question

microsoft.public.dotnet.framework.drawing

is not in it.

What is the reason for that?

Cor


Jan 16 '06 #4
I tried all of the settings for each of these, but none of them made
ellipses with a radius of 6 the same on all sides, the closest ones were the
same as not setting the settings at all. I am assuming that this would be
true for other radii as well, but since DrawEllipse already gave me good
ellipses for all the radii I tried, I didn't bother testing anything other
than 6. In other words, back to the System.Drawing board.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:eS*************@TK2MSFTNGP14.phx.gbl...
Hi Nathan

these two thing should help you, you don't need to use them both, it seems
to me that setting the g.SmoothingMode gives better results.

g.PixelOffsetMode = Drawing2D.PixelOffsetMode.Half

g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:uI**************@TK2MSFTNGP14.phx.gbl...
I am not currently subscribed to that newsgroup, so I guess I forgot to

post
to it. But now that I know about it, I guess it would be one of, if not

the,
best group for my question. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> Nathan,
>
> You make me curious I see a lot of crossposting adresses. Feel free to do > that.
>
> The in my idea real newsgroup for this question
>
> microsoft.public.dotnet.framework.drawing
>
> is not in it.
>
> What is the reason for that?
>
> Cor
>



Jan 17 '06 #5
Hi Nathan,

if I add g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality to the sample
I posted a couple of days ago, I get nice ellipses with drawellipse and
fillellipse for all radii from 4 to 14 (haven't tested any further)

Grtz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:#$**************@TK2MSFTNGP14.phx.gbl...
I tried all of the settings for each of these, but none of them made
ellipses with a radius of 6 the same on all sides, the closest ones were the same as not setting the settings at all. I am assuming that this would be
true for other radii as well, but since DrawEllipse already gave me good
ellipses for all the radii I tried, I didn't bother testing anything other
than 6. In other words, back to the System.Drawing board.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:eS*************@TK2MSFTNGP14.phx.gbl...
Hi Nathan

these two thing should help you, you don't need to use them both, it seems to me that setting the g.SmoothingMode gives better results.

g.PixelOffsetMode = Drawing2D.PixelOffsetMode.Half

g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:uI**************@TK2MSFTNGP14.phx.gbl...
I am not currently subscribed to that newsgroup, so I guess I forgot to

post
to it. But now that I know about it, I guess it would be one of, if not

the,
best group for my question. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> Nathan,
>
> You make me curious I see a lot of crossposting adresses. Feel free
to do
> that.
>
> The in my idea real newsgroup for this question
>
> microsoft.public.dotnet.framework.drawing
>
> is not in it.
>
> What is the reason for that?
>
> Cor
>



Jan 17 '06 #6
Here's the example again because it wasn't origanly posted in this thread

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myBmp As New Bitmap(450, 450)
Dim g As Graphics
g = Graphics.FromImage(myBmp)
g.Clear(Color.Black)
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
Dim posX As Integer = 10
Dim myWidth, myHeight As Integer
myWidth = 4
myHeight = 4
For i As Integer = 0 To 21
If i <= 10 Then
drawCircles(g, 0, posX, myWidth, myHeight)
Else
drawCircles(g, 1, posX, myWidth, myHeight)
End If
posX += 20
myWidth += 1
myHeight += 1
If i = 10 Then
myWidth = 4
myHeight = 4
End If
Next
g.Dispose()
PictureBox1.Image = myBmp
myBmp.Save("c:\testEllipse.bmp", Drawing.Imaging.ImageFormat.Bmp)
MsgBox("c:\testEllipse.bmp Saved", MsgBoxStyle.Information, "Saved")
End Sub

Private Sub drawCircles(ByVal g As Graphics, ByVal drawType As Integer,
ByVal x As Integer, ByVal width As Integer, _ ByVal _ height As Integer)
Dim intY As Integer = 5
For i As Integer = 0 To 20
Select Case drawType
Case 0
g.FillEllipse(Brushes.LawnGreen, x, intY, width, height)
Case 1
g.DrawEllipse(Pens.LawnGreen, x, intY, width, height)
End Select
intY += 18
Next
End Sub

Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:#$**************@TK2MSFTNGP14.phx.gbl...
I tried all of the settings for each of these, but none of them made
ellipses with a radius of 6 the same on all sides, the closest ones were the same as not setting the settings at all. I am assuming that this would be
true for other radii as well, but since DrawEllipse already gave me good
ellipses for all the radii I tried, I didn't bother testing anything other
than 6. In other words, back to the System.Drawing board.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:eS*************@TK2MSFTNGP14.phx.gbl...
Hi Nathan

these two thing should help you, you don't need to use them both, it seems to me that setting the g.SmoothingMode gives better results.

g.PixelOffsetMode = Drawing2D.PixelOffsetMode.Half

g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:uI**************@TK2MSFTNGP14.phx.gbl...
I am not currently subscribed to that newsgroup, so I guess I forgot to

post
to it. But now that I know about it, I guess it would be one of, if not

the,
best group for my question. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> Nathan,
>
> You make me curious I see a lot of crossposting adresses. Feel free
to do
> that.
>
> The in my idea real newsgroup for this question
>
> microsoft.public.dotnet.framework.drawing
>
> is not in it.
>
> What is the reason for that?
>
> Cor
>



Jan 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2050
by: Erik Zawadzki | last post by:
I'm trying to write a wrapper functions for a function that uses the stdarg.h ellipses notation for variable arguments. In essense, if the original function is: void foo(int n, ...){ //body }...
6
3764
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
4847
by: RCS | last post by:
Perhaps you are familiar with the old: <nobr style="OVERFLOW:hidden;width:100px;TEXT-OVERFLOW:ellipsis">blah blah blahblah blah blah blah</nobr> technique.. Well, within a gridview, if I use...
4
23437
by: jawolter | last post by:
I have text that is too long to nicely fit on a given page, so I want to add ellipses to the end that dynamicaly resize based on the person resizing the page width. If you hover it would show the...
6
1094
by: Nathan Sokalski | last post by:
In a recent post of mine I mentioned the inaccurate shapes drawn by FillEllipse. In the response that I recieved I was told that DrawArc had less problems, which I found to be true (I have been...
5
5565
by: Andrew Poulos | last post by:
Is there a right/best way to draw an ellipse using Canvas? (With VML there's the v:oval element which makes the exercise trivial). I tried drawing a 360 degree arc (a circle) and then scaling it...
18
1589
by: hyperboogie | last post by:
Hello all I'm pretty new to C, so please accept my apologies in advance :-) I'm trying to allocate space for an array of pointers to strings (which are accepted as ellipses) inside a while...
4
3019
by: DM | last post by:
Hi All, I've recently been given the task of modifying some legacy VB 6 code to do with drawing rotated ellipses on a map at different zoom levels. I guess I could find a formula for drawing...
0
7245
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.