|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
AntiAliasI'm a VB.NET "newbie". I want to use AntiAlias, but every thing that I try
the compiler doesn't like. Sometimes it will suggest a change, but when I change it, it doesn't like that either! Weird! I can't win! So far, I have "Dim objSmoothing AS System.Drawing.Drawing2D.SmoothingMode.AntiAlias". On the next line I have "objSmoothing =" No matter what I try after the equals sign, the compiler doesn't like it! So, what do I put after the equals sign that the compiler will like & not complain about? Thank you. David Hello, David,
That seems odd to me. The compiler "should" be complaining about the first line instead. Rather than being a type, "AntiAlias" is one of the values of the SmoothingMode enumeration. Try the following instead: Dim objSmoothing As System.Drawing.Drawing2D.SmoothingMode objSmoothing = Drawing2D.SmoothingMode.AntiAlias Cheers, Randy pcnerd wrote: Show quoteHide quote > I'm a VB.NET "newbie". I want to use AntiAlias, but every thing that I try > the compiler doesn't like. Sometimes it will suggest a change, but when I > change it, it doesn't like that either! Weird! I can't win! > > So far, I have "Dim objSmoothing AS > System.Drawing.Drawing2D.SmoothingMode.AntiAlias". On the next line I have > "objSmoothing =" No matter what I try after the equals sign, the compiler > doesn't like it! > > So, what do I put after the equals sign that the compiler will like & not > complain about? Thank you. David Alright! Your suggestion worked! The compiler didn't complain! Now how do I
use it? Here's the situation. I've created a demo program that draws various sizes of circles & ellipses in random locations on the form. Sometimes, I see "jaggies". Where in the code do I use the "objSmoothing"? Here follows the code from the button_Click event: Dim CircleWidth As Integer Dim CircleHeight As Integer Dim CenterX As Integer Dim CenterY As Integer Dim RedColor As Integer Dim GreenColor As Integer Dim BlueColor As Integer Dim Transparency As Integer Dim objGraphics As Graphics objGraphics = Me.CreateGraphics ' Dim objSmoothing As System.Drawing.Drawing2D.SmoothingMode ' objSmoothing = Drawing2D.SmoothingMode.AntiAlias Dim objRandom As System.Random ' Initialize the Random object objRandom = New Random(Now.Millisecond) Transparency = objRandom.Next(0, 256) CircleWidth = objRandom.Next(0, 10) CircleHeight = objRandom.Next(0, 10) CenterX = objRandom.Next(0, 1279) CenterY = objRandom.Next(0, 1023) RedColor = objRandom.Next(0, 256) GreenColor = objRandom.Next(0, 256) BlueColor = objRandom.Next(0, 256) Dim DrawingPen As Pen ' DrawingPen = New Pen(Color.FromArgb(Transparency, RedColor, GreenColor, BlueColor), 5) DrawingPen = New Pen(Color.FromArgb(RedColor, GreenColor, BlueColor), 5) Dim Index As Integer For Index = 1 To 10000 ' System.Threading.Thread.Sleep(100) ' Me.CreateGraphics.DrawEllipse(DrawingPen, CenterX, CenterY, CircleWidth, CircleHeight) Me.CreateGraphics.DrawEllipse(DrawingPen, CenterX, CenterY, CircleWidth, CircleHeight) CenterX = objRandom.Next(0, 1279) CenterY = objRandom.Next(0, 1023) RedColor = objRandom.Next(0, 256) GreenColor = objRandom.Next(0, 256) BlueColor = objRandom.Next(0, 256) Next Index Some of the comments are because I'm experimenting. I tried adding the "objSmoothing" to the end of the For...Next, but the compiler complained. So, where in the code do I add the "objSmoothing"? Thank you. David Show quoteHide quote "R. MacDonald" wrote: > Hello, David, > > That seems odd to me. The compiler "should" be complaining about the > first line instead. > > Rather than being a type, "AntiAlias" is one of the values of the > SmoothingMode enumeration. Try the following instead: > > Dim objSmoothing As System.Drawing.Drawing2D.SmoothingMode > objSmoothing = Drawing2D.SmoothingMode.AntiAlias > > Cheers, > Randy > > > pcnerd wrote: > > I'm a VB.NET "newbie". I want to use AntiAlias, but every thing that I try > > the compiler doesn't like. Sometimes it will suggest a change, but when I > > change it, it doesn't like that either! Weird! I can't win! > > > > So far, I have "Dim objSmoothing AS > > System.Drawing.Drawing2D.SmoothingMode.AntiAlias". On the next line I have > > "objSmoothing =" No matter what I try after the equals sign, the compiler > > doesn't like it! > > > > So, what do I put after the equals sign that the compiler will like & not > > complain about? Thank you. David >
Show quote
Hide quote
"pcnerd" <pcn***@discussions.microsoft.com> schrieb: \\\> Alright! Your suggestion worked! The compiler didn't complain! Now how do > I > use it? > > Here's the situation. I've created a demo program that draws various sizes > of circles & ellipses in random locations on the form. Sometimes, I see > "jaggies". Where in the code do I use the "objSmoothing"? > > Here follows the code from the button_Click event: > > Dim CircleWidth As Integer > Dim CircleHeight As Integer > Dim CenterX As Integer > Dim CenterY As Integer > Dim RedColor As Integer > Dim GreenColor As Integer > Dim BlueColor As Integer > Dim Transparency As Integer > > Dim objGraphics As Graphics > objGraphics = Me.CreateGraphics > > ' Dim objSmoothing As System.Drawing.Drawing2D.SmoothingMode > ' objSmoothing = Drawing2D.SmoothingMode.AntiAlias objGraphics.SmoothingMode = SmoothingMode.AntiAlias /// > objRandom = New Random(Now.Millisecond) Simply call the parameterless constructor here!-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> 2 questions
You added the following code - "objGraphics.SmoothingMode = SmoothingMode.AntiAlias". The compiler didn't like it! You also stated - "Simply call the parameterless constructor here!" Where is "here"? Thank you. David Show quoteHide quote "Herfried K. Wagner [MVP]" wrote: > "pcnerd" <pcn***@discussions.microsoft.com> schrieb: > > Alright! Your suggestion worked! The compiler didn't complain! Now how do > > I > > use it? > > > > Here's the situation. I've created a demo program that draws various sizes > > of circles & ellipses in random locations on the form. Sometimes, I see > > "jaggies". Where in the code do I use the "objSmoothing"? > > > > Here follows the code from the button_Click event: > > > > Dim CircleWidth As Integer > > Dim CircleHeight As Integer > > Dim CenterX As Integer > > Dim CenterY As Integer > > Dim RedColor As Integer > > Dim GreenColor As Integer > > Dim BlueColor As Integer > > Dim Transparency As Integer > > > > Dim objGraphics As Graphics > > objGraphics = Me.CreateGraphics > > > > ' Dim objSmoothing As System.Drawing.Drawing2D.SmoothingMode > > ' objSmoothing = Drawing2D.SmoothingMode.AntiAlias > > \\\ > objGraphics.SmoothingMode = SmoothingMode.AntiAlias > /// > > > objRandom = New Random(Now.Millisecond) > > Simply call the parameterless constructor here! > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> > > "pcnerd" <pcn***@discussions.microsoft.com> schrieb: You will have to add 'Imports System.Drawing.Drawing2D' on top of the source > You added the following code - "objGraphics.SmoothingMode = > SmoothingMode.AntiAlias". The compiler didn't like it! file. > You also stated - "Simply call the parameterless constructor here!" Where \\\> is > "here"? Dim r As New Random() /// You don't need to pass the current time to the constructor. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> HUH?
I give up. VB.NET is too complicated for me. I'm going back to VB6! Show quoteHide quote "Herfried K. Wagner [MVP]" wrote: > "pcnerd" <pcn***@discussions.microsoft.com> schrieb: > > You added the following code - "objGraphics.SmoothingMode = > > SmoothingMode.AntiAlias". The compiler didn't like it! > > You will have to add 'Imports System.Drawing.Drawing2D' on top of the source > file. > > > You also stated - "Simply call the parameterless constructor here!" Where > > is > > "here"? > > \\\ > Dim r As New Random() > /// > > You don't need to pass the current time to the constructor. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> > > Hello, David,
Re: > I give up. VB.NET is too complicated for me. I'm going back to VB6! That will probably prove to be a mistake. Presumably you already "know" VB6. This is, no doubt, because you have invested a lot of time and effort learning it. You need to understand that VB.Net is a substantially different language than VB6. Therefore you must also be prepared to invest significant effort in learning it. I'd advise against "giving up". I think that you'll find the effort required is well spent. Cheers, Randy pcnerd wrote: Show quoteHide quote > HUH? > > I give up. VB.NET is too complicated for me. I'm going back to VB6! > > > "Herfried K. Wagner [MVP]" wrote: > > >>"pcnerd" <pcn***@discussions.microsoft.com> schrieb: >> >>>You added the following code - "objGraphics.SmoothingMode = >>>SmoothingMode.AntiAlias". The compiler didn't like it! >> >>You will have to add 'Imports System.Drawing.Drawing2D' on top of the source >>file. >> >> >>>You also stated - "Simply call the parameterless constructor here!" Where >>>is >>>"here"? >> >>\\\ >>Dim r As New Random() >>/// >> >>You don't need to pass the current time to the constructor. >> >>-- >> M S Herfried K. Wagner >>M V P <URL:http://dotnet.mvps.org/> >> V B <URL:http://classicvb.org/petition/> >> >> There are things that I like in VB6 that aren't available in VB.NET. For
example, with Pset I can plot individual pixels. I created a demo program in VB6 that plots math functions. I can see the individual pixels. VB.NET doesn't have Pset so there's no way to plot individual pixels. I have to create circle of 1 pixel width & 1 pixel height. The VB.NET program that I'm trying to do shows the circles as tiny boxes. In my VB6 program, I can see the individual pixels & they are smaller than the boxes. In VB6, it's easy to create a custom coordinate system (like the origin in the center of the form). In VB.NET, it isn't. Every time that I hope to have a solution to a problem, another problem comes up. For instance, someone explained how to use AntiAlias so the compiler wouldn't complain. Somebody else suggested something else so I tried it & the compiler complained. I can't win. I'm not a patient person. Another thing that I don't like about VB.NET is that the ..NET Framework has to be installed before VB will run. I know that the .NET Framework can be installed as part of the Setup. That's not a problem with VB6. Just run the deployment wizard & put the program on a floppy or CD. And Microsoft thinks that VB.NET is an improvement over VB6? Not in my opinion. Maybe I'll give VB.NET another try & maybe I won't. Show quoteHide quote "R. MacDonald" wrote: > Hello, David, > > Re: > > I give up. VB.NET is too complicated for me. I'm going back to VB6! > > That will probably prove to be a mistake. Presumably you already "know" > VB6. This is, no doubt, because you have invested a lot of time and > effort learning it. > > You need to understand that VB.Net is a substantially different language > than VB6. Therefore you must also be prepared to invest significant > effort in learning it. > > I'd advise against "giving up". I think that you'll find the effort > required is well spent. > > Cheers, > Randy > > > pcnerd wrote: > > > HUH? > > > > I give up. VB.NET is too complicated for me. I'm going back to VB6! > > > > > > "Herfried K. Wagner [MVP]" wrote: > > > > > >>"pcnerd" <pcn***@discussions.microsoft.com> schrieb: > >> > >>>You added the following code - "objGraphics.SmoothingMode = > >>>SmoothingMode.AntiAlias". The compiler didn't like it! > >> > >>You will have to add 'Imports System.Drawing.Drawing2D' on top of the source > >>file. > >> > >> > >>>You also stated - "Simply call the parameterless constructor here!" Where > >>>is > >>>"here"? > >> > >>\\\ > >>Dim r As New Random() > >>/// > >> > >>You don't need to pass the current time to the constructor. > >> > >>-- > >> M S Herfried K. Wagner > >>M V P <URL:http://dotnet.mvps.org/> > >> V B <URL:http://classicvb.org/petition/> > >> > >> > |
|||||||||||||||||||||||