Re: convert code written without editor to editor compatible?
From: Billy Greening (billy_at_activegroup.net)
Date: 06/08/04
- Next message: 2G: "a little help with codedom"
- Previous message: pronto: "How to use SPLITTER ?"
- In reply to: Mickey Williams: "Re: convert code written without editor to editor compatible?"
- Next in thread: Jon Skeet [C# MVP]: "Re: convert code written without editor to editor compatible?"
- Reply: Jon Skeet [C# MVP]: "Re: convert code written without editor to editor compatible?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Jun 2004 09:23:17 -0400
Thanks, thats what I was afraid of.
"Mickey Williams" <my first name at servergeek.com> wrote in message
news:O1are3MTEHA.3988@tk2msftngp13.phx.gbl...
> Assuming you want the properties that you're setting during construction
> to
> be reflected in the design-time experience and have design-time changes
> automatically round-tripped, it's quite difficult to migrate this code
> without manually creating a form in Visual Studio. The reason is that the
> form designer serializes its state into your source code in a specific
> format, and it's unlikely that you'll accidently stumble across it.
>
> --
> Mickey Williams
> Author, "Microsoft Visual C# .NET Core Reference", MS Press
> www.servergeek.com/blogs/mickey
>
>
>
> "Billy Greening" <billy@activegroup.net> wrote in message
> news:uLCz9uKTEHA.3756@TK2MSFTNGP11.phx.gbl...
>> I have an application in C# that was written as a bunch of individual CS
>> files. I would like to combine these all into single solution that can
>> be
>> editied with the Visual Studio 2003 editor. Does anyone have any tips on
>> how to quickly bring this code into the VS2003 environment? Below is a
>> sample of the code for an about box: For this example, it wouldn't be
>> all
>> that difficult to just create a new form and set all the properties to
> match
>> this code through the designer, but there are 20 other much more complex
>> forms I would need to do the same thing for.
>>
>> using System;
>> using System.Drawing;
>> using System.Windows.Forms;
>> using System.IO;
>>
>> namespace ActiveNotes
>> {
>> public class AboutBox: Form
>> {
>>
>> private System.Windows.Forms.PictureBox pictureBox1;
>> private System.Windows.Forms.Label label1;
>> private System.Windows.Forms.Button btnOK;
>> /*
>> *
>> public static void Main()
>> {
>> AboutBox dlg = new AboutBox();
>> DialogResult dr = dlg.ShowDialog();
>> Console.WriteLine("Dialog box terminated with " + dr);
>> }
>> */
>> public AboutBox()
>> {
>> Text = "About ActiveNotes";
>> StartPosition = FormStartPosition.CenterScreen;
>>
>> pictureBox1 = new System.Windows.Forms.PictureBox();
>> label1 = new System.Windows.Forms.Label();
>> labelVersion = new System.Windows.Forms.Label();
>> btnOK = new System.Windows.Forms.Button();
>>
>> //Standard style for dialog boxes
>> FormBorderStyle = FormBorderStyle.FixedDialog;
>> //To allow cancel without buttons.
>> //ControlBox = false;
>> MaximizeBox = false;
>> MinimizeBox = false;
>> ShowInTaskbar = false;
>>
>>
>> //
>> // pictureBox1
>> //
>> this.pictureBox1.Image =
>>
> Image.FromFile(Path.GetDirectoryName(Application.ExecutablePath)+"\\art\\spl
> ash2.jpg");
>> this.pictureBox1.Location = new System.Drawing.Point(8, 8);
>> this.pictureBox1.Name = "pictureBox1";
>> this.pictureBox1.Size = new System.Drawing.Size(376, 296);
>> this.pictureBox1.TabIndex = 7;
>> this.pictureBox1.TabStop = false;
>>
>> //
>> // label1
>> //
>> this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif",
> 8.25F,
>> System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
>> ((System.Byte)(0)));
>> this.label1.Location = new System.Drawing.Point(8, 312);
>> this.label1.Name = "label1";
>> this.label1.Size = new System.Drawing.Size(376, 23);
>> this.label1.TabIndex = 1;
>> this.label1.Text = "ActiveNotes 3.0 - Copyright 2003 ActiveGroup
>> Ventures, Inc.";
>> this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
>>
>>
>>
>>
>> //
>> // btnOK
>> //
>> this.btnOK.Location = new System.Drawing.Point(296, 360);
>> this.btnOK.Name = "btnOK";
>> this.btnOK.TabIndex = 0;
>> this.btnOK.Text = "OK";
>> this.btnOK.Click += new System.EventHandler(this.OnOKClick);
>>
>> this.Controls.AddRange(new System.Windows.Forms.Control[] {
>> this.labelVersion,
>> this.btnOK,
>> this.linkLabel1,
>> this.label1,
>> this.pictureBox1});
>>
>> ClientSize = new Size(392, 397);
>> this.Load += new System.EventHandler(this.AboutBox_Load);
>>
>>
>>
>> }
>>
>> void OnOKClick(object obj, EventArgs ea)
>> {
>> DialogResult = DialogResult.OK;
>> }
>>
>> protected override void OnPaint(PaintEventArgs pea)
>> {
>> Graphics g = pea.Graphics;
>>
>> }
>>
>>
>> private void AboutBox_Load(object sender, System.EventArgs e)
>> {
>> this.ActiveControl = this.btnOK;
>> }
>> }
>>
>>
>>
>
>
- Next message: 2G: "a little help with codedom"
- Previous message: pronto: "How to use SPLITTER ?"
- In reply to: Mickey Williams: "Re: convert code written without editor to editor compatible?"
- Next in thread: Jon Skeet [C# MVP]: "Re: convert code written without editor to editor compatible?"
- Reply: Jon Skeet [C# MVP]: "Re: convert code written without editor to editor compatible?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|