AntiAlias

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pcnerd

    #1

    AntiAlias

    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.Smoot hingMode.AntiAl ias". On the next line I have
    "objSmoothi ng =" 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
  • R. MacDonald

    #2
    Re: AntiAlias

    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.Smoot hingMode
    objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias

    Cheers,
    Randy


    pcnerd wrote:[color=blue]
    > 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.Smoot hingMode.AntiAl ias". On the next line I have
    > "objSmoothi ng =" 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[/color]

    Comment

    • pcnerd

      #3
      Re: AntiAlias


      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 "objSmoothi ng"?

      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.CreateGraphi cs

      ' Dim objSmoothing As System.Drawing. Drawing2D.Smoot hingMode
      ' objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias

      Dim objRandom As System.Random

      ' Initialize the Random object
      objRandom = New Random(Now.Mill isecond)

      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.FromA rgb(Transparenc y, RedColor, GreenColor,
      BlueColor), 5)
      DrawingPen = New Pen(Color.FromA rgb(RedColor, GreenColor, BlueColor), 5)

      Dim Index As Integer

      For Index = 1 To 10000
      ' System.Threadin g.Thread.Sleep( 100)
      ' Me.CreateGraphi cs.DrawEllipse( DrawingPen, CenterX, CenterY,
      CircleWidth, CircleHeight)
      Me.CreateGraphi cs.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 "objSmoothi ng" to the end of the For...Next, but the
      compiler complained.

      So, where in the code do I add the "objSmoothi ng"?

      Thank you.

      David

      "R. MacDonald" wrote:
      [color=blue]
      > 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.Smoot hingMode
      > objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias
      >
      > Cheers,
      > Randy
      >
      >
      > pcnerd wrote:[color=green]
      > > 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.Smoot hingMode.AntiAl ias". On the next line I have
      > > "objSmoothi ng =" 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[/color]
      >[/color]

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: AntiAlias

        "pcnerd" <pcnerd@discuss ions.microsoft. com> schrieb:[color=blue]
        > 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 "objSmoothi ng"?
        >
        > 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.CreateGraphi cs
        >
        > ' Dim objSmoothing As System.Drawing. Drawing2D.Smoot hingMode
        > ' objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias[/color]

        \\\
        objGraphics.Smo othingMode = SmoothingMode.A ntiAlias
        ///
        [color=blue]
        > objRandom = New Random(Now.Mill isecond)[/color]

        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/>

        Comment

        • pcnerd

          #5
          Re: AntiAlias

          2 questions

          You added the following code - "objGraphics.Sm oothingMode =
          SmoothingMode.A ntiAlias". The compiler didn't like it!

          You also stated - "Simply call the parameterless constructor here!" Where is
          "here"?

          Thank you. David

          "Herfried K. Wagner [MVP]" wrote:
          [color=blue]
          > "pcnerd" <pcnerd@discuss ions.microsoft. com> schrieb:[color=green]
          > > 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 "objSmoothi ng"?
          > >
          > > 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.CreateGraphi cs
          > >
          > > ' Dim objSmoothing As System.Drawing. Drawing2D.Smoot hingMode
          > > ' objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias[/color]
          >
          > \\\
          > objGraphics.Smo othingMode = SmoothingMode.A ntiAlias
          > ///
          >[color=green]
          > > objRandom = New Random(Now.Mill isecond)[/color]
          >
          > 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/>
          >
          >[/color]

          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: AntiAlias

            "pcnerd" <pcnerd@discuss ions.microsoft. com> schrieb:[color=blue]
            > You added the following code - "objGraphics.Sm oothingMode =
            > SmoothingMode.A ntiAlias". The compiler didn't like it![/color]

            You will have to add 'Imports System.Drawing. Drawing2D' on top of the source
            file.
            [color=blue]
            > You also stated - "Simply call the parameterless constructor here!" Where
            > is
            > "here"?[/color]

            \\\
            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/>

            Comment

            • pcnerd

              #7
              Re: AntiAlias


              HUH?

              I give up. VB.NET is too complicated for me. I'm going back to VB6!


              "Herfried K. Wagner [MVP]" wrote:
              [color=blue]
              > "pcnerd" <pcnerd@discuss ions.microsoft. com> schrieb:[color=green]
              > > You added the following code - "objGraphics.Sm oothingMode =
              > > SmoothingMode.A ntiAlias". The compiler didn't like it![/color]
              >
              > You will have to add 'Imports System.Drawing. Drawing2D' on top of the source
              > file.
              >[color=green]
              > > You also stated - "Simply call the parameterless constructor here!" Where
              > > is
              > > "here"?[/color]
              >
              > \\\
              > 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/>
              >
              >[/color]

              Comment

              • R. MacDonald

                #8
                Re: AntiAlias

                Hello, David,

                Re:[color=blue]
                > I give up. VB.NET is too complicated for me. I'm going back to VB6![/color]

                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:
                [color=blue]
                > HUH?
                >
                > I give up. VB.NET is too complicated for me. I'm going back to VB6!
                >
                >
                > "Herfried K. Wagner [MVP]" wrote:
                >
                >[color=green]
                >>"pcnerd" <pcnerd@discuss ions.microsoft. com> schrieb:
                >>[color=darkred]
                >>>You added the following code - "objGraphics.Sm oothingMode =
                >>>SmoothingMod e.AntiAlias". The compiler didn't like it![/color]
                >>
                >>You will have to add 'Imports System.Drawing. Drawing2D' on top of the source
                >>file.
                >>
                >>[color=darkred]
                >>>You also stated - "Simply call the parameterless constructor here!" Where
                >>>is
                >>>"here"?[/color]
                >>
                >>\\\
                >>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/>
                >>
                >>[/color][/color]

                Comment

                • pcnerd

                  #9
                  Re: AntiAlias


                  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.

                  "R. MacDonald" wrote:
                  [color=blue]
                  > Hello, David,
                  >
                  > Re:[color=green]
                  > > I give up. VB.NET is too complicated for me. I'm going back to VB6![/color]
                  >
                  > 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:
                  >[color=green]
                  > > HUH?
                  > >
                  > > I give up. VB.NET is too complicated for me. I'm going back to VB6!
                  > >
                  > >
                  > > "Herfried K. Wagner [MVP]" wrote:
                  > >
                  > >[color=darkred]
                  > >>"pcnerd" <pcnerd@discuss ions.microsoft. com> schrieb:
                  > >>
                  > >>>You added the following code - "objGraphics.Sm oothingMode =
                  > >>>SmoothingMod e.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/>
                  > >>
                  > >>[/color][/color]
                  >[/color]

                  Comment

                  Working...