how to do a pick color inside dotNET ?
in the test below, it´s possible to change nodes wirecolor using a dotNET button :
(
local MAX_color = black
local DotNET_Color = (dotNetClass "System.Drawing.Color").fromARGB 0 0 0
dN_UI = dotNetObject "System.Windows.Forms.Form"
dN_UI.text = "Color testing"
dN_UI.width = 200
dN_UI.height = 300
dN_UI.topMost = true
dN_UI.showIcon = false
btn_1 = dotNetObject "System.Windows.Forms.Button"
btn_1.size = dotNetObject "System.Drawing.Size" 120 50
btn_1.name = "btn_1"
btn_1.location = dotNetObject "System.Drawing.Point" 20 150
btn_1.backColor = (dotNetClass "System.Drawing.Color").Green
cd_1 = dotNetObject "System.Windows.Forms.ColorDialog"
cd_1.Color = (dotNetClass "System.Drawing.Color").AliceBlue
cd_1.FullOpen = true
cd_1.AnyColor = true
cd_1.AllowFullOpen = true
dN_UI.controls.add(btn_1)
fn btn_mouseUp senderArg eventArg =
(
senderArg.Focus()
case (senderArg.Name) of
(
"btn_1":
(
if (eventArg.button == eventArg.button.left) do
(
cd_1.ShowDialog()
DotNET_Color = (dotNetClass "System.Drawing.Color").fromARGB cd_1.Color.r cd_1.Color.g cd_1.Color.b
btn_1.backColor = DotNET_Color
dN_Color = btn_1.backColor
MAX_color = color (dn_Color.r) (dn_Color.g) (dn_Color.b)
selection.wirecolor = MAX_Color
) -- end if
if (eventArg.button == eventArg.button.right) do
(
selection.wirecolor = MAX_Color
) -- end if
) -- 1
) -- end case
) --
dotNet.addEventHandler btn_1 "mouseUp" btn_mouseUp
dN_UI.Show()
)
Would be cool if i could do the inverse operation, e.g sets the colorDialog.Color (or the button.backColor) by picking a node wirecolor or even whatever color in the screen.
** EDIT **
MXS (from help):
rollout change_wirecolor "Object Color Changer"
(
colorpicker theColor "Wireframe color:" color:[0,0,255] modal:false
on theColor changed new_col do
(
selection.wirecolor = new_col
)
)
createDialog change_wirecolor
Another thing i noticed was using standards color picker´s ‘changed value’ handler can be dynamically (changes color on the spot), where colorDialog can´t…
--EVENTS OF dotNetObject:System.Windows.Forms.ColorDialog
Disposed sender e = ( ... )
HelpRequest sender e = ( ... )
Any suggestions about it ?
thanks in advance