View Full Version : Can we change the color of a button's text?
Jausn 05-11-2009, 10:22 AM Hello guys!
Can we change the color of a button's text?
|
|
ZeBoxx2
05-11-2009, 01:24 PM
A. using a dotnet button, yes, easily
B. for maxscript buttons, no. You can, however, try faking it by sticking a Hyperlink control on top (you can set the colors for hyperlink controls). You'll have to make sure to setFocus to the hyperlink to (hopefully) pop it back to the foreground after the user presses the button.
j-man
05-11-2009, 05:19 PM
or by using an image button?
J.
Jausn
05-12-2009, 02:42 AM
I know that we can use a .net button and set its foreColor to a disired color.
But my problem is that the foreColor property is a System.Drawing.Color and we just can set the color to one of the following preset colors.
.A : <System.Byte>, read-only
.AliceBlue : <System.Drawing.Color>, read-only, static
.AntiqueWhite : <System.Drawing.Color>, read-only, static
.Aqua : <System.Drawing.Color>, read-only, static
.Aquamarine : <System.Drawing.Color>, read-only, static
.Azure : <System.Drawing.Color>, read-only, static
.B : <System.Byte>, read-only
.Beige : <System.Drawing.Color>, read-only, static
.Bisque : <System.Drawing.Color>, read-only, static
.Black : <System.Drawing.Color>, read-only, static
.BlanchedAlmond : <System.Drawing.Color>, read-only, static
.Blue : <System.Drawing.Color>, read-only, static
.BlueViolet : <System.Drawing.Color>, read-only, static
.Brown : <System.Drawing.Color>, read-only, static
.BurlyWood : <System.Drawing.Color>, read-only, static
... ...
... ...
And you can't set it to a random color like color 50 50 50.
So how can we set the color to any color we want?
ZeBoxx2
05-12-2009, 08:42 AM
sure you can - see the .fromARGB method
rollout roll_test "test" width:416 height:66 (
dotNetControl dno_label "Windows.Forms.Label" width:400 height:50
fn dotnetcolor r g b = (
(dotNetClass "System.Drawing.Color").fromARGB r g b
)
on roll_test open do (
dno_label.text = "Hello World"
dno_label.font = dotNetObject "System.Drawing.Font" "Bookman Old Style" 24
dno_label.foreColor = (dotnetcolor 255 128 64)
)
)
createDialog roll_test
Jausn
05-12-2009, 09:28 AM
Thank you!
I've found this method from this file below:
[3dsMax Path]\stdplugs\stdscripts\NET_ListViewWrapper.ms
:bounce:
CGTalk Moderation
05-12-2009, 09:28 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.