Click here to Skip to main content
15,892,839 members
Articles / Programming Languages / C#

The theory of moveable objects

Rate me:
Please Sign up or sign in to vote.
5.00/5 (126 votes)
24 Jan 2010CPOL97 min read 120.1K   3.2K   230  
This article describes an algorithm by which an object of an arbitrary shape can be made moveable and resizable.
namespace TheoryOfMoveableObjects
{
    partial class Form_Groups
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System .ComponentModel .IContainer components = null;

        /// <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);
        }

        #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 ();
            this .btnCovers = new System .Windows .Forms .Button ();
            this .comboUnicoloured = new System .Windows .Forms .ComboBox ();
            this .numericUD_Apexes = new System .Windows .Forms .NumericUpDown ();
            this .btnUniColor = new System .Windows .Forms .Button ();
            this .btnAddUnicoloured = new System .Windows .Forms .Button ();
            this .listColors = new System .Windows .Forms .ListView ();
            this .columnHeader1 = new System .Windows .Forms .ColumnHeader ();
            this .columnHeader2 = new System .Windows .Forms .ColumnHeader ();
            this .comboMulticoloured = new System .Windows .Forms .ComboBox ();
            this .btnAddMultiColoured = new System .Windows .Forms .Button ();
            this .textStreet = new System .Windows .Forms .TextBox ();
            this .textZipCode = new System .Windows .Forms .TextBox ();
            this .textTown = new System .Windows .Forms .TextBox ();
            this .textProvince = new System .Windows .Forms .TextBox ();
            this .textCountry = new System .Windows .Forms .TextBox ();
            this .menuOnFigures = new System .Windows .Forms .ContextMenuStrip (this .components);
            this .miDelete = new System .Windows .Forms .ToolStripMenuItem ();
            this .miPutOnTop = new System .Windows .Forms .ToolStripMenuItem ();
            this .miOneLevelUp = new System .Windows .Forms .ToolStripMenuItem ();
            this .miOneLevelDown = new System .Windows .Forms .ToolStripMenuItem ();
            this .miPutUnderneath = new System .Windows .Forms .ToolStripMenuItem ();
            this .toolStripSeparator1 = new System .Windows .Forms .ToolStripSeparator ();
            this .miColor = new System .Windows .Forms .ToolStripMenuItem ();
            this .miDuplicate = new System .Windows .Forms .ToolStripMenuItem ();
            this .toolStripSeparator2 = new System .Windows .Forms .ToolStripSeparator ();
            this .miDeleteAll = new System .Windows .Forms .ToolStripMenuItem ();
            ((System .ComponentModel .ISupportInitialize) (this .numericUD_Apexes)) .BeginInit ();
            this .menuOnFigures .SuspendLayout ();
            this .SuspendLayout ();
            // 
            // btnCovers
            // 
            this .btnCovers .Image = global::TheoryOfMoveableObjects .Properties .Resources .Covers;
            this .btnCovers .Location = new System .Drawing .Point (12, 12);
            this .btnCovers .Name = "btnCovers";
            this .btnCovers .Size = new System .Drawing .Size (28, 28);
            this .btnCovers .TabIndex = 2;
            this .btnCovers .UseVisualStyleBackColor = true;
            this .btnCovers .Click += new System .EventHandler (this .Click_btnCovers);
            // 
            // comboUnicoloured
            // 
            this .comboUnicoloured .DropDownStyle = System .Windows .Forms .ComboBoxStyle .DropDownList;
            this .comboUnicoloured .FormattingEnabled = true;
            this .comboUnicoloured .Items .AddRange (new object [] {
            "Rectangle",
            "Regular polygon",
            "Perforated polygon",
            "Strip"});
            this .comboUnicoloured .Location = new System .Drawing .Point (45, 84);
            this .comboUnicoloured .Name = "comboUnicoloured";
            this .comboUnicoloured .Size = new System .Drawing .Size (156, 24);
            this .comboUnicoloured .TabIndex = 3;
            this .comboUnicoloured .SelectedIndexChanged += new System .EventHandler (this .SelectedIndexChanged_comboShape);
            // 
            // numericUD_Apexes
            // 
            this .numericUD_Apexes .Location = new System .Drawing .Point (45, 114);
            this .numericUD_Apexes .Maximum = new decimal (new int [] {
            12,
            0,
            0,
            0});
            this .numericUD_Apexes .Minimum = new decimal (new int [] {
            3,
            0,
            0,
            0});
            this .numericUD_Apexes .Name = "numericUD_Apexes";
            this .numericUD_Apexes .Size = new System .Drawing .Size (48, 22);
            this .numericUD_Apexes .TabIndex = 21;
            this .numericUD_Apexes .TextAlign = System .Windows .Forms .HorizontalAlignment .Center;
            this .numericUD_Apexes .Value = new decimal (new int [] {
            6,
            0,
            0,
            0});
            this .numericUD_Apexes .ValueChanged += new System .EventHandler (this .ValueChanged_numericApexes);
            // 
            // btnUniColor
            // 
            this .btnUniColor .Image = global::TheoryOfMoveableObjects .Properties .Resources .palette_;
            this .btnUniColor .Location = new System .Drawing .Point (45, 198);
            this .btnUniColor .Name = "btnUniColor";
            this .btnUniColor .Size = new System .Drawing .Size (28, 28);
            this .btnUniColor .TabIndex = 22;
            this .btnUniColor .UseVisualStyleBackColor = true;
            this .btnUniColor .Click += new System .EventHandler (this .Click_btnUniColor);
            // 
            // btnAddUnicoloured
            // 
            this .btnAddUnicoloured .Location = new System .Drawing .Point (101, 198);
            this .btnAddUnicoloured .Name = "btnAddUnicoloured";
            this .btnAddUnicoloured .Size = new System .Drawing .Size (100, 28);
            this .btnAddUnicoloured .TabIndex = 23;
            this .btnAddUnicoloured .Text = "Add";
            this .btnAddUnicoloured .UseVisualStyleBackColor = true;
            this .btnAddUnicoloured .Click += new System .EventHandler (this .Click_btnAddUnicoloured);
            // 
            // listColors
            // 
            this .listColors .Columns .AddRange (new System .Windows .Forms .ColumnHeader [] {
            this.columnHeader1,
            this.columnHeader2});
            this .listColors .HeaderStyle = System .Windows .Forms .ColumnHeaderStyle .Nonclickable;
            this .listColors .HideSelection = false;
            this .listColors .Location = new System .Drawing .Point (610, 31);
            this .listColors .Name = "listColors";
            this .listColors .OwnerDraw = true;
            this .listColors .Size = new System .Drawing .Size (164, 152);
            this .listColors .TabIndex = 24;
            this .listColors .UseCompatibleStateImageBehavior = false;
            this .listColors .View = System .Windows .Forms .View .Details;
            this .listColors .DrawColumnHeader += new System .Windows .Forms .DrawListViewColumnHeaderEventHandler (this .DrawColumnHeader_list);
            this .listColors .SelectedIndexChanged += new System .EventHandler (this .SelectedIndexChanged_listColors);
            this .listColors .DrawSubItem += new System .Windows .Forms .DrawListViewSubItemEventHandler (this .DrawSubItem_list);
            // 
            // columnHeader1
            // 
            this .columnHeader1 .Text = "Name";
            this .columnHeader1 .Width = 110;
            // 
            // columnHeader2
            // 
            this .columnHeader2 .Text = "Clr";
            this .columnHeader2 .Width = 30;
            // 
            // comboMulticoloured
            // 
            this .comboMulticoloured .DropDownStyle = System .Windows .Forms .ComboBoxStyle .DropDownList;
            this .comboMulticoloured .FormattingEnabled = true;
            this .comboMulticoloured .Items .AddRange (new object [] {
            "Circle",
            "Ring"});
            this .comboMulticoloured .Location = new System .Drawing .Point (610, 217);
            this .comboMulticoloured .Name = "comboMulticoloured";
            this .comboMulticoloured .Size = new System .Drawing .Size (100, 24);
            this .comboMulticoloured .TabIndex = 25;
            this .comboMulticoloured .SelectedIndexChanged += new System .EventHandler (this .SelectedIndexChanged_comboShape2);
            // 
            // btnAddMultiColoured
            // 
            this .btnAddMultiColoured .Enabled = false;
            this .btnAddMultiColoured .Location = new System .Drawing .Point (610, 256);
            this .btnAddMultiColoured .Name = "btnAddMultiColoured";
            this .btnAddMultiColoured .Size = new System .Drawing .Size (100, 28);
            this .btnAddMultiColoured .TabIndex = 26;
            this .btnAddMultiColoured .Text = "Add";
            this .btnAddMultiColoured .UseVisualStyleBackColor = true;
            this .btnAddMultiColoured .Click += new System .EventHandler (this .Click_btnAddMultiColoured);
            // 
            // textStreet
            // 
            this .textStreet .Location = new System .Drawing .Point (82, 344);
            this .textStreet .MaximumSize = new System .Drawing .Size (600, 22);
            this .textStreet .MinimumSize = new System .Drawing .Size (100, 22);
            this .textStreet .Name = "textStreet";
            this .textStreet .Size = new System .Drawing .Size (152, 22);
            this .textStreet .TabIndex = 45;
            // 
            // textZipCode
            // 
            this .textZipCode .Location = new System .Drawing .Point (144, 456);
            this .textZipCode .MaximumSize = new System .Drawing .Size (200, 22);
            this .textZipCode .MinimumSize = new System .Drawing .Size (60, 22);
            this .textZipCode .Name = "textZipCode";
            this .textZipCode .Size = new System .Drawing .Size (90, 22);
            this .textZipCode .TabIndex = 46;
            // 
            // textTown
            // 
            this .textTown .Location = new System .Drawing .Point (82, 372);
            this .textTown .MaximumSize = new System .Drawing .Size (300, 22);
            this .textTown .MinimumSize = new System .Drawing .Size (100, 22);
            this .textTown .Name = "textTown";
            this .textTown .Size = new System .Drawing .Size (152, 22);
            this .textTown .TabIndex = 44;
            // 
            // textProvince
            // 
            this .textProvince .Location = new System .Drawing .Point (82, 400);
            this .textProvince .MaximumSize = new System .Drawing .Size (300, 22);
            this .textProvince .MinimumSize = new System .Drawing .Size (100, 22);
            this .textProvince .Name = "textProvince";
            this .textProvince .Size = new System .Drawing .Size (152, 22);
            this .textProvince .TabIndex = 43;
            // 
            // textCountry
            // 
            this .textCountry .Location = new System .Drawing .Point (82, 428);
            this .textCountry .MaximumSize = new System .Drawing .Size (300, 22);
            this .textCountry .MinimumSize = new System .Drawing .Size (100, 22);
            this .textCountry .Name = "textCountry";
            this .textCountry .Size = new System .Drawing .Size (152, 22);
            this .textCountry .TabIndex = 42;
            // 
            // menuOnFigures
            // 
            this .menuOnFigures .Items .AddRange (new System .Windows .Forms .ToolStripItem [] {
            this.miPutOnTop,
            this.miOneLevelUp,
            this.miOneLevelDown,
            this.miPutUnderneath,
            this.toolStripSeparator1,
            this.miColor,
            this.miDuplicate,
            this.miDelete,
            this.toolStripSeparator2,
            this.miDeleteAll});
            this .menuOnFigures .Name = "menuOnFigures";
            this .menuOnFigures .ShowImageMargin = false;
            this .menuOnFigures .Size = new System .Drawing .Size (204, 214);
            this .menuOnFigures .Opening += new System .ComponentModel .CancelEventHandler (this .OnOpening_menuOnFigures);
            // 
            // miDelete
            // 
            this .miDelete .Name = "miDelete";
            this .miDelete .Size = new System .Drawing .Size (203, 22);
            this .miDelete .Text = "Delete";
            this .miDelete .Click += new System .EventHandler (this .Click_miDelete);
            // 
            // miPutOnTop
            // 
            this .miPutOnTop .Name = "miPutOnTop";
            this .miPutOnTop .Size = new System .Drawing .Size (203, 22);
            this .miPutOnTop .Text = "Put on top";
            this .miPutOnTop .Click += new System .EventHandler (this .Click_miPutOnTop);
            // 
            // miOneLevelUp
            // 
            this .miOneLevelUp .Name = "miOneLevelUp";
            this .miOneLevelUp .Size = new System .Drawing .Size (203, 22);
            this .miOneLevelUp .Text = "Move one level up";
            this .miOneLevelUp .Click += new System .EventHandler (this .Click_miOneLevelUp);
            // 
            // miOneLevelDown
            // 
            this .miOneLevelDown .Name = "miOneLevelDown";
            this .miOneLevelDown .Size = new System .Drawing .Size (203, 22);
            this .miOneLevelDown .Text = "Move one level down";
            this .miOneLevelDown .Click += new System .EventHandler (this .Click_miOneLevelDown);
            // 
            // miPutUnderneath
            // 
            this .miPutUnderneath .Name = "miPutUnderneath";
            this .miPutUnderneath .Size = new System .Drawing .Size (203, 22);
            this .miPutUnderneath .Text = "Put underneath";
            this .miPutUnderneath .Click += new System .EventHandler (this .Click_miPutUnderneath);
            // 
            // toolStripSeparator1
            // 
            this .toolStripSeparator1 .Name = "toolStripSeparator1";
            this .toolStripSeparator1 .Size = new System .Drawing .Size (200, 6);
            // 
            // miColor
            // 
            this .miColor .Name = "miColor";
            this .miColor .Size = new System .Drawing .Size (203, 22);
            this .miColor .Text = "Color...";
            this .miColor .Click += new System .EventHandler (this .Click_miColor);
            // 
            // miDuplicate
            // 
            this .miDuplicate .Name = "miDuplicate";
            this .miDuplicate .Size = new System .Drawing .Size (203, 22);
            this .miDuplicate .Text = "Duplicate";
            this .miDuplicate .Click += new System .EventHandler (this .Click_miDuplicate);
            // 
            // toolStripSeparator2
            // 
            this .toolStripSeparator2 .Name = "toolStripSeparator2";
            this .toolStripSeparator2 .Size = new System .Drawing .Size (200, 6);
            // 
            // miDeleteAll
            // 
            this .miDeleteAll .Name = "miDeleteAll";
            this .miDeleteAll .Size = new System .Drawing .Size (203, 22);
            this .miDeleteAll .Text = "Delete all";
            this .miDeleteAll .Click += new System .EventHandler (this .Click_miDeleteAll);
            // 
            // Form_Groups
            // 
            this .AutoScaleDimensions = new System .Drawing .SizeF (8F, 16F);
            this .AutoScaleMode = System .Windows .Forms .AutoScaleMode .Font;
            this .ClientSize = new System .Drawing .Size (818, 591);
            this .Controls .Add (this .btnCovers);
            this .Controls .Add (this .textStreet);
            this .Controls .Add (this .textZipCode);
            this .Controls .Add (this .textTown);
            this .Controls .Add (this .textProvince);
            this .Controls .Add (this .textCountry);
            this .Controls .Add (this .btnAddUnicoloured);
            this .Controls .Add (this .btnAddMultiColoured);
            this .Controls .Add (this .comboMulticoloured);
            this .Controls .Add (this .listColors);
            this .Controls .Add (this .btnUniColor);
            this .Controls .Add (this .numericUD_Apexes);
            this .Controls .Add (this .comboUnicoloured);
            this .DoubleBuffered = true;
            this .MaximizeBox = false;
            this .MinimizeBox = false;
            this .Name = "Form_Groups";
            this .ShowIcon = false;
            this .Text = "Groups";
            this .MouseUp += new System .Windows .Forms .MouseEventHandler (this .OnMouseUp);
            this .Paint += new System .Windows .Forms .PaintEventHandler (this .OnPaint);
            this .ContextMenuStripChanged += new System .EventHandler (this .OnContextMenuChanged);
            this .MouseDown += new System .Windows .Forms .MouseEventHandler (this .OnMouseDown);
            this .MouseMove += new System .Windows .Forms .MouseEventHandler (this .OnMouseMove);
            ((System .ComponentModel .ISupportInitialize) (this .numericUD_Apexes)) .EndInit ();
            this .menuOnFigures .ResumeLayout (false);
            this .ResumeLayout (false);
            this .PerformLayout ();

        }

        #endregion

        private System .Windows .Forms .Button btnCovers;
        private System .Windows .Forms .ComboBox comboUnicoloured;
        private System .Windows .Forms .NumericUpDown numericUD_Apexes;
        private System .Windows .Forms .Button btnUniColor;
        private System .Windows .Forms .Button btnAddUnicoloured;
        private System .Windows .Forms .ListView listColors;
        private System .Windows .Forms .ColumnHeader columnHeader1;
        private System .Windows .Forms .ColumnHeader columnHeader2;
        private System .Windows .Forms .ComboBox comboMulticoloured;
        private System .Windows .Forms .Button btnAddMultiColoured;
        private System .Windows .Forms .TextBox textStreet;
        private System .Windows .Forms .TextBox textZipCode;
        private System .Windows .Forms .TextBox textTown;
        private System .Windows .Forms .TextBox textProvince;
        private System .Windows .Forms .TextBox textCountry;
        private System .Windows .Forms .ContextMenuStrip menuOnFigures;
        private System .Windows .Forms .ToolStripMenuItem miDelete;
        private System .Windows .Forms .ToolStripMenuItem miPutOnTop;
        private System .Windows .Forms .ToolStripMenuItem miOneLevelUp;
        private System .Windows .Forms .ToolStripMenuItem miOneLevelDown;
        private System .Windows .Forms .ToolStripMenuItem miPutUnderneath;
        private System .Windows .Forms .ToolStripSeparator toolStripSeparator1;
        private System .Windows .Forms .ToolStripMenuItem miColor;
        private System .Windows .Forms .ToolStripMenuItem miDuplicate;
        private System .Windows .Forms .ToolStripSeparator toolStripSeparator2;
        private System .Windows .Forms .ToolStripMenuItem miDeleteAll;
    }
}

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
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions