Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

100% Reflective Class Diagram Creation Tool

, 14 Jun 2011 CPOL
100% Reflective Class Diagram Creation Tool
autodiagramer.zip
AutoDiagramer
AutoDiagramer
AutoDiagramer.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.application
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.pdb
AutoDiagramer.publish
AutoDiagramer.application
AutoDiagramer_1_7_0_0
AutoDiagramer.exe.deploy
AutoDiagramer.exe.manifest
np.ico.deploy
setup.exe
AutoDiagramer.vshost.application
AutoDiagramer.vshost.exe
AutoDiagramer.vshost.exe.manifest
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
obj
Debug
AutoDiagramer.application
AutoDiagramer.csproj.GenerateResource.Cache
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.frmAbout.resources
AutoDiagramer.frmMain.resources
AutoDiagramer.frmSave.resources
AutoDiagramer.frmSettings.resources
AutoDiagramer.frmZoom.resources
AutoDiagramer.InputBoxDialog.resources
AutoDiagramer.pdb
AutoDiagramer.Properties.Resources.resources
AutoDiagramer.Resource1.resources
AutoDiagramer.ucExpander.resources
ClassDiagFromAssembly.csproj.GenerateResource.Cache
Refactor
TempPE
Properties.Resources.Designer.cs.dll
Resource1.Designer.cs.dll
Printing
Properties
Settings.settings
Thumbs.db
autodiagramerdll.zip
AutoDiagramer.dll
autodiagrammer.zip
AutoDiagrammer
AutoDiagramerReflectorAddin
AutoDiagramerReflectorAddin.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.dll
AutoDiagramer.pdb
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
Printing
Properties
Settings.settings
Thumbs.db
AutoDiagramerStandAlone
AutoDiagramerStandAlone.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.application
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.pdb
AutoDiagramer.publish
AutoDiagramer.application
AutoDiagramer_1_12_0_0
AutoDiagramer.exe.deploy
AutoDiagramer.exe.manifest
np.ico.deploy
setup.exe
AutoDiagramer.vshost.application
AutoDiagramer.vshost.exe
AutoDiagramer.vshost.exe.manifest
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
Printing
Properties
Settings.settings
Thumbs.db
autodiagrammer2.zip
AutoDiagramer
AutoDiagramer.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.application
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.pdb
AutoDiagramer.publish
AutoDiagramer.application
AutoDiagramer_1_9_0_0
AutoDiagramer.exe.deploy
AutoDiagramer.exe.manifest
np.ico.deploy
Reflector.exe.deploy
setup.exe
AutoDiagramer.vshost.exe
Reflector.cfg
Reflector.exe
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
obj
Printing
Properties
Settings.settings
Thumbs.db
Reflector AddIn DLL
AutoDiagramer.dll
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;

namespace AutoDiagramer
{
    #region frmSettings CLASS
    /// <summary>
    /// An settings form to allow the user to tailor how the diagram is created
    /// </summary>
    public partial class frmSettings : Form
    {
        #region Constructor 
        /// <summary>
        /// Creates a new frmSettings object
        /// </summary>
        public frmSettings()
        {
            InitializeComponent();
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw |
                     ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true);
            pnlSettingsScroll.Focus();
        }
        #endregion
        #region Private Methods
        /// <summary>
        /// Custom painted panel
        /// </summary>
        /// <param name="sender">pnlSettingsBanner</param>
        /// <param name="e">the event args</param>   
        private void pnlSettingsBanner_Paint(object sender, PaintEventArgs e)
        {
            //call base class 
            base.OnPaint(e);
            //draw the rectangle
            Graphics g = e.Graphics;
            Pen p_Black = new Pen(Color.Black);
            Rectangle rBounds = new Rectangle(0, 0, pnlSettingsBanner.Size.Width, 
                pnlSettingsBanner.Size.Height);
            g.DrawRectangle(p_Black, rBounds);
            Brush b_Divot = new HatchBrush(HatchStyle.Divot, Color.Gray, Color.Black);
            g.FillRectangle(b_Divot, rBounds);
            //draw the text
            Brush b_White = new SolidBrush(Color.White);
            Font fnt = new Font("Tahoma", 8, FontStyle.Bold);
            // Draw string to screen.
            g.DrawString("Configure your settings here", fnt, b_White, new Point(5, 2));
        }

