Two More Graphics Questions


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Two More Graphics Questions

  1. #1
    Rob Lowney Guest

    Two More Graphics Questions


    I have two more quick graphics library questions:

    1. I know how to get a custom colored pen by creating a pen object and passing
    the argb parameters on the new. I can't seem to get this to work with a
    brush to fill the shape I make with the pen. How do I create a brush object
    with a custom color?

    2. I know there is a rectangle and an arc. Is there a rounded rec object(I
    can't seem to find it) or must I create my own?

    Thanks for all your help.

    Rob.

  2. #2
    Jacob Grass Guest

    Re: Two More Graphics Questions

    Rob-

    1. Couldn't you create a color FromArgb and pass that to the Brush?

    2. I thought that there was a rounded rectangle object, but, I can't seem
    to find it either. . . It shouldn't be too difficult to create your own
    though. . .


    Jacob

    "Rob Lowney" <rob.lowney@xwave.com> wrote in message
    news:3b587ca1$1@news.devx.com...
    >
    > I have two more quick graphics library questions:
    >
    > 1. I know how to get a custom colored pen by creating a pen object and

    passing
    > the argb parameters on the new. I can't seem to get this to work with a
    > brush to fill the shape I make with the pen. How do I create a brush

    object
    > with a custom color?
    >
    > 2. I know there is a rectangle and an arc. Is there a rounded rec

    object(I
    > can't seem to find it) or must I create my own?
    >
    > Thanks for all your help.
    >
    > Rob.




  3. #3
    Rob Lowney Guest

    Re: Two More Graphics Questions


    Jacob,

    No, it should not be to hard to make my own rounded rec, I just wanted to
    make sure I am not missing one that is pre-done.. I'm not a big fan of reinventing
    the wheel if it is not necessary.

    When I created the pen I simply declared an object of type pen and passed
    it the color in the constructor - the brush does not seem to work that way
    as there seems to be no constructor for the object. I would have thought
    the following line of code would work(similar to how the pen object works):

    dim myBrush as brush = new brush(color.fromARGB(255,255,0,0))

    but alas, it doesn't. I'm not entirly sure how to do it.

    "Jacob Grass" <JGrass@AbilitiSolutions.com> wrote:
    >Rob-
    >
    >1. Couldn't you create a color FromArgb and pass that to the Brush?
    >
    >2. I thought that there was a rounded rectangle object, but, I can't seem
    >to find it either. . . It shouldn't be too difficult to create your own
    >though. . .
    >
    >
    >Jacob
    >
    >"Rob Lowney" <rob.lowney@xwave.com> wrote in message
    >news:3b587ca1$1@news.devx.com...
    >>
    >> I have two more quick graphics library questions:
    >>
    >> 1. I know how to get a custom colored pen by creating a pen object and

    >passing
    >> the argb parameters on the new. I can't seem to get this to work with

    a
    >> brush to fill the shape I make with the pen. How do I create a brush

    >object
    >> with a custom color?
    >>
    >> 2. I know there is a rectangle and an arc. Is there a rounded rec

    >object(I
    >> can't seem to find it) or must I create my own?
    >>
    >> Thanks for all your help.
    >>
    >> Rob.

    >
    >



  4. #4
    Daniel Pratt Guest

    Re: Two More Graphics Questions

    Hi Rob,

    Brush is the abstract base class for different types of brushes:

    HatchBrush
    LinearGradientBrush
    PathGradientBrush
    SolidBrush
    TextureBrush

    Use SolidBrush if you need a brush with a solid color. If your brush is
    a well-known color you could also use one of the static properties of the
    Brushes class (e.g. Brushes.Red).

    Regards,
    Dan

    "Rob Lowney" <rob.lowney@xwave.com> wrote in message
    news:3b58845c$1@news.devx.com...
    >
    > Jacob,
    >
    > No, it should not be to hard to make my own rounded rec, I just wanted to
    > make sure I am not missing one that is pre-done.. I'm not a big fan of

    reinventing
    > the wheel if it is not necessary.
    >
    > When I created the pen I simply declared an object of type pen and passed
    > it the color in the constructor - the brush does not seem to work that way
    > as there seems to be no constructor for the object. I would have thought
    > the following line of code would work(similar to how the pen object

    works):
    >
    > dim myBrush as brush = new brush(color.fromARGB(255,255,0,0))
    >
    > but alas, it doesn't. I'm not entirly sure how to do it.
    >
    > "Jacob Grass" <JGrass@AbilitiSolutions.com> wrote:
    > >Rob-
    > >
    > >1. Couldn't you create a color FromArgb and pass that to the Brush?
    > >
    > >2. I thought that there was a rounded rectangle object, but, I can't

    seem
    > >to find it either. . . It shouldn't be too difficult to create your own
    > >though. . .
    > >
    > >
    > >Jacob
    > >
    > >"Rob Lowney" <rob.lowney@xwave.com> wrote in message
    > >news:3b587ca1$1@news.devx.com...
    > >>
    > >> I have two more quick graphics library questions:
    > >>
    > >> 1. I know how to get a custom colored pen by creating a pen object and

    > >passing
    > >> the argb parameters on the new. I can't seem to get this to work with

    > a
    > >> brush to fill the shape I make with the pen. How do I create a brush

    > >object
    > >> with a custom color?
    > >>
    > >> 2. I know there is a rectangle and an arc. Is there a rounded rec

    > >object(I
    > >> can't seem to find it) or must I create my own?
    > >>
    > >> Thanks for all your help.
    > >>
    > >> Rob.

    > >
    > >

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center