Click here to Skip to main content
6,630,586 members and growing! (20,613 online)
Email Password   helpLost your password?
Languages » C# » Applications     Intermediate

Visual Studio Editor Clone V0.1a

By nashcontrol

A clone of the Visual Studio .NET 2002 editor.
C#.NET 1.0, Win2K, WinXP, Dev
Posted:5 Mar 2005
Updated:6 Mar 2005
Views:64,904
Bookmarked:56 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
16 votes for this article.
Popularity: 3.58 Rating: 2.97 out of 5
6 votes, 37.5%
1
3 votes, 18.8%
2
1 vote, 6.3%
3

4
6 votes, 37.5%
5

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


Member

Occupation: Web Developer
Company: Indigo - Smart House Solutions
Location: Israel Israel

Other popular C# articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 26 (Total in Forum: 26) (Refresh)FirstPrevNext
GeneralERROR!!! Pinmemberjn-ncut1:07 2 Jul '08  
Generaldemo - error PinmemberNinethSense20:00 11 Nov '07  
GeneralShowing toolbox when closed PinmemberISIAdrin7:37 19 Oct '07  
GeneralVS Clone for VS2005 Pinmemberzoranl12:37 18 Jan '06  
GeneralRe: VS Clone for VS2005 Pinmembernashcontrol3:21 1 Apr '06  
GeneralRe: VS Clone for VS2005 Pinmemberzoranl13:29 2 Apr '06  
QuestionRe: VS Clone for VS2005 PinmemberAshish Nagar4:26 8 Oct '06  
GeneralRe: VS Clone for VS2005 Pinmemberintent2118:52 25 Dec '06  
GeneralRe: VS Clone for VS2005 Pinmemberjerry_lou197421:52 4 Mar '07  
QuestionRe: VS Clone for VS2005 Pinmemberkaiwnyt16:04 9 Jun '07  
QuestionRe: VS Clone for VS2005 Pinmemberww333110:11 23 Jul '07  
AnswerRe: VS Clone for VS2005 Pinmemberwjdong16:26 13 Sep '07  
GeneralRe: VS Clone for VS2005 PinmemberSerjoMainGod12:02 28 Oct '07  
GeneralRe: VS Clone for VS2005 Pinmemberchen.pochuan22:45 22 Nov '07  
GeneralWhat about SharpDevelop? PinmemberSHaroz19:05 5 Mar '05  
GeneralRe: What about SharpDevelop? PinsupporterPaul Selormey20:20 6 Mar '05  
GeneralRe: What about SharpDevelop? PinmemberSHaroz20:40 6 Mar '05  
GeneralRe: What about SharpDevelop? PinmemberWillemM0:55 7 Mar '05  
GeneralRe: What about SharpDevelop? PinmemberRikaino10:30 22 Jul '05  
GeneralError in Compiling PinmemberPriyank Bolia3:28 5 Mar '05  
GeneralYa Pinmembertom_dx3:23 5 Mar '05  
GeneralLicensing and project purpose Pinmembernashcontrol5:00 5 Mar '05  
GeneralRe: Licensing and project purpose PinmemberEric Woodruff11:16 5 Mar '05  
GeneralRe: Licensing and project purpose Pinmembernashcontrol1:25 12 Mar '05  
GeneralRe: Licensing and project purpose PinmemberAndrew Phillips21:33 15 Jun '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 6 Mar 2005
Editor: Smitha Vijayan
Copyright 2005 by nashcontrol
Everything else Copyright © CodeProject, 1999-2009
Web10 | Advertise on the Code Project