all groups > dotnet windows forms > april 2006 >
You're in the

dotnet windows forms

group:

Color Dialog



Color Dialog tmoeller
4/27/2006 11:35:01 PM
dotnet windows forms: Hi,

when using this code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim MyDialog As New ColorDialog()
MyDialog.AllowFullOpen = False
MyDialog.ShowHelp = True
MyDialog.Color = TextBox1.ForeColor

If (MyDialog.ShowDialog() = Windows.Forms.DialogResult.OK) Then
TextBox1.ForeColor = MyDialog.Color
End If

End Sub

the variable TextBox1.ForeColor gets the value of "{Name=ffff8040,
ARGB=(255, 255, 128, 64)}".
How do I extract only the last three numbers in a string in a format like
"255 128 064"?

Thanks for help
Re: Color Dialog rw NO[at]SPAM orlandocurioso.de
4/27/2006 11:47:17 PM
Color c;
string s = string.Format("{0} {1} {2}", c.R, c.B, c.G);
Re: Color Dialog rw NO[at]SPAM orlandocurioso.de
4/27/2006 11:50:20 PM
oops, corrected:

Color c;
string s = string.Format("{0} {1} {2}", c.R, c.G, c.B);
Re: Color Dialog tmoeller
4/27/2006 11:55:02 PM
Maybe I am to stupid bt I do not understand your solution. I am wrinting in
VB 2005 Express. Could you possibly write your solution with using my
variables?

Thanks a lot

[quoted text, click to view]
Re: Color Dialog Herfried K. Wagner [MVP]
4/28/2006 12:00:00 AM
"tmoeller" <tmoeller@discussions.microsoft.com> schrieb:
[quoted text, click to view]

\\\
Dim c As Color = ...
Dim s As String = String.Format("{0} {1} {2}", c.R, c.B, c.G)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Re: Color Dialog tmoeller
4/28/2006 9:16:02 AM
Great. Thanks a lot so far.
In this case I have to assign a color to the variable c but I want the
result by dynamic by picking a color inside the dialog. When doing this the
color is assigned to the variable MyDialog.Color. And it is not possible (for
me) to put the value of MyDialog.Color in a string.

Please respond.


[quoted text, click to view]
AddThis Social Bookmark Button