| Developing Pocket PC applications with Delphi 2006 | |
Abstract: This article provides information about the Delphi .NET Compact Framework compiler and some Delphi 2006 plugins for developing Pocket PC applications
Introduction
A few months after the release of Delphi 2005, Borland made available a preview of the Delphi .NET Compact Framework compiler. Now there is full support for this compiler in Delphi 2006. There are no CF designers yet, but with some extra tools it is quite easy to produce executables which can run on Pocket PCs, Smartphones and all devices running the Windows CE operating system. This article explains many of the differences between the compact and desktop version of the .NET framework and I will show you step by step how to develop and test Pocket PC applications with Delphi 2006.
.NET Compact Framework
Pocket PCs and other devices running Windows CE are the devices that currently support the .NET Compact Framework. The .NET CF is a rich subset of the .NET Framework, thus providing the same benefits as the .NET Framework. The .NET CF also has a few additional libraries that are specific to mobility and device development.
But not all properties, methods and classes which are available on the full .NET Framework have been implemented on the Compact Framework. In this article I will show the most important differences and some workarounds.
Delphi 2006 (and 2005) supports the .NET CF 1.0 which will run on all current Pocket PCs. Microsoft recently released version 2.0 which includes some new controls (datetimepicker, monthcalendar, linklabel, webbrowser) and some new managed API's for telephony, messaging, configuration, ...
Windows Mobile Emulators
To test your mobile applications on your PC you have to install an emulator. On the Microsoft website you can download two kind of emulators and several images for the mobile operating systems. The Windows Mobile 2003 and 2003 Second Edition operating systems are primarily used on current Pocket PCs. The newest Pocket PCs will be installed with Windows Mobile 5.0.
Windows CE 5.0 Emulator
The older Windows CE 5.0 Emulator (Emulator_500.exe) can be used to run images of the Pocket PC and Smartphone 2003 operating systems for x86 CPUs. There are no x86 images of Windows Mobile 5.0 available for this emulator.
- Microsoft Windows CE 5.0 Emulator
- SDK Windows Mobile 2003 Pocket PC + Emulator Image Windows Mobile 2003 (x86) (custom install, uncheck the Visual C++ code samples)
- Emulator Image Windows Mobile 2003 SE Pocket PC (x86)
Windows Device Emulator 1.0
Those who have installed Microsoft Visual Studio 2005 will notice that there is a new emulator called Device Emulator (and Device Emulator Manager). Recently, Microsoft has released a standalone version of the Device Emulator. This new Device Emulator is significantly better than its predecessor (easier to install, more features, ActiveSync support, works in a VMWare session, better help file) but this new emulator only runs code compiled for ARM processors. So, when you try to use an old x86 OS image you will get an error "Invalid or missing ROM image".
If your PC does not have a Virtual Machine Network driver, then you first have to download and install it :
Localized images and extra tools are also available :
- SDK Windows Mobile 5.0 Pocket PC + Emulator Image Windows Mobile 5.0 (ARM)
- Localized Emulator Image Windows Mobile 5.0 Pocket PC (ARM) (it requires that Visual Studio 2005 is installed)
- Overview of emulator images and SDK files
At this moment no Windows Mobile 2003 SE images for ARM CPUs are available on the Microsoft website. These will be made available in the next few days.
There is also a newer bèta version which is much faster and has some bugfixes :
Paths and startup parameters
Paths Windows CE 5.0 Emulator & PPC 2003 SE images (x86)
| Emulator | C:\Program Files\Windows CE 5.0 Emulator\Emulator_500.exe |
| Images (2003 SE) | C:\Program Files\Pocket PC 2003 Second Edition Emulators\WWE\ |
| Images (2003) from SDK | C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Emulation |
| Skins | C:\Program Files\Pocket PC 2003 Second Edition Emulators\WWE\ |
Paths Device Emulator 1.0 (standalone version) & PPC 5.0 images (ARM)
| Emulator | C:\Program Files\Microsoft Device Emulator\DeviceEmulator.exe |
| Images (5.0 MSFP) | C:\Program Files\Microsoft Windows Mobile 5.0 MSFP Emulator Images\ |
| Images (5.0) from SDK | C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Deviceemulation\0409 |
| Localized images (5.0) | C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Emulator Images for Pocket PC - NLD\Deviceemulation\0413 |
| Skins | C:\Program Files\Microsoft Windows Mobile 5.0 MSFP Emulator Images\ |
Paths Device Emulator 1.0 (VS2005) & PPC 2003 SE (ARM) + PPC 5.0 images (ARM)
| Emulator | C:\Program Files\Microsoft Device Emulator\1.0\DeviceEmulator.exe |
| Images (2003 SE & 5.0) | C:\Program Files\Microsoft Visual Studio 8\SmartDevices\Emulators\Images\ |
| Skins | C:\Program Files\Microsoft Visual Studio 8\SmartDevices\Skins\ |
Startup parameters
| Link to emulator image file (Pocket PC or Smartphone) | |
| /sharedfolder | Link to shared folder with your own applications. On the Pocket PC this folder can be accessed by the Storage Card link. |
| /video | Resolution (width x height) and bit depth. 240x320x16 for Pocket PC's, 176x220x16 for Smartphones |
| /ethernet | Specifies the level of networking support in the Emulator (none, shared, virtualswitch) |
| /skin | Link to a XML skin file which will show a bitmap of a Pocket PC or Smartphone around the Windows CE window. This parameter is not required. |
VBScripts to start an emulator
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
q = Chr(34)
strCommandLine = q & "C:\Program Files\Windows CE 5.0 Emulator\Emulator_500.exe" & q
& " " & q & "C:\Program Files\Pocket PC 2003 Second Edition Emulators\WWE\Pocket_PC\PPC_2003_SE_WWE.bin" & q
& " /sharedfolder " & q & "C:\Program Files\NET CF\Shared" & q
& " /video 240x320x16" & " /ethernet shared"& " /skin "
& q & "C:\Program Files\Pocket PC 2003 Second Edition Emulators\WWE\Pocket_PC\PPC_2003_SE.xml" & q
WshShell.Exec(strCommandLine)Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
q = Chr(34)
strCommandLine = q & "C:\Program Files\Microsoft Device Emulator\DeviceEmulator.exe" & q
& " " & q & "C:\Program Files\Microsoft Windows Mobile 5.0 MSFP Emulator Images\pocketpc.nb0" & q
& " /sharedfolder " & q & "C:\Program Files\NET CF\Shared" & q
& " /video 240x320x16" & " /ethernet shared"& " /skin "
& q & "C:\Program Files\Microsoft Windows Mobile 5.0 MSFP Emulator Images\Pocket_PC.xml" & q
WshShell.Exec(strCommandLine)Remove the enters in the command line rule because this should be one source line !
.NET CF assemblies
If you want to deploy your application on your Pocket PC, you have to make sure the latest service pack of the .NET Compact Framework 1.0 is installed. These assemblies are already included in the Emulator Images but you need to install them on your Pocket PC. Service Pack 3 can be found at the Microsoft website. This end-user version comes with an automatic installer but it requires that ActiveSync is active and that your Pocket PC is connected to your PC.
Create, compile and deploy a Delphi Pocket PC application
We will start creating our first Delphi Pocket PC application. For now we will not utilize extra plugins.
Design a form with a button
1) Start with File|New|Windows Forms .NET application- Delphi for .NET
2) Resize the form. Size.Width=240, Size.Height=320
3) Set Text property of form : "Pocket PC"
4) Add a Button and change the Text : "Delphi"
Compile the project with the .NET CF compiler
When you press the Run F9 button, the application will be compiled with the .NET compiler. But we are trying to create a .NET Compact Framework application for a Pocket PC, so we can not proceed the normal way.
To compile this application we have to use the Delphi .NET CF compiler (DCCIL) which is available in the Borland\BDS\4.0\Bin folder. The .dcpil and .dcuil files for the .NET CF can be found in the C:\Program Files\Borland\BDS\4.0\lib\cf folder. When .dcpil files are present, you do not need to install these .NET CF assemblies (DLL files) on your PC. This DCCIL compiler can not be invoked directly from the Delphi 2006 IDE.
There are 2 ways to invoke the DCCIL compiler :
The hard way is to to create a small script to run this compiler. I have updated my Delphi 2005 VBScript to do this. In the Tool Properties dialog (Configure Tools) you can add a menu item for this script. Specify the title (this is the caption of the new menu item), the location of the program and a list of parameters which contains some macros.
| Title | Compile with Delphi .NET CF compiler |
| Program | C:\WINDOWS\system32\wscript.exe |
| Parameters | $SAVEALL "C:\Program Files\NET CF\Scripts\CompileCFNET.vbs" $NAMEONLY($PROJECT) $PROJECT |
CompileNETCF.vbs
' CompileNETCF.VBS
' Compile project with Delphi 2006 .NET Compact Framework Compiler (DCCIL)
' February 2006 - Stefan Cruysberghs
' Delphi tools properties
' * Program : C:\WINDOWS\system32\wscript.exe
' * Parameters : $SAVEALL "path\CompileNETCF.vbs" $NAMEONLY($PROJECT) $PATH($PROJECT)Dim WshShell, Fso, Args, Exec, i
Set WshShell = CreateObject("WScript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Args = WScript.Arguments
If Args.Count = 0 Then MsgBox "No Delphi project given", 16, "Error"Else strProjectName = Args(0) strProjectFolder = "" For i = 1 To Args.Count-1
strProjectFolder = strProjectFolder & " " & Args(i)
Next strProjectName = Trim(Fso.GetBaseName(strProjectName)) strProjectFolder = Trim(Fso.GetParentFolderName(strProjectFolder)) strProject = strProjectFolder & "\" & strProjectName & ".dpr" If Not Fso.FileExists(q & strProject & q) Then MsgBox strProject & " does not exist", 16, "Error" Else q = Chr(34) 'quote ' Set paths strDCCIL = "C:\Program Files\Borland\BDS\4.0\Bin\dccil.exe" strCFUnits = "C:\Program Files\Borland\BDS\4.0\lib\cf" strLogFileName = strProjectFolder & "\CompileCFNETLog.pas" ' Extra compiler options. If .NET CF assemblies are not available/needed, set it to "" strCompilerOptions = "" 'strCompilerOptions = " -lu" & q & "C:\NETCFAssemblies\Microsoft.WindowsCE.Forms.dll"
' & q & " -lu" & q & "C:\NETCFAssemblies\System.Windows.Forms.DataGrid.dll" & q ' Delete all .dcuil files On Error Resume Next Fso.DeleteFile strProjectFolder & "\*.dc?il", True strCommandLine = "cmd /c > " & q & strLogFileName & q & " " & q & strDCCIL & q & " " & q & strProject & q & " -u" & q & strCFUnits & q & " -luSystem.Windows.Forms -luSystem.Data " & strCompilerOptions ' Compile the project with the DCCIL.exe Set Exec = WshShell.Exec(strCommandLine)
' Wait for application to exit Do While Exec.Status = 0
WScript.Sleep 1
Loop ' Show the log file (when extention of log is PAS, it will be opened in Delphi) WshShell.Run(q & strLogFileName & q) End IfEnd IfA much better way, which was brought to my attention by Marco Cantu , is to change the Library Path . Go to Tools|Options|Delphi options|Library - NET and change the path $(BDS)\lib\ into $(BDS)\lib\cf (use the Replace button). Now you can use the Run , Compile and Build actions. And what is more, also the Code Insight features will function. So without compiling you can see the errors introduced by the WinForms designer in the messages log (Error Insight) and also Code Completion is working great.Remove the enters in the command line rule because this should be one source line !
Next screenshot shows the difference between the methods of the MessageDlg class in .NET Framework and in the .NET Compact Framework after changing the Library Path into \Lib\CF.
Hide image
Solve the compilation errors
After changing the Library Path run the application (or run the script). As you can see, the compilation failed with many Undeclared identifier errors. As stated before, not all properties, methods and classes which are available on the full .NET Framework have been implemented on the Compact Framework.
Borland Delphi for .NET compiler version 18.0
Copyright (c) 1983,2005 Borland Software Corporation
.NET Framework v1.1.4322 loaded
Project1.dpr(8) Warning: W1026 File not found: 'WinForm.TWinForm.resources'
WinForm.pas(49) Error: E2003 Undeclared identifier: 'SuspendLayout'
WinForm.pas(54) Error: E2003 Undeclared identifier: 'Name'
WinForm.pas(55) Error: E2003 Undeclared identifier: 'TabIndex'
WinForm.pas(60) Error: E2003 Undeclared identifier: 'AutoScaleBaseSize'
WinForm.pas(63) Error: E2003 Undeclared identifier: 'Name'
WinForm.pas(65) Error: E2003 Undeclared identifier: 'ResumeLayout'
Project1.dpr(15) Fatal: F2063 Could not compile used unit 'WinForm.pas'When a class is undeclared, we have to remove it from the form (or in the source code).
The TabIndex is one of the properties that does not exist in the .NET CF and therefore the compiler will return an Undeclared identifier "TabIndex" error . Other properties and methods which should be deleted or commented out in the InitializeComponent method of the form (Windows Form Designer generated code) are :
- Name
- TabIndex
- TabStop
- Index
- AutoScaleBaseSize
- ResumeLayout
- SuspendLayout
- AddRange
In the project file you have to remove the [STAThread] attribute.
To resolve the File not found: 'WinForm.TWinForm.resources' warning, you need to remove the WinForm.resx file from the project. This can be done by deleting the reference in the project file. You can also select the menu item Project|Remove from Project..., click on the WinForm.resx item in the list, and press the OK button.
{$R 'WinForm.TWinForm.resources' 'WinForm.resx'}
After solving all errors, try to compile the project again by invoking the VBScript.
Test the application with the emulator
Now we can copy the EXE to the shared folder. Start the emulator and make sure the same shared folder has been set. Run the Explorer, go to the Storage Card (=shared folder) and start the executable. Your first Delphi Pocket PC application is running !
When the .NET CF is installed on your mobile device, you can also copy the EXE to your Pocket PC with ActiveSync.
Delphi plugins
Of course you noticed that the Delphi .NET CF compiler works fine but without designers it is a lot of work to change the generated source code manually. Fortunately some Delphi developers did a great job by creating some Delphi plugins.
Compact Framework Project Preprocessor
Chee Wee Chua has posted a Compact Framework Project Preprocessor (MakeCFCompatible) to the Borland CodeCentral. This little program will modify your code automatically by commenting out every line that raises error E2003.
Compact Framework Build Helper
And Jeremy North created a great plugin called the Compact Framework Build Helper(CFBH) which adds some extra toolbars, menus and templates in Delphi 2006 (and 2005). CFBH makes it very easy to start new .NET CF projects, compile .NET CF projects within the Delphi IDE, launch different emulators and deploy the applications to the emulators or Pocket PC. It also includes some nice PDF manuals and on the website you will find several comprehensive videos.
Installation and configuration
1) Download the Compact Framework Project Prepocessor, unzip it and place all files in a folder
2) Make sure Borland Developer Studio is closed
3) Download the Compact Framework Build Helper and run the setup
4) Settings : Check the checkbox as a result of which a new menu item with all CFBH features will be created
5) Folder Setup
- Refer to the BDS 4.0 compiler and library path
- Check Auto Fix Errors and refer to the MakeCFCompatibleDLL.DLL of the Compact Framework Project Prepocessor
- The other options will be explained later on in this article
6) Emulators
- Here you can define several emulators, images and configuration options for each emulator
- Set the path for the emulator and the Windows Mobile image
- The shared path allows you to treat a folder as if it was a storage card in the emulator. Make sure this shared folder is different from your Delphi project folder.
- On the other tabsheets you can define the screen resolution, skin, network options, ...
7) Deploy
- The deployment page allows you to set the default deployment method for your applications once they run.
Create, compile and deploy a Delphi Pocket PC application with CFBB
Now that we have installed the CFHB, we will create the same example again. This time you will notice that compiling and deploying the application can be done very quickly
1) File|New|Other and choose the Smart Device Application
2) Set Text property of form : "Pocket PC"
3) Add a Button and change the Text : "Delphi"
4) In the CFBH toolbar, choose Selected Emulator, choose an emulator and press the CFBH Run button. The emulator will be started. The EXE is automatically copied to the shared folder so in the emulator you can start the EXE by exploring the Storage Card.
5) Make sure your Pocket PC is connected to your PC and Microsoft ActiveSync is active. Choose Active Sync (device) and press the CFBH Run button. Your new application will be launched automatically on your mobile device.
Cool, isn't it ? When you take a closer look at the source code you will notice that all lines which raise error E2003 have been modified. The compiler directive CF is added by which this source will not be compiled when using the Compact Framework DDCIL compiler. The combination of the Compact Framework Project Prepocessor and the Compact Framework Build Helper is really helpful compiling your projects.
Oosterkamp Class Helpers
The drawback of this preprocessor is that if an error is spread over more than one line, only one line is commented out, resulting in an application that does not compile at all. Because not all issues can be handled by the preprocessor, Jeroen Pluimers wrote the Oosterkamp Class Helpers. They will add some extra properties and methods to existing .NET CF classes (TextBox, TreeView, Toolbar, TrackBar, NumericUpDown, MainMenu, ImageList, Timer, DataGrid, Application, ...).
When you start with a CFBH template (File|New|Other|Smart Device Application) an extra unit will be included
{$IFDEF CF_Oosterkamp}
uses
OosterKamp.WindowsCE.ClassHelpers;
{$ENDIF CF_Oosterkamp}To use these classhelpers you have to add some extra compiler options. They are available in the list so check them in CFBH Options|Folder setup.
-DCF_Oosterkamp
-U"C:\Program Files\CFBuild2006\ClassHelpers"Compile your application again. You will notice that all compiler directives {$IFNDEF CF} will disappear. By using these Oosterkamp Class Helpers all properties in the InitializeComponent method do exist and therefore they don't have to be commented out. Some of them are implemented and others are fake.
When the class helper units are included, you can decide to turn off the Auto Fix Preprocessor option. Usually it works better without using the preprocessor. More information about these class helpers can be found in C:\Program Files\CFBuild2006\classhelpers.
When using CFBH and the Oosterkamp Class Helpers your Pocket PC application will compile without making any changes manually. But there are more differences between the .NET framework and the .NET CF. In the next chapters I will show you which controls are supported and how you can write some code which will work fine on a Pocket PC.
System.Windows.Forms
Forms
On a Pocket PC, top-level forms with a border are always shown full screen and they can not be moved or resized. Therefore it is better setting the Size property in design-time; Width=240; Height=320. In run-time the Size and Location properties will be ignored. When using the CFBH templates (File|New|Others|Smart device) the size of the forms will be set automatically.
Common screen resolutions are :
| 176x220 | 240x320 | 320x240 | 240x240 | 480x480 | 640x480 | |
| Windows Mobile 5.0 | X | X | X | X | X | |
| Windows Mobile 2003 SE | X | X | ||||
| Windows Mobile 2003 | X | |||||
| Smart Phone 2003 | X |
In order to display a non-full screen form on a Pocket PC, you should set the form's FormBorderStyle property to FormBorderStyle.None. The position of the close button is still in the right top corner.
The StartPosition property which can be used to set a form in the screen center, is not supported in the .NET CF. But this can be solved easily by calculating the center of the screen in the Load event of the form.
procedure TWinForm1.TWinForm1_Load(sender: System.Object; e: System.EventArgs);
begin Self.Location := System.Drawing.Point.Create( (Screen.PrimaryScreen.Bounds.Width - Self.Width) div 2,
(Screen.PrimaryScreen.Bounds.Height - Self.Height) div 2);
end;Pocket PC applications normally remain running indefinitely to allow users to quickly switch between applications. So, a Pocket PC application does not close, instead it minimizes. When the form property MinimizeBox is True (default), a "smart minimize" X-button will be displayed in the top right, whereas MinimizeBox=False will show a little close OK-button. In a CFBH template the MinimizeBox property will be False.
![]() | MinimizeBox=True | Minimize |
![]() | MinimizeBox=False | Close |
When you want to know when a window is being minimized, trigger the Deactivate event.
In order to close a minimized application on your Pocket PC, you have to go to Settings|Systems|Memory|Running Programs. A list of all running applications will be shown and you can stop or activate them.
The TabIndex property does not exist in the .NET CF. Tabbing is based on z-order, the order in which the controls have been added to the Controls collection of the form. The first focusable control in a Pocket PC application is the mainform itself.
Hardware buttons
Hide image![]() | A Pocket PC has a directional pad with 5 buttons that can be used to interact with applications. It is possible to capture these keys in the KeyDown event. The KeyDown event receives a KeyEventArgs object which exposes a KeyCode property. By comparing the value of the KeyCode property we can determine which button was pressed. |
procedure TWinForm1.TWinForm1_KeyDown(sender: System.Object; e: System.Windows.Forms.KeyEventArgs);
begin case e.KeyCode of Keys.Up : ... Keys.Down : ... Keys.Left : ... Keys.Right : ... Keys.Return : ... end;
end;Application
Most properties of the Application class which you can use in .NET are not implemented in the .NET CF. So properties like CommonAppDataPath, ExecutablePath, CompanyName, ProductName, ProductVersion, ... are not available.
Another way to get the path of the executable is to access the FullyQualifiedName property of the first module of the assembly. For accessing the Assembly object you have to add the System.Reflection namespace. File IO functions are included in the System.IO namespace.
uses ..., System.Reflection, System.IO;strExecutableFullName := System.Reflection.Assembly.GetExecutingAssembly.GetModules[0].FullyQualifiedName;strExecutableName := System.IO.Path.GetFileName(strExecutableFullName);strExecutablePath := System.IO.Path.GetDirectoryName(strExecutableFullName);The AssemblyVersion (=ProductVersion) is specified in the project file. In a Pocket PC application this version number can be accessed by using the GetName.Version property of the assembly.
[assembly: AssemblyVersion('1.2.0.0')]strProductVersion := System.Reflection.Assembly.GetExecutingAssembly.GetName.Version.ToString;When you have started with a new smart device project (CFBH template), then one of the Oosterkamp Class Helper units has been added. To use them in all their glory, also add a second unit called OosterKamp.WindowsCE.ClassHelpersEx.
When these class helpers units are included, you can address some of the Application properties as in the full .NET framework. The namespaces System.IO and System.Reflection are not needed.
Label1.Text := Application.ProductName;
Label2.Text := Application.ProductVersion;
Label3.Text := Application.ExecutablePath;Menu, ListBox, ListView, TreeView & ToolBar
When creating items for menus, listboxes, listviews, treeviews or toolbars in design-time, you will get undeclared identifier errors on the AddRange method. This can be solved easily by replacing these lines by using the Add or Insert method.
When using the Oosterkamp Class Helpers, you do not have to modify anything. The AddRange method in the class helpers (unit Oosterkamp.WindowsCE.ClassHelpers) will solve this .
On a Pocket PC the mainmenu and the toolbar will be shown at the bottom of the screen.
Self.MainMenu1.MenuItems.AddRange(TArrayOfSystem_Windows_Forms_MenuItem.Create(Self.MenuItemFile));
Self.MenuItemFile.MenuItems.AddRange(TArrayOfSystem_Windows_Forms_MenuItem.Create(Self.MenuItemClose));Self.ListBox1.Items.AddRange(TArrayOfSystem_Object.Create('Item0', 'Item1'));Self.TreeView1.Nodes.AddRange(TArrayOfSystem_Windows_Forms_TreeNode.Create(
System.Windows.Forms.TreeNode.Create('Node0',
TArrayOfSystem_Windows_Forms_TreeNode.Create(
System.Windows.Forms.TreeNode.Create('Node00'),
System.Windows.Forms.TreeNode.Create('Node01'))),
System.Windows.Forms.TreeNode.Create('Node1',
TArrayOfSystem_Windows_Forms_TreeNode.Create(
System.Windows.Forms.TreeNode.Create('Node10')))));
Self.MainMenu1.MenuItems.Add(Self.MenuItemFile);
Self.MenuItemFile.MenuItems.Add(Self.MenuItemClose);
Self.ListBox1.Items.Add('Item0');
Self.ListBox1.Items.Add('Item1');Self.TreeView1.Nodes.Insert(0,System.Windows.Forms.TreeNode.Create('Node0'));
Self.TreeView1.Nodes.Item[0].Nodes.Insert(0,System.Windows.Forms.TreeNode.Create('Node00'));
Self.TreeView1.Nodes.Item[0].Nodes.Insert(1,System.Windows.Forms.TreeNode.Create('Node01'));
Self.TreeView1.Nodes.Insert(1,System.Windows.Forms.TreeNode.Create('Node1'));
Self.TreeView1.Nodes.Item[1].Nodes.Insert(0,System.Windows.Forms.TreeNode.Create('Node10'));








