Click here to Skip to main content
15,896,269 members
Articles / Programming Languages / C#

Drag and Drop Windows/Form Controls (Design UI at Runtime)

Rate me:
Please Sign up or sign in to vote.
4.33/5 (24 votes)
13 Sep 2007CPOL2 min read 123.7K   9.4K   95  
Enables user to design the user interface by moving all form controls to the desired place. It allows to move the control at execution time.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using draggableControls.Resources;

namespace draggableControls
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();            
        }

        private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
        {

        }

        private void designMode_Click(object sender, EventArgs e)
        {
            dragControl1.DesignMode(true);
            
        }

        private void controlMode_Click(object sender, EventArgs e)
        {
            dragControl1.DesignMode(false);
        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}

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
Software Developer (Senior)
India India
Vikas Maan is a software developer for last 4 years working on windows platform with multiple programming languages mainly VC++, C#.net etc.

Comments and Discussions