Windows Trending

If you do not have a copy of Visual Studio you can download a free version of Visual Basic Express 2010 or C# Express 2010 from  If you have no experience with either Visual Basic or C# choose Visual Basic.  No programming is required to use OPC Windows HMI.NET.

If you are new to Visual Studio and want to implement HMI Quick Start Templates view the following videos.

WinForm Multi-Document Interface:

WinForm Tabbed Interface:


The following steps can be used to add a trend window to a C#, C++, or Visual Basic.NET application.  Refer to WinForm Example Code in the Form FormMain for programmatic interface of adding and removing pens.  All properties are programmatically accessible.  The following example demonstrates the trend window with no code required.  You can use the OPC Trend.NET control in WinForm and WPF applications using Visual Studio 2005, 2008, and 2010.  The 1.1 Framework version of the trend window can also be used with Visual Studio 2003.

View the following short video on how to add a trend window to a WinForm or WPF application.

View the following detailed video on how to add a trend window to a WinForm application with Visual Studio.

View the following video on how to display both real-time and historical data in the same trend window.

View the following video on how to restrict and set specific real-time time frames.

View the following video on how to setup a trend window for X-Y Plot trending.

Use the following steps or view the following videos on how to add a trend window to a WinForm application.

Note: If you are using Visual Studio 2010 make sure to set the Target Framework to the Full Framework and not the Client Profile which is the default.  View the following video on how to set the Target Framework in Visual Studio 2010.





Start Visual Studio 2005, 2008, or 2010 and select File->New->Project to create a new C#, C++, or VB.



Select Windows Application as the project type.


** Note: When using Visual Studio 2010 set the Target Framework to the full Framework.  The Client Profile does not have the components needed for trending in your application.

View the following video on how to set the Target Framework for you Visual Basic or C# application.



From the Toolbox if OPCTrendControl is not available right click in the Toolbox and select Choose Items.  If it is available to step 4.

From the .NET Framework Components select OPCTrendControl and then select OK.



Add the OPCTrendControl component onto the Form.

Resize both the form and trend window to the desired size.


Right click on the trend window and select Properties.


Set the Anchor property to Top, Bottom, Left, Right.


Expand the ChartRates property and set the TimeFrame to 60 seconds.


Select the Pens property and click on the small grey square with the 3 dots at the right.



Select the Local OPC Systems Service to display a list of available Tags to

Note: If you do not see the desired Tag in this list go back to Configure-Tags and enable the Trend Point property for the Tags you wish to trend.

Note: If you want the application to be deployed across a network to remote PCs select the Network Node or enter an IP Address in the NetworkNode field and use the Select button to include the network node or IP Address of the OPC Systems Service source.

You can also use the DirectOPC interface to connect directly to OPC Server Items.



Expand the Ramp Tag and select Value.

Select the Add Pen button or right click on Value and select Add Pen.


The pen Ramp.Value will appear in the lower left list of pens.  You can select the pen to change of the pen properties that appear to the right.  The YAxisRangeHigh and YAxisRangeLow properties are important when the trend windows YAxis.ScaleMode property is set to PercentOfPenRanges.


Select OK from the Pens dialog.


If the PC(s) that will run this have a video card that can support OpenGL rendering set the RenderMode3D property to True.

If you are unsure leave this property to False for now.


Expand the Views property and set the trend window Lighting and PerspectiveView to the desired settings.



If you desire for the operators changes to the trend window during runtime to remain set the ConfgiurationFile property to a valid file path.  Make sure each system the application will run on that the directory path is valid.

Note: If you set this property to a file make sure you deploy the file with the application in the directory you specify..

Leave this property blank if you wish to have the default properties set during configuration remain on the application restarting.


Set the compile mode on the Visual Studio toolbar to Release.



Select Build from the VS menu and select to Build the application.


Use Windows Explorer to browse for the application located in the bin\Release directory and run the application.


To deploy the application to remote nodes first make sure the Pen selection as described in step 9 is set to a Network Node or IP Address.  Then simply copy the files in the bin\Release directory to the target systems or follow the Smart Client deployment section in this help file to deploy your application using Click Once Deployment.

View the following video on Smart Client Deployment.


Continue: * Web Trending