Files
tools/接口/SunnyUI2.ms
T
2025-07-31 16:05:55 +08:00

54 lines
1.5 KiB
Plaintext

try(hForm.close())catch()
(
fn whenButtonIsPressed a b =
(
format "Pressed from a DotNet Button\n"
format "Argument a (Form): <%> \n" (classof a)
format "Properties:\n"
showproperties a
format "Methods:\n"
showmethods a
format "Events:\n"
showevents a
format "\nArgument b (Button): <%> \n" (classof b)
format "Properties:\n"
showproperties b
format "Methods:\n"
showmethods a
format "Events:\n"
showevents a
)
--Create a DotNet Form
hForm = dotNetObject "Sunny.UI.UImainFrame"
hForm.topmost = true
--Create a DotNet Button
mButton = dotNetObject "Sunny.UI.UIButton"
mButton.text = "BIG DotNet Button"
mButton.name = "BIG DotNet Button"
mButton.width=230
mButton.height=230
mButton.size = dotNetObject "System.Drawing.Size" 160 160
mButton.location = dotNetObject "System.Drawing.Point" 60 60
--mButton.BringToFront()
nButton = dotNetObject "System.Windows.Forms.Button"
nButton.text = "BIG DotNet Button"
nButton.size = dotNetObject "System.Drawing.Size" 160 160
nButton.location = dotNetObject "System.Drawing.Point" 100 260
--nButton.BringToFront()
--Add an Event Handler for the click event:
--hForm.controls.add mButton --add the Button to the Form
--hForm.controls.add nButton
dotNet.addEventHandler mButton "click" whenButtonIsPressed
--hForm.show() --show the Form with the Button
)
showmethods mButton
hForm.controls.add mButton;mButton.BringToFront()
mButton.SendToBack()