sequence
When Delphi came out of 8, I have installed it. At that time, the first feel was disappointed, because the familiar VCL visual was gone; another feeling is unfamiliar, because Delphi changed its code, we have to write something to follow the MS .NET namespace. More importantly, I have no confidence in developing B / S using Delphi. After a while, I turned to the Java platform.
But later, I saw ASP.NET is really very good, and Delphi can also achieve it, which makes me a kind of impulse. But there was no time to study at the time, so I still don't understand it. I am very interested in Intraweb and ASP.NET, I really want to try it. Later, the trial of C # Builder1.0 made me feel good for Borland, but I still think it is with the fart, there is no MS counter power. This reminds me of a phrase of Garfield, if you don't play your enemies, the best way is to join them.
Today, I have another attitude toward Delphi. It is best to ask it if it is not harsh, but I hope that I can use Delphi in B / S, and I feel delicious, this is enough. As for the changes in its appearance and space, after Delphi8, I have begun to accept, after all, Delphi doesn't go. Net has no way to go.
When I accidentally got the Delphi2005 trial version sent by Borland, I wanted to get a popular game, I really want to try it. However, Borland's registration is too no "Chinese character", and I have to get a registrar on the Internet. Do not do D version users are not too habit.
(1) Hello world.
Delphi2005 is an integrated environment, including delphi, C #, as if you can also use VB.NET, but this is not content in the regular menu. I feel that Borland has a problem with this software, it should be called Borland.Net2005, or use Delphi to develop C #, which sounds a bit funny.
Let's write a Hello World with Delphi. In 2005, there are three different ways to develop Delphi, and the natural application environment is also different. They are:
1 VclForms Application for .NET
2 WindowsForms Application For .NET
3 vclForms application for win32.
Here is the Hello World in three ways.
1 VclForms Application for .NET
Unit code:
Unit unit1;
Interface
Uses
Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, stdctrls;
Type
TFORM1 = Class (TFORM)
Button1: tbutton;
EDIT1: TEDIT;
Procedure Button1Click (Sender: TOBJECT);
Private
{Private Declarations}
public
{Public declarations}
END;
VAR
FORM1: TFORM1;
Implementation {$ r * .dfm}
Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);
Begin
Edit1.Text: = 'Hello World.';
END;
End.
Form code:
Object Form1: TFORM1
LEFT = 0
TOP = 0width = 281
HEIGHT = 138
CAPTION = 'FORM1'
Color = CLBTNFACE
Font.charset = default_charset
Font.color = CLWINDOWTEXT
Font.height = -11
Font.name = 'Taoma'
Font.style = []
OldcreateOrder = FALSE
Pixelsperinch = 96
TEXTHEIGHT = 13
Object Button1: TButton
LEFT = 88
TOP = 56
Width = 75
HEIGHT = 25
CAPTION = 'Button1'
Taborder = 0
Onclick = button1click
end
Object Edit1: TEDIT
LEFT = 8
TOP = 8
Width = 249
HEIGHT = 21
Taborder = 1
end
end
This seems to be different from the previous Win32 development. The unit and the form are separated, separately processed and persistently operated. The two works in 2 are merged in a PAS file.
2 WindowsForms Application for .NET Unit Winform; Interface
Uses
System.drawing, System.Collections, System.comPonentmodel, SYSTEM.
System.windows.Forms, System.Data;
Type
Twinform = Class (System.Windows.Forms.form)
{$ Region 'Designer Managed Code'}
Strict Private
///
/// Required Designer Variable.
/// summary>
Components: system.componentmodel.container;
TextBox1: System.Windows.Forms.TextBox;
Button1: System.windows.Forms.Button;
///
/// Required Method for Designer Support - Do Not Modify
/// The contents of this method with the code editor.
/// summary>
Procedure Initialization;
Procedure button1_click (sender: system.object; e: system.eventargs);
{$ EndRegion}
Strict protected
///
/// Clean Up Any Resources Being Used.
/// summary>
Procedure Dispose (Disposing: Boolean); OVERRIDE;
Private
{Private Declarations}
public
Constructor crete;
END;
[Assembly: RuntimeRequidattribute (Typeof (TwinForm)]]]
IMPLEMENTATION
{$ Autobox on}
{$ Region 'Windows Form Designer Generated Code'} ///
/// Required Method for Designer Support - Do Not Modify
/// The contents of this method with the code editor.
/// summary>
Procedure TWINFORM.INITIALIZEComponent;
Begin
Self.TextBox1: = system.windows.Forms.TextBox.create;
Self.Button1: = system.windows.Forms.Button.create;
Self.suspendlayout;
//
// textbox1
//
Self.TextBox1.location: = system.drawing.point.create (72, 40);
Self.TextBox1.name: = 'TextBox1';
Self.TextBox1.size: = system.drawing.size.create (152, 21);
Self.TextBox1.tabindex: = 0;
SELF.TEXTBOX1.TEXT: = '';
//
// Button1
//
Self.Button1.Location: = system.drawing.point.create (80, 160);
Self.Button1.name: = 'button1';
Self.button1.size: = system.drawing.size.create (136, 32);
Self.Button1.tabindex: = 1;
Self.Button1.Text: = 'Button1';
INCLUDE (Self.Button1.click, self.button1_click);
//
// Twinform
//
Self.autoscalebasesize: = system.drawing.size.create (6, 14);
Self.ClientSize: = system.drawing.size.create (292, 273);
Self.controls.add (self.button1);
Self.Controls.Add (Self.TextBox1);
Self.name: = 'twinform';
Self.Text: = 'Winform';
Self.ResumeLayout (false);
END;
{$ EndRegion}
Procedure Twinform.Dispose (Disposing: Boolean);
Begin
IF Disposing then
Begin
IF Components <> nil dam
Components.dispose ();
END;
Inherited Dispose (Disposing);
END;
Constructor twinform.create;
Begin
Inherited Create;
//
// Required for Windows Form Designer Support
//
InitializationComponent;
//
// Todo: Add Any Constructionor Code After InitializationComponent Call
//
END;
Procedure Twinform.Button1_Click (Sender: System.Object; E: System.EventArgs); Begin
TextBox1.text: = 'Hello World!';
END;
End.
3 vclForms application for Win32. Its code is exactly the same.
Finally, he is written with C #. It only has .Net a way because it is born in the .NET era.
Using system;
Using system.drawing;
Using system.collections;
Using system.componentmodel;
Using system.windows.forms;
Using system.data;
Namespace Project1
{
///
/// summary description for WinForm.
/// summary>
Public Class Winform: System.Windows.Forms.form
{
///
/// Required Designer Variable.
/// summary>
Private system.componentmodel.Container Components = NULL;
Private system.windows.Forms.TextBox textBox1;
Private system.windows.Forms.Button button1;
Public winform ()
{
//
// Required for Windows Form Designer Support
//
InitializationComponent ();
//
// Todo: Add Any Constructionor Code After InitializationComponent Call
//
}
///
/// Clean Up Any Resources Being Used.
/// summary>
Protected Override Void Dispose (Bool Disposing)
{
IF (Disposing)
{
IF (Components! = NULL)
{
Components.dispose ();
}
}
Base.dispose (Disposing);
}
#Region Windows Form Designer Generated Code
///
/// Required Method for Designer Support - Do Not Modify
/// The contents of this method with the code editor.
/// summary>
Private vidinitiRizeComponent ()
{
This.TextBox1 = new system.windows.Forms.TextBox ();
This.button1 = new system.windows.Forms.Button ();
THIS.SUSPENDLAYOUT ();
//
// textbox1
//
This.TextBox1.Location = new system.drawing.point (72, 88);
THIS.TEXTBOX1.NAME = "TextBox1";
This.TextBox1.size = new system.drawing.size (120, 21); this.TextBox1.tabindex = 0;
THIS.TEXTBOX1.TEXT = "TextBox1";
THIS.TEXTBOX1.TEXTCHANGED = New System.EventHandler (this.textbox1_textchanged);
//
// Button1
//
This.Button1.Location = new system.drawing.point (88, 176);
This.button1.name = "button1";
This.button1.tabindex = 1;
This.Button1.Text = "Button1";
This.Button1.click = new system.eventhandler (this.button1_click);
//
// WinForm
//
THIS.AUTOSCALEBASESIZE = New System.drawing.size (6, 14);
THIS.CLIENTSIZE = New System.drawing.size (292, 273);
This.Controls.add (this.button1);
This.Controls.add (this.TextBox1);
THIS.NAME = "Winform";
THIS.TEXT = "WinForm";
This.ResumeLayout (false);
}
#ndregion
///
/// The main entry point for the application.
/// summary>
[Stathread]
Static void
Main
()
{
Application.run (New WinForm ());
}
Private void Button1_Click (Object Sender, System.Eventargs E)
{
TextBox1.text = "Hello World."
}
Private void textbox1_textchanged (Object Sender, System.Eventargs E)
{
}
}
}