Click here to Skip to main content
14,332,266 members

Visual Studio Editor Clone V0.1a

Rate this:
2.98 (17 votes)
Please Sign up or sign in to vote.
2.98 (17 votes)
6 Mar 2005
A clone of the Visual Studio .NET 2002 editor.

Sample Image - click to see enlarged image

Background

Following the upcoming Visual Studio components (menu bar, toolbox etc.), I decided to gather them all and implement all in one application, to be a clone of the VS 2002 .NET Editor. Thanks to all the developers writing such controls, they are extremely helpful and time saving.

Introduction

This is an alpha version of the VS Clone project and it only contains the GUI part (most of it); the plan is to reach a fully working editor, which looks like the VS Editor, only without the debugger (I lack this knowledge). Anyway, this is the first released version.

Form Control Creation

private void SetToolBox()
{
    ToolBoxControl = new ToolBox();
    //add control to form
    this.Controls.Add(ToolBoxControl);        

    //*** Add Toolbox Controls ***//

    //Add Tabs
    ToolBoxControl.AddTab("Data",0);
    ToolBoxControl.AddTab("Components",0);
    ToolBoxControl.AddTab("Windows Forms",0);
    ToolBoxControl.AddTab("General",0);

    //Add Items
    //Add Items
    ToolBoxControl[2].AddItem("Label",0,true,typeof(Label).Namespace);
    ToolBoxControl[2].AddItem("TextBox",0,true,typeof(TextBox).Namespace);
    ToolBoxControl[2].AddItem("PictureBox",0, 
                               true,typeof(PictureBox).Namespace);
    ToolBoxControl[2].AddItem("ListView",0,true,typeof(ListView).Namespace);
    ToolBoxControl[2].AddItem("ComboBox",0,true,typeof(ComboBox).Namespace);
    ToolBoxControl[2].AddItem("Button",0,true,typeof(Button).Namespace);
    ToolBoxControl[2].AddItem("CheckBox",0,true,typeof(CheckBox).Namespace);

    //*** Done Adding Items ***//

    // ** Set Visual Properties **//
    ToolBoxControl.Font = new Font("Arial",8);
    ToolBoxControl.BackColor = SystemColors.Control;
    ToolBoxControl.ItemSelectedColor = Color.LightGray;

    //scroll items up
    for (int i=0;i<5;i++)
        ToolBoxControl[2].ScrollItems(ScrollDirection.Up);

}

private void FormDisplay_DragDrop(object sender, 
             System.Windows.Forms.DragEventArgs e)
{
    try
    {
        //get drop data
        ToolBoxItem DragData = 
          (ToolBoxItem)e.Data.GetData(typeof(ToolBoxItem));

        //create a new control

        Assembly controlAsm = 
          Assembly.LoadWithPartialName(DragData.Object.ToString());
        Type controlType = 
          controlAsm.GetType(DragData.Object.ToString() 
                             + "." + DragData.Caption);

        Control newControl = 
          (Control)Activator.CreateInstance(controlType);
        //location on client form
        newControl.Location = PointToClient(new Point(e.X,e.Y));

        //default text
        newControl.Text = DragData.Caption;

        //show properties in propertygrid when clicked
        newControl.Click += new EventHandler(Control_Click);

        //add control to form
        this.Controls.Add(newControl);

        //make z-order upper
        newControl.BringToFront();

    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }                    
}

Docking all the Controls Together

private void DockControls()
{
    //Set Displayes
    DockManager.InnerControl = DisplayTabControl;
    //Right Dock
    //******** Add Toolbox
    cToolBox = DockManager.Contents.Add(ToolBoxControl,"ToolBox");
    //set the toolbox to be 1/7 of the screen
    cToolBox.DisplaySize = 
      new Size(this.ClientSize.Width / 7,this.ClientSize.Height);

    //******** Add Display Explorer
    cExplorer = DockManager.Contents.Add(DisplayTree,"Solution Explorer");
    //set the solution explorer to be 1/6 of the screen
    cExplorer.DisplaySize = 
      new Size(this.ClientSize.Width / 6,this.ClientSize.Height);

    //******** Add PropertyGrid
    cProperties = DockManager.Contents.Add(PropertyGridControl,"Proprties");

    //******** Add Output
    OutputWindow = new FormOutput();
    cOutput = DockManager.Contents.Add(OutputWindow,"Output",imageList,18);

    //******** Add Tasklist
    FormOutput TaskList = new FormOutput();
    cTaskList = DockManager.Contents.Add(TaskList,"Task List",imageList,19);

    //divide the content to two (Properties and Tree)
    wcRight = DockManager.AddContentWithState(cExplorer, State.DockRight);

    //add Properties and ProjectTree
    DockManager.AddContentToZone(cProperties,wcRight.ParentZone,1);

    //add OutputTab
    wcBottom = DockManager.AddContentWithState(cOutput,State.DockBottom);
    //add output and tasklist
    DockManager.AddContentToWindowContent(cTaskList,wcBottom);

    //Add Toolbox
    DockManager.AddContentWithState(cToolBox,State.DockLeft);

    //Set Status Bar
    DockManager.OuterControl = statusBar;

    //Resize Controls/Forms
    OutputWindow.Bounds = wcBottom.Bounds;
}

