Following section describes how to use FlowChartX ActiveX Control under Visual Basic.NET:
In VisualStudio.NET environment open "File -> New -> Project". In the dialog box that appears, select "Visual Basic Projects" from Project Types list and "Windows Application" from Templates list. Give your project a suitable name and click OK. The wizard creates a new project for you.
You can customize the project form name and appearance as you wish. To add FlowChartX control to the form, right-click "Windows Forms" tab, which stays under Toolbox docking bar. If Toolbox bar is not visible, you can make it appear choosing "View -> Toolbox" menu. Afterwards right-click Toolbox to show its context menu and choose "Customize...". From ActiveX control - list check FlowChartX control and click OK button. If FlowChartX is not in the list, make sure you have run FlowChartX installation program to register the control.
You can write your initialization code right after InitializeComponent method is invoked in the Form constructor. For example you can set default values for FlowChartX objects and/or initialize FlowChartX document - size, position, background color/image.
After FlowChartX control is added to Toolbox, you can place it in the form layout. The Visual Basic.NET environment automatically generates a member variable for the control in your form class. In addition to FlowChartX control you can add some UI components to carry out additional program functionality. In our example two buttons for easier interaction with the program are inserted - 'Modify' and 'Incoming'.
Now, with buttons ready, add some functionality to them by creating their event handlers. Double-clicking each of the buttons automatically adds Modify_Click and Incoming_Click methods to your form class, considering the buttons' names are respectively 'Modify' and 'Incoming'. The first button modifies the appearance of all selected boxes while the second one selects all incoming arrows of active selected box in the current selection. Following code snippet illustrates that:
VB Copy Code |
---|
Private Sub Modify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Modify.Click |
To handle specific event for the FlowChartX, you need to do the following steps. Go to source code editor and from the form-objects combo box (placed in upper left corner) select AxFlowChart1. Choose the event you wish to handle from right combo box, which lists all corresponding to selected object events. Visual Basic.NET environment automatically adds the event-handler method in Form class. In our example we add BoxClicked event handler. First select the event in the combo box and AxFlowChart1_BoxClicked method automatically appears at the bottom of the Form class as shown below:
Finally add following few lines to the method implementation:
VB Copy Code |
---|
Private Sub AxFlowChart1_BoxClicked(ByVal sender As Object, _ |