473,467 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Create 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 978
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
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
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
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
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
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
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
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
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.