        /// <summary>
        /// Read the global vars within the <see cref="Program">Program</see>
        ///  class into the form values
        /// </summary>
        /// <param name="sender">frmSettings</param>
        /// <param name="e">the event args</param>        
        private void frmSettings_Load(object sender, EventArgs e)
        {
            //read the global vars into the form values
            chkInterfaces.Checked = Program._IncludeInterfaces;
            chkConstructors.Checked = Program._FullConstructorDescribe;
            chkFieldTypes.Checked = Program._IncludeFieldType;
            chkMethArgs.Checked = Program._IncludeMethodArgs;
            chkMethReturns.Checked = Program._IncludeMethodReturnType;
            chkMethPropGet.Checked = Program._ShowPropGetters;
            chkMethPropSet.Checked = Program._ShowPropSetters;
            chkPropTypes.Checked = Program._IncludePropValues;
            chkEvents.Checked = Program._IncludeEventType;
            chkEnums.Checked = Program._AllowEnumOnDiagram;
            chkDelegates.Checked = Program._AllowDelegatesOnDiagram;
            nudColumns.Value = Program._MAX_Columns;
            pnlClassStartCurrColor.BackColor = Program._ClassStartColor;
            pnlClassEndCurrColor.BackColor = Program._ClassEndColor;
            pnlClassBorderCurrColor.BackColor = Program._ClassBorderColor;
            cmbAccess.SelectedItem = Program._BindingFlags;

        }
        
        /// <summary>
        /// BtnOk clicked, save the settings
        /// </summary>
        /// <param name="sender">The btnOk button</param>
        /// <param name="e">the event args</param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            //apply the form values to the global vars
            Program._IncludeInterfaces = chkInterfaces.Checked;
            Program._FullConstructorDescribe = chkConstructors.Checked;
            Program._IncludeFieldType = chkFieldTypes.Checked;
            Program._IncludeMethodArgs = chkMethArgs.Checked;
            Program._IncludeMethodReturnType = chkMethReturns.Checked;
            Program._ShowPropGetters = chkMethPropGet.Checked;
            Program._ShowPropSetters = chkMethPropSet.Checked;
            Program._IncludePropValues = chkPropTypes.Checked;
            Program._IncludeEventType = chkEvents.Checked;
            Program._AllowEnumOnDiagram = chkEnums.Checked;
            Program._AllowDelegatesOnDiagram = chkDelegates.Checked;
            Program._MAX_Columns = (int)nudColumns.Value;
            Program._ClassStartColor = pnlClassStartCurrColor.BackColor;
            Program._ClassEndColor = pnlClassEndCurrColor.BackColor;
            Program._ClassBorderColor = pnlClassBorderCurrColor.BackColor;
            Program._BindingFlags = cmbAccess.SelectedItem.ToString();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        /// <summary>
        /// btnCancel clicked, Closes this form
        /// </summary>
        /// <param name="sender">the btnCancel button</param>
        /// <param name="e">the event args</param>
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        /// <summary>
        /// frmSettings shown, Set focus to the scrollable panel area
        /// </summary>
        /// <param name="sender">the frmSettings form</param>
        /// <param name="e">the event args</param>
        private void frmSettings_Shown(object sender, EventArgs e)
        {
           pnlInterfaces.Focus();
        }

        /// <summary>
        /// lnkClassStartColor clicked, so show a new class start color, color dialog
        /// and if user picks a new color assign it to be the color used to draw classes
        /// in the <see cref="Program">Program</see> class global variables
        /// </summary>
        /// <param name="sender">the lnkClassStartColor hyperlink</param>
        /// <param name="e">the event args</param>
        private void lnkClassStartColor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ColorDialog cd = new ColorDialog();
            cd.Color = pnlClassStartCurrColor.BackColor;
            if (cd.ShowDialog(this) == DialogResult.OK)
            {
                pnlClassStartCurrColor.BackColor = cd.Color;
                pnlClassStartCurrColor.Invalidate();
            }
        }

        /// <summary>
        /// lnkClassEndColor clicked, so show a new class end color, color dialog
        /// and if user picks a new color assign it to be the color used to draw classes
        /// in the <see cref="Program">Program</see> class global variables
        /// </summary>
        /// <param name="sender">the lnkClassEndColor hyperlink</param>
        /// <param name="e">the event args</param>
        private void lnkClassEndColor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ColorDialog cd = new ColorDialog();
            cd.Color = pnlClassEndCurrColor.BackColor;
            if (cd.ShowDialog(this) == DialogResult.OK)
            {
                pnlClassEndCurrColor.BackColor = cd.Color;
                pnlClassEndCurrColor.Invalidate();
            }
        }

        /// <summary>
        /// lnkClassBorderColor clicked, so show a new class border color, color dialog
        /// and if user picks a new color assign it to be the color used to draw classes
        /// in the <see cref="Program">Program</see> class global variables
        /// </summary>
        /// <param name="sender">the lnkClassBorderColor hyperlink</param>
        /// <param name="e">the event args</param>
        private void lnkClassBorderColor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ColorDialog cd = new ColorDialog();
            cd.Color = pnlClassBorderCurrColor.BackColor;
            if (cd.ShowDialog(this) == DialogResult.OK)
            {
                pnlClassBorderCurrColor.BackColor = cd.Color;
                pnlClassBorderCurrColor.Invalidate();
            }
        }
        #endregion

    }
    #endregion
}

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)

Share

About the Author

Sacha Barber
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)
 
- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence
 
Both of these at Sussex University UK.
 
Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1411028.1 | Last Updated 14 Jun 2011
Article Copyright 2007 by Sacha Barber
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid