Requirement


How to do in PNG/GIF

WinGraphviz ver1.0.2.15 之后的版本,使用宋体为预设字型.

WinGraphviz ver1.0.2.15 使用 Windows 预设Codepage为处理编码格式,在非简体中文的Windows平台需指定 Codepage = 936.

* 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 = 936

                

        '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 [fontname=""黑体"" label=""张无忌"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   actor2 [fontname=""黑体"" label=""张三丰"" ];" + vbcrlf

                strCMD2 = strCMD2 + "   actor3 [fontname=""SimHei"" 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.