Use WinGraphviz with "Picture control" in Visual Basic |
|||
| Requirement | How to do | Download this sample Code | Download additional sample Code | |||
Requirement
How to do
* Step1 : install WinGraphviz first
* Step2 : Open a Visual Basic Project
* Step3 : Drog a PictureBox control to your form and rename it to "ctlPicture"
Set the property AutoSize = True
* Step4 : Drog a TextBox to your form and rename it to "txtInput"
Set the property Multiline = True
add the following dot language in txtInput.Text property
digraph Alf {
size = "6,9";
node [ shape = record ];
Decl [ label = "\n\nDecl|{name|access|decl_flags|extern_c_linkage}"];
Nontype_decl [ label = "Nontype_decl|{type}"];
Defined_decl [ label = "Defined_decl|{linkage}"];
Data_decl [ label = "Data_decl|{storage_class}"];
Function_decl [ label = "Function_decl|{formals|defaults}"];
Data [ label = "Data|{initializer}"];
Function [ label = "Function|{body}"];
Constructor [ label = "Constructor|{member_initializers}"];
Aggregate -> Type_decl ;
Class -> Aggregate;
Union -> Aggregate;
Data -> Data_decl;
Data -> Defn;
Data_decl -> Defined_decl;
Data_member -> Nontype_decl ;
Defined_decl -> Nontype_decl;
Defn -> Defined_decl;
Enum -> Type_decl ;
Enumerator -> Nontype_decl ;
Function ->Defn;
Function -> Function_decl;
Constructor ->Function;
Destructor ->Function;
Function_decl -> Defined_decl;
Nontype_decl ->Decl ;
Template_type_arg -> Type_decl ;
Type_decl -> Decl ;
Typedef -> Type_decl ;
}
|
* Step5 : Drog a Command Button to your form and rename it to "cmdExec"
Add the following code
Private Sub cmdExec_Click()
Dim obj
Set obj = CreateObject("WINGRAPHVIZ.dot")
If obj Is Nothing Then Exit Sub
Dim img
Set img = obj.ToGif(txtInput.Text)
If img Is Nothing Then Exit Sub
Set ctlPicture.Picture = img.Picture
End Sub
|
* Step6 : Build and test it!!
Submit bug reports or suggestions for the WinGraphviz ood Tsen.