Results 1 to 4 of 4

Thread: [2.0] Creating a pen or brush from a set of RGB colors?

  1. #1

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    [2.0] Creating a pen or brush from a set of RGB colors?

    Is it possible to create a brush or pen with RGB colors like (20, 50, 150) instead of just Brushes.Red, Brushes.Green, I don't see any Brushes or Pens.FromArgb()

    Thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Creating a pen or brush from a set of RGB colors?

    The answer to your question is "no". That said, it is eminently possible to create a Pen or Brush from a Color value, and there is a Color.FromArgb method.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Re: [2.0] Creating a pen or brush from a set of RGB colors?

    Can you give an example? I have tried many times in VB & C# to create a brush from a color...

    Thanks

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Creating a pen or brush from a set of RGB colors?

    When you read the documentation for the Brush class you must have missed this bit:
    Quote Originally Posted by MSDN
    This is an abstract base class and cannot be instantiated. To create a brush object, use classes derived from Brush, such as SolidBrush, TextureBrush, and LinearGradientBrush.
    As you may or may not have noticed, the properties of the Brushes class that are named after colours all return SolidBrush objects.

    Is anyone starting to think that reading the documentation is a good idea or am I just wasting my time?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width