I've got an inherited control where I want the user to be able to specify a
color property. Using that color, I'm drawing a line
private m_UserDefinedColor as Color
.....
Dim g as Graphics=this.CreateGraphics
Dim myPen as Pen = new Pen(m_UserDefinedColor)
g.DrawLine(myPen, X1, Y, X2 - 1, Y)
Then I want to draw a triangle filled with the same color. I set the point
and do:
g.FillPolygon(Brushes.Red, leftTriangle);
Because I can't figure out how to create a Brush that has the userdefined
color.
It's not possible to do: myBrush as Brush = new Brush(m_UserDefinedColor)
How do you specify the Brush Color in this case?
Cheers,
Johnny J. 2 1518
On Sep 10, 11:40 am, "Johnny J." <j...@altcom.sewrote:
I've got an inherited control where I want the user to be able to specify a
color property. Using that color, I'm drawing a line
private m_UserDefinedColor as Color
....
Dim g as Graphics=this.CreateGraphics
Dim myPen as Pen = new Pen(m_UserDefinedColor)
g.DrawLine(myPen, X1, Y, X2 - 1, Y)
Then I want to draw a triangle filled with the same color. I set the point
and do:
g.FillPolygon(Brushes.Red, leftTriangle);
Because I can't figure out how to create a Brush that has the userdefined
color.
It's not possible to do: myBrush as Brush = new Brush(m_UserDefinedColor)
How do you specify the Brush Color in this case?
Cheers,
Johnny J.
IIRC you have to use one of the "other" brush objects (Solid,
Gradient, etc)
Something like:
Dim b As Brush = New SolidBrush(m_UserDefinedColor)
Thanks,
Seth Rowe
Thanks Seth
That solved the problem.
Cheers,
Johnny J.
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
On Sep 10, 11:40 am, "Johnny J." <j...@altcom.sewrote:
>I've got an inherited control where I want the user to be able to specify a color property. Using that color, I'm drawing a line
private m_UserDefinedColor as Color
....
Dim g as Graphics=this.CreateGraphics Dim myPen as Pen = new Pen(m_UserDefinedColor) g.DrawLine(myPen, X1, Y, X2 - 1, Y)
Then I want to draw a triangle filled with the same color. I set the point and do:
g.FillPolygon(Brushes.Red, leftTriangle);
Because I can't figure out how to create a Brush that has the userdefined color.
It's not possible to do: myBrush as Brush = new Brush(m_UserDefinedColor)
How do you specify the Brush Color in this case?
Cheers,
Johnny J.
IIRC you have to use one of the "other" brush objects (Solid,
Gradient, etc)
Something like:
Dim b As Brush = New SolidBrush(m_UserDefinedColor)
Thanks,
Seth Rowe This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rene |
last post by:
I would like to get a reference to a Brush using the color name of the
brush. For example, right now if I want a brush with a certain color, I
would hard code something like Brushes.PeachPuff, this...
|
by: Serdar YILMAZ |
last post by:
|
by: boxim |
last post by:
having a moment,
cant you just
Brush br = new Brush(Color.Black);??? saying you cant cos it's an abstract
class
need to get to a brush from a color
tia
sam martin
|
by: Ben Blank |
last post by:
I'm writing a family of classes which all inherit most of their methods and
code (including constructors) from a single base class. When attempting to
instance one of the derived classes using...
|
by: jcrouse |
last post by:
I have the following string:
e.Graphics.DrawString(Label5.Text, lblP1B1.Font, Brushes.White, -y, 0)
I want to use the property label.forecolor for my text color. How do I get
whats in...
|
by: Dennis |
last post by:
When I instantiate a Brush resource such as a solidbrush, do I need to
dispose the resource when I'm finished or will it automatically be disposed
when the function/sub it's used in ends? Thank...
|
by: =?Utf-8?B?UEtsZW1t?= |
last post by:
how to serialize a brush object with the XmlSerializer without knowing the
brush type?
|
by: steve |
last post by:
When drawing with a hatch brush with a statement such as
myGraphics.FillPolygon(hatchBrush, polygon.vertices);
the hatch brush is always oriented in the same direction.
Is there a way of...
|
by: Tom P. |
last post by:
I am doing quite a bit of custom painting and it means I have to
create a lot of brushes (think one for every file system object in a
directory) per paint. How expensive is this? Should I find a...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |