Click here to Skip to main content
15,885,880 members
Articles / Programming Languages / C#

AppXmlViewer: Between Doxygen and raw XML

Rate me:
Please Sign up or sign in to vote.
3.46/5 (4 votes)
5 Apr 2007CPOL6 min read 34.8K   420   19  
Utility for viewing an application's document XML in a DataGridView.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace VVX
{
    /// <summary>
    /// Form for obtaining the print options
    /// </summary>
    public partial class PrintOptions : Form
    {
        #region Constructors
        /// <summary>
        /// Constructor
        /// </summary>
        public PrintOptions()
        {
            InitializeComponent();
        }
        
        /// <summary>
        /// Constructor with list of fields to display
        /// </summary>
        /// <param name="availableFields">list of fields</param>
        public PrintOptions(List<string> availableFields)
        {
            InitializeComponent();

            foreach (string column in availableFields)
            {
                ctlColumnsToPrintCHKLBX.Items.Add(column, true);
            }
        }
        #endregion //Constructors

        #region Event Handlers
        private void OnLoadForm(object sender, EventArgs e)
        {
            // Initialize some controls
            ctlPrintAllRowsRBTN.Checked = true;
            ctlPrintToFitPageWidthCHK.Checked = true; 
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
        #endregion //Event Handlers

        /// <summary>
        /// Returns list of columns selected for printing
        /// </summary>
        /// <returns></returns>
        public List<string> GetSelectedColumns()
        {
            List<string> list = new List<string>();
            foreach (object item in ctlColumnsToPrintCHKLBX.CheckedItems)
            {
                list.Add(item.ToString());
            }
            return list;
        }

        #region Properties
        /// <summary>
        /// Set or Get Title for the printed output
        /// </summary>
        public string PrintTitle
        {
            get { return ctlPrintTitleTBX.Text; }
            set { ctlPrintTitleTBX.Text = value; }
        }

        /// <summary>
        /// Returns 'true' if all rows have to be printed
        /// </summary>
        public bool PrintAllRows
        {
            get { return ctlPrintAllRowsRBTN.Checked; }
        }

        /// <summary>
        /// Returns 'true' if all columns have to fit into the width of the page
        /// </summary>
        public bool FitToPageWidth
        {
            get { return ctlPrintToFitPageWidthCHK.Checked; }
        }
        #endregion //Properties

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
An old dog trying to learn new tricks!

Comments and Discussions