Control Links

What's Next?

Now working on enabling GUI into code - creating forms, dragging controls etc. Also creating a code editor to allow design time editing.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

nashcontrol
Web Developer
Israel Israel
No Biography provided

Comments and Discussions

 
GeneralIntellisense Editor Pin
Ashlesh15-Apr-10 21:25
memberAshlesh15-Apr-10 21:25 
GeneralERROR!!! Pin
jn-ncut2-Jul-08 0:07
memberjn-ncut2-Jul-08 0:07 
Generaldemo - error Pin
Praveen Nair (NinethSense)11-Nov-07 19:00
memberPraveen Nair (NinethSense)11-Nov-07 19:00 
GeneralShowing toolbox when closed Pin
FireFox19-Oct-07 6:37
memberFireFox19-Oct-07 6:37 
GeneralVS Clone for VS2005 Pin
zoranl18-Jan-06 11:37
memberzoranl18-Jan-06 11:37 
GeneralRe: VS Clone for VS2005 Pin
nashcontrol1-Apr-06 2:21
membernashcontrol1-Apr-06 2:21 
GeneralRe: VS Clone for VS2005 Pin
zoranl2-Apr-06 12:29
memberzoranl2-Apr-06 12:29 
QuestionRe: VS Clone for VS2005 Pin
Ashish Nagar8-Oct-06 3:26
memberAshish Nagar8-Oct-06 3:26 
GeneralRe: VS Clone for VS2005 Pin
intent2125-Dec-06 17:52
memberintent2125-Dec-06 17:52 
GeneralRe: VS Clone for VS2005 Pin
jerry_lou19744-Mar-07 20:52
memberjerry_lou19744-Mar-07 20:52 
QuestionRe: VS Clone for VS2005 Pin
kaiwnyt9-Jun-07 15:04
memberkaiwnyt9-Jun-07 15:04 
QuestionRe: VS Clone for VS2005 Pin
ww333123-Jul-07 9:11
memberww333123-Jul-07 9:11 
AnswerRe: VS Clone for VS2005 Pin
wjdong13-Sep-07 15:26
memberwjdong13-Sep-07 15:26 
GeneralRe: VS Clone for VS2005 Pin
Sergey Morenko28-Oct-07 11:02
professionalSergey Morenko28-Oct-07 11:02 
GeneralRe: VS Clone for VS2005 Pin
chen.pochuan22-Nov-07 21:45
memberchen.pochuan22-Nov-07 21:45 
QuestionWhat about SharpDevelop? Pin
SHaroz5-Mar-05 18:05
memberSHaroz5-Mar-05 18:05 
AnswerRe: What about SharpDevelop? Pin
Paul Selormey6-Mar-05 19:20
memberPaul Selormey6-Mar-05 19:20 
GeneralRe: What about SharpDevelop? Pin
SHaroz6-Mar-05 19:40
memberSHaroz6-Mar-05 19:40 
GeneralRe: What about SharpDevelop? Pin
WillemM6-Mar-05 23:55
memberWillemM6-Mar-05 23:55 
GeneralRe: What about SharpDevelop? Pin
Rikaino22-Jul-05 9:30
memberRikaino22-Jul-05 9:30 
GeneralError in Compiling Pin
Priyank Bolia5-Mar-05 2:28
memberPriyank Bolia5-Mar-05 2:28 
GeneralYa Pin
tom_dx5-Mar-05 2:23
membertom_dx5-Mar-05 2:23 
GeneralLicensing and project purpose Pin
nashcontrol5-Mar-05 4:00
membernashcontrol5-Mar-05 4:00 
GeneralRe: Licensing and project purpose Pin
Eric Woodruff5-Mar-05 10:16
professionalEric Woodruff5-Mar-05 10:16 
GeneralRe: Licensing and project purpose Pin
nashcontrol12-Mar-05 0:25
membernashcontrol12-Mar-05 0:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Article
Posted 5 Mar 2005

Stats

104.9K views
4.1K downloads
66 bookmarked