C# Writing a chm viewer [closed]

纵饮孤独 提交于 2019-12-23 06:29:42

问题


I want to write CHM viewer in C#. What resources/information could help me do that?


回答1:


I have written a chm viewer, in C++, as part of SumatraPDF (http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html). It's open-source so you could port the code to C# (http://code.google.com/p/sumatrapdf/).

There are just a few parts to chm reader:

  • parse CHM file format, extract *.html pages and other files inside CHM file. In Sumatra we use use CHMLib (http://www.jedrea.com/chmlib/) but there are other libraries (http://bonedaddy.net/pabs3/code/#hhm)
  • display .html pages, which is very easy in C#/.NET by using a web browser control
  • there are additional features you might want to implement like table of contents. Table of contents requires parsing out a CHMindex file and building a tree view with nodes (you can look at http://code.google.com/p/sumatrapdf/source/browse/trunk/src/ChmEngine.cpp for how we do it in Sumatra)



回答2:


It probably won't be too difficult. You can take a look at this http://savannah.nongnu.org/projects/chmspec which is a good guess at the chm file format as microsoft have never released the official spec. On the surface it is basically a collection of zipped html files. Once unzipped you could open the html files in an embedded browser control. The normal browser control is IE based but there are projects underway to create chrome and firefox embeddible controls.



来源:https://stackoverflow.com/questions/3270455/c-sharp-writing-a-chm-viewer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!