473,671 Members | 2,271 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********@hotm ail.com
http://www.nathansokalski.com/
Jan 13 '06 #1
6 1099
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.publi c.dotnet.framew ork.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********@hotm ail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.publi c.dotnet.framew ork.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.PixelOffsetMo de = Drawing2D.Pixel OffsetMode.Half

g.SmoothingMode = Drawing2D.Smoot hingMode.HighQu ality

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********@hot mail.com> schreef in bericht
news:uI******** ******@TK2MSFTN GP14.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********@hotm ail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.publi c.dotnet.framew ork.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********@hotm ail.com
http://www.nathansokalski.com/

"Peter Proost" <pp*****@nospam .hotmail.com> wrote in message
news:eS******** *****@TK2MSFTNG P14.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.PixelOffsetMo de = Drawing2D.Pixel OffsetMode.Half

g.SmoothingMode = Drawing2D.Smoot hingMode.HighQu ality

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********@hot mail.com> schreef in bericht
news:uI******** ******@TK2MSFTN GP14.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********@hotm ail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.publi c.dotnet.framew ork.drawing
>
> is not in it.
>
> What is the reason for that?
>
> Cor
>



Jan 17 '06 #5
Hi Nathan,

if I add g.SmoothingMode = Drawing2D.Smoot hingMode.HighQu ality 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********@hot mail.com> schreef in bericht
news:#$******** ******@TK2MSFTN GP14.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********@hotm ail.com
http://www.nathansokalski.com/

"Peter Proost" <pp*****@nospam .hotmail.com> wrote in message
news:eS******** *****@TK2MSFTNG P14.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.PixelOffsetMo de = Drawing2D.Pixel OffsetMode.Half

g.SmoothingMode = Drawing2D.Smoot hingMode.HighQu ality

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********@hot mail.com> schreef in bericht
news:uI******** ******@TK2MSFTN GP14.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********@hotm ail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.publi c.dotnet.framew ork.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim myBmp As New Bitmap(450, 450)
Dim g As Graphics
g = Graphics.FromIm age(myBmp)
g.Clear(Color.B lack)
g.SmoothingMode = Drawing2D.Smoot hingMode.HighQu ality
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.Ima ge = myBmp
myBmp.Save("c:\ testEllipse.bmp ", Drawing.Imaging .ImageFormat.Bm p)
MsgBox("c:\test Ellipse.bmp Saved", MsgBoxStyle.Inf ormation, "Saved")
End Sub

Private Sub drawCircles(ByV al 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(B rushes.LawnGree n, x, intY, width, height)
Case 1
g.DrawEllipse(P ens.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********@hot mail.com> schreef in bericht
news:#$******** ******@TK2MSFTN GP14.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********@hotm ail.com
http://www.nathansokalski.com/

"Peter Proost" <pp*****@nospam .hotmail.com> wrote in message
news:eS******** *****@TK2MSFTNG P14.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.PixelOffsetMo de = Drawing2D.Pixel OffsetMode.Half

g.SmoothingMode = Drawing2D.Smoot hingMode.HighQu ality

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********@hot mail.com> schreef in bericht
news:uI******** ******@TK2MSFTN GP14.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********@hotm ail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.publi c.dotnet.framew ork.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
2065
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 } I want to write a function like:
6
3784
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 one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
3
4855
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 this technique for a field, it just sort of ignores it. If I isolate out this line in a seperate .html file, it works as expected. Also, if I do a view source on the resultant output from my .aspx page - it seems like it should work. For example,...
4
23457
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 full text, using a title attribute I believe. It works for a div, but not a span... any ideas? Here's a snippet that I'm working on: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
6
1102
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 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...
5
5576
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 but that also scales the thickness of the circumference. I'm trying bezier curves but without visual feedback it's pretty hard to draw. And quadratic beziers give, at least with the control points I can set, an oblate form. Whereas the only way I...
18
1604
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 loop, and after the allocation, when i "assert" the allocation, the assertion fails!!! void printStrings(s1, ...){ //ellipses function ....
4
3026
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 one manually using the DrawLine function or I could use the Windows graphics libraries to squash a perfect circle and rotate it... Is there an easier way to accomplish this or will I have to resort to manual
0
8473
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8390
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8911
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7428
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, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1806
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.