Step-by-step Establish PocketPC Applications (3)
Author: Dekker MSN: dekkerdillon@hotmail.com Email: Dekker99@163.com
3. Task 3 Set the image property of Picture Box from embedded resources
l If the Solution Explorer is not visible, select the View | Solution Explorer menu command.
l To add a picture to the program as a source file:
(1) In the Solution Explorer, right-click on the PocketPCAPP project and select Add | Add the existing item Order menu command.
(2) Select the image file from the file type: drop-down list box
Figure 6 Add a picture resource
(3) In the Solution Explorer, right click on the image and select Properties.
(4) In the Properties form, set the resource Embedded Resource that generates an operation attribute as embedded. This will enable the file into the main project output.
l If the Solution Explorer is not visible, select the View | Solution Explorer menu command.
l In the Solution Explorer, right click on Form1 and select View Code or press F7.
In the background of the file, add the following reference to the top of the code.
Imports system.reflection
Imports system.io
l To load the image into the picture box, add a method to addimagetopicturebox.
Private sub addimagetopicturebox ()
Picturebox1.image = new system.drawing.bitmap (reflection.assembly.getexecutingassembly (). GetManifestResourceStream ("PocketPcapp.gogo.gif")))
Picturebox1.size = PictureBox1.image.size
End Sub
l To switch to the design interface, press SHIFT F7 or Select View | Designer Menu Command.
l To create an Form Load event handle, double-click the blank area of the form (wherever the place covered by any controls). The designer automatically creates a handle and puts the mouse on the event handle method within the file background code area.
When the form is loaded, add the following code to call AddImagetopictureBox
Private Sub Form1_Load (Byval E AS System.Object, Byval E AS System.Eventargs) Handles MyBase.LOAD
AddImagetopictureBox ()
End Sub
4. Task 4 Run Application
l Select file | Save all menu commands.
l Determine view | Toolbar | Device is selected.
In the deployment device drop-down box on the Device Extended Toolbar, select the Pocket PC 2002 Simulator (default).
Figure 7 deploying device options
Note: In the Device Extensions project properties page or in the project's Properties form, you can also modify the configuration device.
l To run the program, select Debug | Start menu command or press F5.
Visual Studio .NET will display the deployment PocketPCAPP dialog as shown in Figure 4.9. To continue, point deploy deploy. Figure 8 Deploy PocketPCAPP dialog
The list shows the form that is running. Note that the form may take a little time in the Pocket PC 2002 Emulator. Don't do any action before the form is displayed in the Pocket PC 2002 Emulator.
l To turn off the form, the upper right corner OK, as shown in Figure 4.10. When you turn off the form in Emulator, you will see that the program exits from the debug mode of the IDE. Do not close the Pocket PC 2002.
Figure 9 Pocket PC 2002 Emulator Simulator Running Interface
Figure 10 step-by-step pocketpcapp run results
At this end, we have run on your computer! The above procedures have been debugged in the Microsoft Visual Studio .NET 2003 in the environment!
For more learning resources, please refer to Microsoft Visual Basic .NET 2003 Resource Kit
Author:
DEKER MSN
:
Dekkerdillon@hotmail.com email: DEKER99@163.com