Click here to Skip to main content
Click here to Skip to main content

An MFC ActiveX control to display trays

, 15 Nov 2001
Rate this:
Please Sign up or sign in to vote.
An MFC ActiveX control to display trays and samples, with selection and cherry picking properties

Sample Image

Introduction

I recently had need to develop an ActiveX control for displaying trays and samples in a chemistry application used by chemists (surprise there!). The control needed to be able to display trays of any size x*y, have column headings; allow sample insert and cherry picking. The control itself is very easy to use in your own projects once the ActiveX control has been registered. In visual studio you can add the control to your application by using Project->Add to project->Components and controls go to ActiveX controls and look for TrayControl control. Insert it into your project and a wrapper class will be created for you. You should then be able to drag controls onto dialogs and forms in your app from the resource editor.

Some of the more interesting functions supported are:

EnableDoubleBuffering()
This makes the control use a memory DC (Kieth Rules class, with a very small mod), so the control does not flicker.
EnableCherryPicking()
Allows the user to select position with the mouse, drag selections etc.
SetShowInsertionPoint()
Allows the user to see and move the next location insertion point in the control.
SetShowCellTitles
The names of samples in a given cell location will be displayed when the mouse passes over a given cell. The control itself can fire the following events:
FireControlClicked
When the user left clicks on the control. If the user clicked on a specific cell, this location is reported, else -1.
FireCherryPicked
The user has performed a cherry picking operation, or changed the cherry picked status of a cell.
FireInsertionPointChanged
The insertion point for the next sample was changed using the arrow keys or by double-clicking a cell.
FireControlRightClicked
The user right clicked the control. The cell location is given in the user did so on a specific cell, else -1.

Many other features are also available.

I hope you enjoy using the control.

Acknowledgments

Keith Rule - The MemDC class
Ales Krajnc - the ColorNames colours http://www.codeproject.com/gdi/colornames.asp

License

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

About the Author

Roger Allen
Software Developer (Senior) Sirius Analytical Instruments
United Kingdom United Kingdom
A research and development programmer working for a pharmaceutical instrument company for the past 17 years.
 
I am one of those lucky people who enjoys his work and spends more time than he should either doing work or reseaching new stuff. I can also be found on playing DDO on the Cannith server (Send a tell to "Maetrim" who is my current main)
 
I am also a keep fit fanatic, doing cross country running and am seriously into [url]http://www.ryushinkan.co.uk/[/url] Karate at this time of my life, training from 4-6 times a week and recently achieved my 1st Dan after 6 years.

Comments and Discussions

 
GeneralActiveX Control PinmemberVaibhav8831523-Mar-09 19:41 
GeneralVisual Studio 2005 PinmemberAndyUk0620-Jun-07 4:32 
GeneralSample Image doesn't display in Firefox Pinmemberjrem24-Nov-05 11:40 
GeneralRepost the code Pinmembergdom28-Mar-05 18:25 
Generalnice, but ... PinmemberMarkus Sicheneder5-Dec-01 1:30 
GeneralRe: nice, but ... PinmemberWREY30-Nov-03 10:23 
GeneralMissing resource files Pinmembercodehound16-Nov-01 16:06 
bmp, ico, etcFrown | :(
GeneralRe: Missing resource files PinmemberRoger Allen19-Nov-01 6:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 16 Nov 2001
Article Copyright 2001 by Roger Allen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid