I always imagined that to make a control like that you would need
to do a lot of custom drawing, but when using the Spy++ tool from the
Developer Studio package, I soon realized that the control was nothing
but a parent window with a number of child windows attached. The child
windows can be any kind of Windows control (including list boxes and regular
windows). The tables in the MS Access control are actually subclassed List box
controls with the
window styles. These styles give the window the resizing edges, caption
and floating capabilities.
My Relationship control also has support for a list box child control. I also added a subclassed regular window, which allows me to paint a nicely centred caption.
The binders (or arrows) that connect the windows are still custom drawn. They are drawn on the parent window's Device Context (DC) so they don't interfere with the painting of the floating child window controls.
This was my first attempt to make a control using the Microsoft WTL library.
This class library, made in the template-spirit of ATL, really produces nice and fast code. But if you use it, be prepared to spend time on scanning through its source code, because it is still poorly documented and has a very cumbersome architecture.
Source Code DependenciesMicrosoft Visual C++ 6.0
Microsoft WTL 3.0 Library
|Source Code (53 Kb)|