Click here to Skip to main content
Licence 
First Posted 5 Mar 2005
Views 81,849
Bookmarked 65 times

Visual Studio Editor Clone V0.1a

By | 6 Mar 2005 | Article
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

About the Author

nashcontrol

Web Developer
Indigo - Smart House Solutions
Israel Israel

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralIntellisense Editor PinmemberAshlesh21:25 15 Apr '10  
GeneralERROR!!! Pinmemberjn-ncut0:07 2 Jul '08  
What the f*** are you doing!Do not work!
Generaldemo - error PinmemberNinethSense19:00 11 Nov '07  
GeneralShowing toolbox when closed PinmemberISIAdrin6:37 19 Oct '07  
GeneralVS Clone for VS2005 Pinmemberzoranl11:37 18 Jan '06  
GeneralRe: VS Clone for VS2005 Pinmembernashcontrol2:21 1 Apr '06  
GeneralRe: VS Clone for VS2005 Pinmemberzoranl12:29 2 Apr '06  
QuestionRe: VS Clone for VS2005 PinmemberAshish Nagar3:26 8 Oct '06  
GeneralRe: VS Clone for VS2005 Pinmemberintent2117:52 25 Dec '06  
GeneralRe: VS Clone for VS2005 Pinmemberjerry_lou197420:52 4 Mar '07  
QuestionRe: VS Clone for VS2005 Pinmemberkaiwnyt15:04 9 Jun '07  
QuestionRe: VS Clone for VS2005 Pinmemberww33319:11 23 Jul '07  
AnswerRe: VS Clone for VS2005 Pinmemberwjdong15:26 13 Sep '07  
GeneralRe: VS Clone for VS2005 PinmemberSerjoMainGod11:02 28 Oct '07  
GeneralRe: VS Clone for VS2005 Pinmemberchen.pochuan21:45 22 Nov '07  
QuestionWhat about SharpDevelop? PinmemberSHaroz18:05 5 Mar '05  
AnswerRe: What about SharpDevelop? PinmemberPaul Selormey19:20 6 Mar '05  
GeneralRe: What about SharpDevelop? PinmemberSHaroz19:40 6 Mar '05  
GeneralRe: What about SharpDevelop? PinmemberWillemM23:55 6 Mar '05  
GeneralRe: What about SharpDevelop? PinmemberRikaino9:30 22 Jul '05  
GeneralError in Compiling PinmemberPriyank Bolia2:28 5 Mar '05  
GeneralYa Pinmembertom_dx2:23 5 Mar '05  
GeneralLicensing and project purpose Pinmembernashcontrol4:00 5 Mar '05  
GeneralRe: Licensing and project purpose PinmemberEric Woodruff10:16 5 Mar '05  
GeneralRe: Licensing and project purpose Pinmembernashcontrol0:25 12 Mar '05  

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

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120529.1 | Last Updated 6 Mar 2005
Article Copyright 2005 by nashcontrol
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid