Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / C#

A tool for making C# decorators/proxies

Rate me:
Please Sign up or sign in to vote.
4.94/5 (27 votes)
6 Dec 2008CPOL4 min read 60.6K   485   82  
Describes a small VS add-in for making decorators from existing code.
namespace Pfactor
{
  partial class DecoratorForm
  {
		#region�Fields�(10)�

    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;
    private System.Windows.Forms.ImageList imageList;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
    private System.Windows.Forms.TextBox tbClassName;
    private System.Windows.Forms.TreeView theTree;
    private System.Windows.Forms.Panel topPanel;

		#endregion�Fields�

		#region�Methods�(1)�

		//�Protected�Methods�(1)�

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

		#endregion�Methods�



    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.components = new System.ComponentModel.Container();
      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DecoratorForm));
      this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
      this.theTree = new System.Windows.Forms.TreeView();
      this.imageList = new System.Windows.Forms.ImageList(this.components);
      this.topPanel = new System.Windows.Forms.Panel();
      this.label1 = new System.Windows.Forms.Label();
      this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
      this.label2 = new System.Windows.Forms.Label();
      this.tbClassName = new System.Windows.Forms.TextBox();
      this.btnOK = new System.Windows.Forms.Button();
      this.tableLayoutPanel1.SuspendLayout();
      this.topPanel.SuspendLayout();
      this.tableLayoutPanel2.SuspendLayout();
      this.SuspendLayout();
      // 
      // tableLayoutPanel1
      // 
      this.tableLayoutPanel1.ColumnCount = 1;
      this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
      this.tableLayoutPanel1.Controls.Add(this.theTree, 0, 2);
      this.tableLayoutPanel1.Controls.Add(this.topPanel, 0, 0);
      this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1);
      this.tableLayoutPanel1.Controls.Add(this.btnOK, 0, 3);
      this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
      this.tableLayoutPanel1.Name = "tableLayoutPanel1";
      this.tableLayoutPanel1.RowCount = 4;
      this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
      this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
      this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
      this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
      this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
      this.tableLayoutPanel1.Size = new System.Drawing.Size(484, 364);
      this.tableLayoutPanel1.TabIndex = 0;
      // 
      // theTree
      // 
      this.theTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                  | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.theTree.CheckBoxes = true;
      this.theTree.ImageIndex = 0;
      this.theTree.ImageList = this.imageList;
      this.theTree.Location = new System.Drawing.Point(5, 73);
      this.theTree.Margin = new System.Windows.Forms.Padding(5, 0, 5, 5);
      this.theTree.Name = "theTree";
      this.theTree.SelectedImageIndex = 0;
      this.theTree.Size = new System.Drawing.Size(474, 258);
      this.theTree.TabIndex = 1;
      this.theTree.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.theTree_AfterCheck);
      // 
      // imageList
      // 
      this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
      this.imageList.Images.SetKeyName(0, "Namespace.gif");
      this.imageList.Images.SetKeyName(1, "Class.png");
      // 
      // topPanel
      // 
      this.topPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                  | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.topPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
      this.topPanel.Controls.Add(this.label1);
      this.topPanel.ForeColor = System.Drawing.SystemColors.ControlText;
      this.topPanel.Location = new System.Drawing.Point(5, 5);
      this.topPanel.Margin = new System.Windows.Forms.Padding(5, 5, 5, 0);
      this.topPanel.MinimumSize = new System.Drawing.Size(2, 30);
      this.topPanel.Name = "topPanel";
      this.topPanel.Size = new System.Drawing.Size(474, 30);
      this.topPanel.TabIndex = 2;
      // 
      // label1
      // 
      this.label1.AutoEllipsis = true;
      this.label1.BackColor = System.Drawing.Color.White;
      this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.label1.Location = new System.Drawing.Point(0, 0);
      this.label1.Margin = new System.Windows.Forms.Padding(5);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(472, 28);
      this.label1.TabIndex = 1;
      this.label1.Text = " Please select a class or classes to decorate.";
      this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
      // 
      // tableLayoutPanel2
      // 
      this.tableLayoutPanel2.ColumnCount = 2;
      this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
      this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
      this.tableLayoutPanel2.Controls.Add(this.label2, 0, 0);
      this.tableLayoutPanel2.Controls.Add(this.tbClassName, 1, 0);
      this.tableLayoutPanel2.Location = new System.Drawing.Point(5, 40);
      this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(5);
      this.tableLayoutPanel2.Name = "tableLayoutPanel2";
      this.tableLayoutPanel2.RowCount = 1;
      this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
      this.tableLayoutPanel2.Size = new System.Drawing.Size(474, 28);
      this.tableLayoutPanel2.TabIndex = 4;
      // 
      // label2
      // 
      this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
      this.label2.AutoSize = true;
      this.label2.Location = new System.Drawing.Point(3, 7);
      this.label2.Name = "label2";
      this.label2.Size = new System.Drawing.Size(67, 13);
      this.label2.TabIndex = 0;
      this.label2.Text = "Class name:";
      // 
      // tbClassName
      // 
      this.tbClassName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
      this.tbClassName.Location = new System.Drawing.Point(73, 3);
      this.tbClassName.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
      this.tbClassName.Name = "tbClassName";
      this.tbClassName.Size = new System.Drawing.Size(401, 22);
      this.tbClassName.TabIndex = 1;
      this.tbClassName.Text = "MyDecorator";
      // 
      // btnOK
      // 
      this.btnOK.Anchor = System.Windows.Forms.AnchorStyles.Right;
      this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
      this.btnOK.Enabled = false;
      this.btnOK.Location = new System.Drawing.Point(404, 336);
      this.btnOK.Margin = new System.Windows.Forms.Padding(5, 0, 5, 5);
      this.btnOK.Name = "btnOK";
      this.btnOK.Size = new System.Drawing.Size(75, 23);
      this.btnOK.TabIndex = 5;
      this.btnOK.Text = "OK";
      this.btnOK.UseVisualStyleBackColor = true;
      this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
      // 
      // DecoratorForm
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(484, 364);
      this.Controls.Add(this.tableLayoutPanel1);
      this.DoubleBuffered = true;
      this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
      this.MaximizeBox = false;
      this.MinimizeBox = false;
      this.Name = "DecoratorForm";
      this.ShowIcon = false;
      this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
      this.Text = "Add Decorator";
      this.Load += new System.EventHandler(this.DecoratorForm_Load);
      this.tableLayoutPanel1.ResumeLayout(false);
      this.topPanel.ResumeLayout(false);
      this.tableLayoutPanel2.ResumeLayout(false);
      this.tableLayoutPanel2.PerformLayout();
      this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.Button btnOK;
  }
}

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
Founder ActiveMesa
United Kingdom United Kingdom
I work primarily with the .NET technology stack, and specialize in accelerated code production via code generation (static or dynamic), aspect-oriented programming, MDA, domain-specific languages and anything else that gets products out the door faster. My languages of choice are C# and C++, though I'm open to suggestions.

Comments and Discussions