VncSharp: Documentation
The following is a guide to getting started using the VncSharp RemoteDesktop control. Instructions are provided for Visual Studio.NET users as well as for those using Command-Line compilers.
You are encouraged to download the example application source, which is available in a C# version or VB.NET version. This example application demonstrates the main uses of VncSharp's RemoteDesktop control. If you are interested in more details, please consult the RemoteDesktop.cs file itself, which is well documented.
1a) Setup for Use with Visual Studio.NET
- Create a new C# or VB.NET Windows Application project.
- Right-click inside the Toolbox and choose Choose Items... or Add/Remove Items... depending on your version of Visual Studio--do this under the General tab so as not to clutter your Windows Forms tab.
- Click Browse... and locate the VncSharp.dll file. Or, if you've registered VncSharp in the GAC, you can scroll down in the existing list.
- In either case, you now need to locate the RemoteDesktop control and make sure it is checked.
- Click OK, and you should see the RemoteDesktop icon in the Toolbox.
- Drag-and-drop the RemoteDesktop control to your Form. After resizing the control, you will see a standard Windows desktop. This image is only displayed at design time and will be replaced with the remote desktop image once the application is run.
- Change the RemoteDesktop control's Dock Style to Fill in the Properties Window.
- Press F7 to view the Code for your Form.
- Include the VncSharp Namespace at the top of your source file by adding the code: using VncSharp;
1b) Setup for Use with Command-Line Compilers (csc, mcs, etc.)
- You must add a run-time reference to the VncSharp.dll file by including the following switch in your compiler options: /res:\path\to\VncSharp.dll
- Include the VncSharp Namespace at the top of your source file by adding the code: using VncSharp;
- In a Windows Forms derived class, add a member variable of type VncSharp.RemoteDesktop and instantiate this object in the form's constructor.
2) Coding the RemoteDesktop Control
The best way to learn about how to code the RemoteDesktop control is to examine the example application (C# version or VB.NET version) and look at the RemoteDesktop.cs file itself. If you are interested, you can also explore the classes used by the RemoteDesktop, which handle low-level RFB protocol messages. These are useful if you wish to build an application that does something custom on top of the VNC protocol itself.