Requirement


How to do in PNG/GIF

WinGraphviz ver1.0.2.15 之後的版本,使用新細明體為預設字型.

WinGraphviz ver1.0.2.15 使用 Windows 預設Codepage為處理編碼格式,在非繁體中文的Windows平台需指定 Codepage = 950.

* Step1 : Sample Program in VBScript.

       

        'Create DOT Object 

                Dim dot

                Set dot = CreateObject("Wingraphviz.dot")

                

                

                if dot is Nothing then

                                Msgbox "Unable to load the object Wingraphviz.dot"      

                end if

                

                dot.Codepage = 950

                

        'Sample data of DOT                     

                

                strCMD2 = strCMD2 + "digraph prof {     " + vbcrlf

                strCMD2 = strCMD2 + "start [fontname=""標楷體"" label=""金庸群俠傳"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   book1 [fontname=""標楷體"" label=""倚天屠龍記"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   book2 [fontname=""標楷體"" label=""雪山飛狐"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   book3 [fontname=""標楷體"" label=""天龍八部"" ];" + vbcrlf

                        

                strCMD2 = strCMD2 + "   actor1 [ label=""張無忌"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   actor2 [ label=""張三丰"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   actor3 [ label=""趙敏"" ];" + vbcrlf

                        

                strCMD2 = strCMD2 + "   start->book1;" + vbcrlf

                strCMD2 = strCMD2 + "   start->book2;" + vbcrlf

                strCMD2 = strCMD2 + "   start->book3;" + vbcrlf

                                       

                strCMD2 = strCMD2 + "   book1->actor1 [ label=""主角"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   book1->actor2 [ label=""配角"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   book1->actor3 [ label=""配角"" ];" + vbcrlf 

                

                strCMD2 = strCMD2 + "}" + vbcrlf

        

        

        'Check DOT Format

                if(not dot.Validate(strCMD2)) then

                        msgbox "DOT Format Error"

                End if                          

                        

                

        'Generate BinaryImage(PNG)      

                Dim Img         

                Set Img = dot.ToPNG(strCMD2)

                                

                if Img is Nothing then

                        Msgbox "Unable to generate to PNG"      

                end if                          

        

                Dim FilePath

                FilePath = "c:\test.PNG"

                                                

                if Img.save(FilePath) then

                        

                        Msgbox "BinaryImage Type is " + Img.Type + vbcrlf + _

                                        "Save Image at " + FilePath

                else

                        Msgbox "Unable to save image at " + FilePath            

                end if          

                                        

        

        'Release Resource                               

                Set Img = Nothing

                

                Set obj = Nothing

        

	

* Step2 : save it in "c:\test.vbs" and exec it.

* Step3 : Result


Feedback

Submit bug reports or suggestions for the WinGraphviz ood Tsen.