The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
2 Common Controls Library &nbsp
A Header Control


NOTE: this code has been superceded by the version at the new site.



&nbsp

Header Control

Download the Header Control with source (53kb)
Download the VB6 Header Control with source (53kb)

UpdatedUpdated! 25 August 1999
&nbsp Added the VB6 compile of the Header control, courtesy of Ed Haswell. &nbsp
UpdatedUpdated! 2 January 1999
There were a few bugs in the control identified whilst developing on the S-Grid control and some new features have been added.
&nbsp Attempt to set ColumnImage to -1 (no icon) or an index not in the ImageList caused a GPF. &nbsp
&nbsp AddColumn method set image to the first image in the ImageList when no Image specified. &nbsp
&nbsp ColumnHeader property set to "" caused no change or a corrupt string to appear in the header and ColumnHeader property. &nbsp
&nbsp RemoveColumn for column other than the last one caused the ColumnTags to be incorrect. &nbsp
&nbsp Control no longer raises ColumnEndDrag event with invalid order (-1) when the user cancels column dragging &nbsp
&nbsp Added method for getting and setting column order (ColumnIndex). &nbsp
&nbsp Added method for getting and setting column alignment (ColumnTextAlign). &nbsp
&nbsp Added method for getting and setting image alignment left/right (ColumnImageOnRight). &nbsp
&nbsp Previous version re-created the control from scratch when setting styles, this was not necessary. Now just the style is changed for a smoother display. &nbsp
&nbsp Source Code Note &nbsp
&nbsp This OCX is a binary compatible component which works with all other samples. If you compile your own copy of this OCX yourself please make sure you change the name. See disclaimer and license for more details. &nbsp
&nbsp Before you Begin &nbsp
&nbsp These projects require the SSubTmr component. Make sure you have loaded and registered this before trying any project. &nbsp

This source shows how to create fully-featured Header Control directly from COMCTL32.DLL. It is a good building block for generating your own controls. Check out the S-Grid project to see the control in use in an all-VB grid control.

Header Control features:

  • Drag-drop reordering of columns.
  • ImageList support allowing an icon to be displayed to the left of a header.
  • Mouse-over highlighting of column headers ("Hot Tracking").
  • Full set of header events: column left and right clicks, divider double clicks and drag-drop. You can prevent columns from being resized and restrict widths the user can choose.
  • Set whether the control has buttons or not (like in RegEdit) at run-time.
  • Set alignment of header columns left, right or centre.
  • Set the position of the image in the header, either to the left or to the right of the text.
Whilst you do not need the latest version of COMCTL32.DLL to run this control, some of the more advanced features, such as column highlighting as the mouse moves over, and drag-drop reordering of columns are only available in v4.72. This DLL is shipped with Internet Explorer 4.0, but can also be downloaded separately from the Microsoft site. (Note you must register with MSDN to follow this link, but it is free).



TopBack to top
Source Code - What We're About!Back to Source Code

&nbsp

AboutContributeSend FeedbackPrivacy

Copyright 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
Last updated: 25 August 1999