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

Moveable Resizable Objects

Rate me:
Please Sign up or sign in to vote.
4.98/5 (59 votes)
9 Oct 2009CPOL198 min read 125.7K   8.7K   178  
Here is a description of an extremely powerful mechanism that makes screen objects moveable and resizable.
namespace Test_MoveGraphLibrary
{
    partial class Form_Profiles
    {
        /// <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 .contextMenuOnDot = new System .Windows .Forms .ContextMenuStrip (this .components);
            this .miDeleteNode = new System .Windows .Forms .ToolStripMenuItem ();
            this .buttonCovers = new System .Windows .Forms .Button ();
            this .toolTip1 = new System .Windows .Forms .ToolTip (this .components);
            this .contextMenuOnScale = new System .Windows .Forms .ContextMenuStrip (this .components);
            this .miFlipScale = new System .Windows .Forms .ToolStripMenuItem ();
            this .miHideScale = new System .Windows .Forms .ToolStripMenuItem ();
            this .contextMenuOnDot .SuspendLayout ();
            this .contextMenuOnScale .SuspendLayout ();
            this .SuspendLayout ();
            // 
            // contextMenuOnDot
            // 
            this .contextMenuOnDot .Items .AddRange (new System .Windows .Forms .ToolStripItem [] {
            this.miDeleteNode});
            this .contextMenuOnDot .Name = "contextMenuOnDot";
            this .contextMenuOnDot .Size = new System .Drawing .Size (197, 26);
            // 
            // miDeleteNode
            // 
            this .miDeleteNode .Name = "miDeleteNode";
            this .miDeleteNode .Size = new System .Drawing .Size (196, 22);
            this .miDeleteNode .Text = "Delete this node";
            this .miDeleteNode .Click += new System .EventHandler (this .Click_miDeleteNode);
            // 
            // buttonCovers
            // 
            this .buttonCovers .Image = global::Test_MoveGraphLibrary .Properties .Resources .Contours;
            this .buttonCovers .Location = new System .Drawing .Point (12, 12);
            this .buttonCovers .Name = "buttonCovers";
            this .buttonCovers .Size = new System .Drawing .Size (28, 28);
            this .buttonCovers .TabIndex = 2;
            this .toolTip1 .SetToolTip (this .buttonCovers, "Covers ON / OFF");
            this .buttonCovers .UseVisualStyleBackColor = true;
            this .buttonCovers .Click += new System .EventHandler (this .Click_btnCovers);
            // 
            // toolTip1
            // 
            this .toolTip1 .ShowAlways = true;
            // 
            // contextMenuOnScale
            // 
            this .contextMenuOnScale .Items .AddRange (new System .Windows .Forms .ToolStripItem [] {
            this.miFlipScale,
            this.miHideScale});
            this .contextMenuOnScale .Name = "contextMenuOnScale";
            this .contextMenuOnScale .Size = new System .Drawing .Size (157, 48);
            // 
            // miFlipScale
            // 
            this .miFlipScale .Name = "miFlipScale";
            this .miFlipScale .Size = new System .Drawing .Size (156, 22);
            this .miFlipScale .Text = "Flip scale";
            this .miFlipScale .Click += new System .EventHandler (this .Click_miFlipScale);
            // 
            // miHideScale
            // 
            this .miHideScale .Name = "miHideScale";
            this .miHideScale .Size = new System .Drawing .Size (156, 22);
            this .miHideScale .Text = "Hide scale";
            this .miHideScale .Click += new System .EventHandler (this .Click_miHideScale);
            // 
            // Form_Profiles
            // 
            this .AutoScaleDimensions = new System .Drawing .SizeF (8F, 16F);
            this .AutoScaleMode = System .Windows .Forms .AutoScaleMode .Font;
            this .ClientSize = new System .Drawing .Size (811, 578);
            this .Controls .Add (this .buttonCovers);
            this .DoubleBuffered = true;
            this .MaximizeBox = false;
            this .MinimizeBox = false;
            this .Name = "Form_Profiles";
            this .Text = "Profiles on graphical area and Rectangle";
            this .MouseUp += new System .Windows .Forms .MouseEventHandler (this .OnMouseUp);
            this .MouseDoubleClick += new System .Windows .Forms .MouseEventHandler (this .OnMouseDoubleClick);
            this .Paint += new System .Windows .Forms .PaintEventHandler (this .OnPaint);
            this .ContextMenuStripChanged += new System .EventHandler (this .OnContextMenuChanged);
            this .MouseCaptureChanged += new System .EventHandler (this .OnMouseCaptureChanged);
            this .MouseDown += new System .Windows .Forms .MouseEventHandler (this .OnMouseDown);
            this .MouseMove += new System .Windows .Forms .MouseEventHandler (this .OnMouseMove);
            this .contextMenuOnDot .ResumeLayout (false);
            this .contextMenuOnScale .ResumeLayout (false);
            this .ResumeLayout (false);

        }

        #endregion

        private System .Windows .Forms .Button buttonCovers;
        private System .Windows .Forms .ContextMenuStrip contextMenuOnDot;
        private System .Windows .Forms .ToolStripMenuItem miDeleteNode;
        private System .Windows .Forms .ToolTip toolTip1;
        private System .Windows .Forms .ContextMenuStrip contextMenuOnScale;
        private System .Windows .Forms .ToolStripMenuItem miFlipScale;
        private System .Windows .Forms .ToolStripMenuItem miHideScale;
    }
}

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