Write the following code.
open
System
open
System.Windows.Forms
open
System.Drawing
let
form=new Form()
form.Text<-
"My Window Application"
form.BackColor <-Color.Gray
let
btn=new Button()
btn.Text<-
"Click"
btn.BackColor<- Color.Green
btn.Click.Add(fun
a-> MessageBox.Show("Hi")
|>ignore)
form.Controls.Add(btn)
Application.Run(form)
Then run the application. The output will be look like below figure.
When We Click on Button, MessageBox is displayed with message "Hi". Like below figure.