|
//MyForm.il
//Shows how to create a container and play with it's properties
.assembly extern mscorlib
{
.ver 1:0:3300:0
}
.assembly extern System
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 1:0:3300:0
}
.assembly extern System.Drawing
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
.ver 1:0:3300:0
}
.assembly extern System.Windows.Forms
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 1:0:3300:0
}
.assembly MyForm
{
.ver 1:0:1:0
}
.module MyForm.exe
.namespace MyForm
{
.class public TestForm extends [System.Windows.Forms]System.Windows.Forms.Form
{
.field private class [System]System.ComponentModel.IContainer components
.method public static void Main() cil managed
{
.entrypoint
.maxstack 1
//Create New Object of TestForm Class and Call the Constructor
newobj instance void MyForm.TestForm::.ctor()
call void [System.Windows.Forms]System.Windows.Forms.Application::Run(class [System.Windows.Forms]System.Windows.Forms.Form)
ret
}
.method public specialname rtspecialname instance void .ctor() cil managed
{
.maxstack 4
ldarg.0
//Call Base Class Constructor
call instance void [System.Windows.Forms]System.Windows.Forms.Form::.ctor()
//Initialize the Components
ldarg.0
newobj instance void [System]System.ComponentModel.Container::.ctor()
stfld class [System]System.ComponentModel.IContainer MyForm.TestForm::components
//Set the Title of the Window (Form)
ldarg.0
ldstr "This is the Title of the Form...."
call instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
//Set the Back Color of the Form
ldarg.0
ldc.i4 0xff
ldc.i4 0
ldc.i4 0
call valuetype [System.Drawing]System.Drawing.Color [System.Drawing]System.Drawing.Color::FromArgb(int32, int32, int32)
call instance void [System.Windows.Forms]System.Windows.Forms.Control::set_BackColor(valuetype [System.Drawing]System.Drawing.Color)
//Maximize the Form using WindowState Property (set_WindowState method in IL)
ldarg.0
ldc.i4 2 //2 for Maximize
call instance void [System.Windows.Forms]System.Windows.Forms.Form::set_WindowState(valuetype [System.Windows.Forms]System.Windows.Forms.FormWindowState)
ret
}
.method family virtual instance void Dispose(bool disposing) cil managed
{
.maxstack 2
ldarg.0
ldfld class [System]System.ComponentModel.IContainer MyForm.TestForm::components
callvirt instance void [mscorlib]System.IDisposable::Dispose()
//Call Base Class's Dispose Event
ldarg.0
ldarg.1
call instance void [System.Windows.Forms]System.Windows.Forms.Form::Dispose(bool)
ret
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.