Tuesday, December 4, 2007

XML Documentation (Visual C++) Sample

XML Documentation (Visual C++) Sample

In Visual C++, you can add comments to your source code that will be processed to an .xml file. This file can then be the input to a process that creates documentation for the classes in your code. An .xml file can also be used to support IntelliSense on your component.

If you need to put XML special characters in the text of a documentation comment, you must use XML entities or a CDATA section.( meaning character data, is used for distinct, but related purposes in the markup languages SGML and XML.)

      ///<summary>Draws Image using CxImage on Print Preview,Print Device</summary>
      ///<param name="pDC"> The device context to Draw Image.</param>
      ///<param name="pCxImage">comment #2</param>
      ///<param name="bActualSize"> if bActualSize == TRUE print in orginal size
      /// else print in full screen ( ie Stretch )</param>
      /// <example> This sample shows how to call the DrawImage method.
      /// <code>
      /// void CMyImageView::OnDraw(CDC* pDC)
      /// {
      ///         BOOL bPrinting = pDC->IsPrinting();
      ///         if (!bPrinting )
      ///         {
      ///               //call orginal draw code
      ///         }
      ///         else

      ///         {
      ///               CDMPrintManager::DrawImage(pDC,&image,TRUE);   
      ///         }
      /// }
      /// </code>
      /// </example>
      void DrawImage(CDC* pDC, CxImage *pCxImage, BOOL bActualSize = TRUE);

 

No comments: