B
Billy Greening
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\\splash2.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;
}
}
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\\splash2.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;
}
}