WinForms scripting.

The following script shows that you can create a WinForms application entirely in paxScript.NET:
Imports system
Imports system.windows.forms
Imports system.drawing

Public Class Form1
    Inherits System.Windows.Forms.Form
    Private components As System.ComponentModel.IContainer

    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub


    Friend WithEvents Button1 As System.Windows.Forms.Button
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.Button1 = New System.Windows.Forms.Button
        Me.SuspendLayout()

        Me.Button1.Location = New System.Drawing.Point(40, 40)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Click Me"

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(200, 110)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "HelloApp"
        Me.ResumeLayout(False)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       MessageBox.Show("Hello")
    End Sub
End Class

Module test
  Private appContext As ApplicationContext
  Sub Main()
    appContext = New ApplicationContext
    Dim f As New Form1
    f.Show()
    appContext.MainForm = f

    Application.Run(appContext)
  End Sub
End Module


Copyright © 2005-2024 Alexander Baranovsky. All rights reserved.