Click here to Skip to main content
Licence CPOL
First Posted 19 Apr 2008
Views 14,711
Downloads 152
Bookmarked 24 times

Tracker - A Windows Form

By | 19 Apr 2008 | Article
updated with a gribanchor feature, a bugfix and translated to c++/cli

Introduction

In 2002 Andelko Pavelic created a nice and simple example of a custom windows forms control for .net 1.0, it can be found at http://www.codeproject.com/KB/vb/tracker.aspx

I have updated the project to VS2005 and translated it to c++/cli. The result is a control for .net 2.0 that does almost exactly what the original did.

Background

For one of my projects I needed a custom control much like tracker, but it lacked a very small (but essential) feature, namely the ability to control the grid alignment. The grid "starts" at the top of the control and draws a horizontal like every x pixels. I needed it to "start" at the bottom, so when a control is resized, the grids stays anchored to the bottom of the control.

Because I use c++ and I dislike switching from one visual studio version to another, I have also converted it to c++/cli. To not disappoint the VB users, if have merged the additions back into the VB version. See below for both downloads.

Using the code

Using the control is no different than using the original. (or any other custom control) . Just add the tracker.dll to your control toolbox by right-clicking it in the custom section,
"choose items"->browse and select tracker.dll.

Points of Interest

The initial value of the graph was set to 50 in v1.0, in the VB version it is now set to 0, but in the c++ version you can change it by setting the static initialValue variable before creating the control. This is useful because the internal thread starting immediately after creating the control.

History

2002/?/? v1.0

The original by Andelko Pavelic

2008/04/19 v1.1

- fixed a bug in the grid display causing it to not always draw all vertical grid lines depending on the width/grid ratio

- added a property to specify the grid archor

- changed the update RefreshingTime property from four fixed values to an integer value in ms.


License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

screanjap



Netherlands Netherlands

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 19 Apr 2008
Article Copyright 2008 by screanjap
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid