When FlowChartX is imported by the .NET environment in a C# or VB.NET project a wrapper class derived from AxHost is created. The AxHost class has members BackColor and Font that overcast FlowChartX properties with the same names. To access them you have to use variable of type IFlowChart, as shown in the following C# example:
C# Copy Code |
---|
FLOWCHARTLib.IFlowChart fc = (FLOWCHARTLib.IFlowChart)axFlowChart1.GetOcx(); |
The axFlowChart1 variable is an object of the class imported by the .NET environment. Its GetOcx method returns a reference to the underlying control and the fc assignment queries it for the IFlowChart interface. The given example also illustrates how to work with FlowChartX color properties. .NET imports OLE_COLOR type as uint and System.Drawing.Color.ToOle method returns int, so a cast is needed.
There are some issues to note when working with images. In the imported FlowChart class the Picture property is of type System.Drawing.Image and you can use all Image class static members to load this Picture. The Box object Picture property on the other hand is imported as stdole.IPictureDisp and you have two options for loading images into it:
Both ways to loading a picture are shown below:
C# Copy Code |
---|
axFlowChart1.Picture = Image.FromFile("ag01.jpg"); |
Here is the definition of the Converter class, which also can convert from .NET fonts to OLE fonts:
C# Copy Code |
---|
internal class Converter : AxHost |