Creating and Using .NET Variables (Magic xpa 4.x)
Once you load the assembly, you need to create a .NET variable to use the assembly. You create a .NET variable like any other Magic xpa variable, in the Data View Editor.
You need to set the Object Type property in the .NET section.
To use the .NET variable as a control, you can now drag it from the Variable pane onto the Form Designer. A .NET control has both Magic xpa properties and its own object properties. Note that you can define a Magic xpa model for a .NET control and set the Object properties in the model’s property sheet.
.NET variables that are associated to a control are initialized automatically when the form is drawn. However, .NET variables that are not associated to controls need to be initialized manually by a constructor. You can do that by updating it with an existing .NET object or by running a .NET method that creates a .NET object.
For example: update A with DotNet.System.Drawing.Font ("david",0).
|
.NET variables in Magic xpa represent .NET objects. The .NET variable keeps only a reference to the .NET object; therefore, any properties of the .NET object are not stored in the Magic xpa .NET variable. For a more detailed explanation, see .NET Variables vs .NET Objects.
|