Any idea that has not received any kudos within a year after posting will be automatically declined.
Recently DMC developed a high speed vision inspection system using LabVIEW. This system inspects many different parts and each part requires different inspection criteria, so we needed to develop a user interface (UI) that could be used to configure the current products, as well as be flexible enough to configure new products.
The manufacturing machine was already running on a Windows CE device, so our UI would need to interface with the UI already on the system and run on Windows CE. For a faster development time we decided to go with C# .NET for Windows CE. Unfortunately, the .NET library and functionality for Windows CE is far less capable than the standard .NET library.
The Windows CE library was sufficient for most of our needs, but there were two areas that proved fairly difficult. The first difficult item was obtaining and decoding the custom TCP messages that contained the images and inspection results from the LabVIEW Embedded Vision System that was running the vision inspection. However, after spending some time encoding and decoding the images, the UI was able to access full-sized images from the inspection system. The next difficulty was that once these images were on the UI we needed to be able to zoom, pan, and draw inspection areas on the image. In a full .NET library this would have been really simple, but for a Windows CE device it required some custom work. The first step was to create a custom control and place just a picture box inside. Additionally, I set the SizeMode to StretchImage. By having the image take up whatever size the picture box was, I was able to zoom by increasing/decreasing the size of the picture box. Additionally, I was able to pan by moving the picture box relative to the custom control.
I have included all of the back-end code that I used to make the image behave as I wanted. The code I had was significantly more complicated, as I needed to be able to draw and pan rectangles that were used for inspection zones. I tried to remove all of that code to make the items I am explaining more clear; however, if anything seems odd, it is likely a remaining piece of the old code. If anyone is interested in the rectangle drawing code I would be happy to provide more information. Here is a link to the simplified code: