Click here to Skip to main content
15,884,388 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 118.9K   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_Rectangles
    {
        /// <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 .btnCovers = new System .Windows .Forms .Button ();
            this .numericUD_HalfStrip = new System .Windows .Forms .NumericUpDown ();
            this .numericUD_Radius = new System .Windows .Forms .NumericUpDown ();
            ((System .ComponentModel .ISupportInitialize) (this .numericUD_HalfStrip)) .BeginInit ();
            ((System .ComponentModel .ISupportInitialize) (this .numericUD_Radius)) .BeginInit ();
            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 = 1;
            this .btnCovers .UseVisualStyleBackColor = true;
            this .btnCovers .Click += new System .EventHandler (this .Click_btnCovers);
            // 
            // numericUD_HalfStrip
            // 
            this .numericUD_HalfStrip .Location = new System .Drawing .Point (369, 57);
            this .numericUD_HalfStrip .Maximum = new decimal (new int [] {
            20,
            0,
            0,
            0});
            this .numericUD_HalfStrip .Minimum = new decimal (new int [] {
            1,
            0,
            0,
            0});
            this .numericUD_HalfStrip .Name = "numericUD_HalfStrip";
            this .numericUD_HalfStrip .Size = new System .Drawing .Size (36, 22);
            this .numericUD_HalfStrip .TabIndex = 6;
            this .numericUD_HalfStrip .TextAlign = System .Windows .Forms .HorizontalAlignment .Center;
            this .numericUD_HalfStrip .Value = new decimal (new int [] {
            3,
            0,
            0,
            0});
            this .numericUD_HalfStrip .ValueChanged += new System .EventHandler (this .ValueChanged_numericHalfStrip);
            // 
            // numericUD_Radius
            // 
            this .numericUD_Radius .Location = new System .Drawing .Point (369, 29);
            this .numericUD_Radius .Maximum = new decimal (new int [] {
            20,
            0,
            0,
            0});
            this .numericUD_Radius .Minimum = new decimal (new int [] {
            1,
            0,
            0,
            0});
            this .numericUD_Radius .Name = "numericUD_Radius";
            this .numericUD_Radius .Size = new System .Drawing .Size (36, 22);
            this .numericUD_Radius .TabIndex = 5;
            this .numericUD_Radius .TextAlign = System .Windows .Forms .HorizontalAlignment .Center;
            this .numericUD_Radius .Value = new decimal (new int [] {
            6,
            0,
            0,
            0});
            this .numericUD_Radius .ValueChanged += new System .EventHandler (this .ValueChanged_numericRadius);
            // 
            // Form_Rectangles
            // 
            this .AutoScaleDimensions = new System .Drawing .SizeF (8F, 16F);
            this .AutoScaleMode = System .Windows .Forms .AutoScaleMode .Font;
            this .ClientSize = new System .Drawing .Size (605, 422);
            this .Controls .Add (this .btnCovers);
            this .Controls .Add (this .numericUD_HalfStrip);
            this .Controls .Add (this .numericUD_Radius);
            this .DoubleBuffered = true;
            this .MaximizeBox = false;
            this .MinimizeBox = false;
            this .Name = "Form_Rectangles";
            this .ShowIcon = false;
            this .Text = "Rectangles";
            this .MouseUp += new System .Windows .Forms .MouseEventHandler (this .OnMouseUp);
            this .Paint += new System .Windows .Forms .PaintEventHandler (this .OnPaint);
            this .MouseDown += new System .Windows .Forms .MouseEventHandler (this .OnMouseDown);
            this .MouseMove += new System .Windows .Forms .MouseEventHandler (this .OnMouseMove);
            ((System .ComponentModel .ISupportInitialize) (this .numericUD_HalfStrip)) .EndInit ();
            ((System .ComponentModel .ISupportInitialize) (this .numericUD_Radius)) .EndInit ();
            this .ResumeLayout (false);

        }

        #endregion

        private System .Windows .Forms .Button btnCovers;
        private System .Windows .Forms .NumericUpDown numericUD_HalfStrip;
        private System .Windows .Forms .NumericUpDown numericUD_Radius;
    }
}

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