473,793 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Color and brush convert

JR
Hi,

I need a color to Brush convert function. something like this

Function GetColorBrush(c Color as color) as brush
dim sColor as string = cColor.name
return brushes(sColor)
End function

ofcourse this won't work but who will help me

Jan
Nov 21 '05 #1
2 19946
Try

Dim myBrush as SolidBrush

myBrush = New SolidBrush(cCol or)
....
myBrush.Dispose ()

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"JR" <XX***@XX.XX> escribió en el mensaje
news:GH******** **************@ phobos.telenet-ops.be...
Hi,

I need a color to Brush convert function. something like this

Function GetColorBrush(c Color as color) as brush
dim sColor as string = cColor.name
return brushes(sColor)
End function

ofcourse this won't work but who will help me

Jan

Nov 21 '05 #2
JR
Works great thanks for the fast answer.

"Carlos J. Quintero [.NET MVP]" <ca*****@NOSPAM sogecable.com> schreef in
bericht news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Try

Dim myBrush as SolidBrush

myBrush = New SolidBrush(cCol or)
...
myBrush.Dispose ()

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"JR" <XX***@XX.XX> escribió en el mensaje
news:GH******** **************@ phobos.telenet-ops.be...
Hi,

I need a color to Brush convert function. something like this

Function GetColorBrush(c Color as color) as brush
dim sColor as string = cColor.name
return brushes(sColor)
End function

ofcourse this won't work but who will help me

Jan



Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
43465
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
0
1135
by: M.Sauve | last post by:
Hi I want to compare 02 columns in my datagrid and for example if my column5 < column6 I want to color my columns 5 and 6. This is my code and I'm not able to get the value of column6 in my Paint method thank you for your help public class DataGridColoredTextBoxColumn : DataGridTextBoxColumn
5
3493
by: JJ | last post by:
Hi all, I am using the color dialog box to select a colour to print with. However, the e.Graphics.DrawString method uses Brushes.Black, not Color.Black. How do I convert from Brushes to Colors and back
3
15405
by: Mad Scientist Jr | last post by:
Can someone post a clear example of how to change the background color of an individual datagrid cell for a Windows desktop app? (preferably in vb.net) I found some code on how to do this when the user clicks on the cell: Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged DataGrid1.Controls(DataGrid1.CurrentCell.ColumnNumber + 2).BackColor =...
3
10359
vikysaran
by: vikysaran | last post by:
This is my code bellow:- private void _tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Font f; Brush backBrush; Brush foreBrush; if (e.Index == this._tabControl1.SelectedIndex) {
3
29320
by: CSharper | last post by:
Is it possible to selectivly change the color of an item in text. I saw ForeColor option, but it changes the color of all the items. If it is not possible, is there any other control list listbox where we can see more than one item and change the color during run time. Thanks.
5
7186
by: moondaddy | last post by:
I have a custom control where users can set the backcolor of one of it's UI elements via a DP I created. One of the colors they can pick is a brush called CustomGradient where I would set the DP to this brush. Then from a color picker I would let them pick a solid color brush and set 2 of the gradient stops to this new value. So for example, here's the style:
0
1284
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 rotating the brush so that I can give it a different orientation for each polygon? I.e. if it was a triangle and it was drawn upright then the brush would appear as normal but if the triangle was drawn upside down the hatch brush pattern would...
31
3419
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 way to create the brushes once, store them in an member variable, and use them when I need them? Or is creating brushes a throw-away process that doesn't take a lot of work? Thanks for the info. Tom P.
0
9671
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10161
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.