Click here to Skip to main content
13,402,312 members (42,983 online)
Click here to Skip to main content
Add your own
alternative version


399 bookmarked
Posted 24 Aug 2007

The Ultimate Grid Home Page

Rate this:
Please Sign up or sign in to vote.
The Ultimate Grid is now Open Source



We are very happy to announce that we have made the decision to offer our commercial lineup of MFC libraries, including Ultimate Toolbox, Ultimate Grid, and Ultimate TCP/IP to the community free of charge.

These are the full and complete libraries including source code, documentation, samples and examples.

Ultimate Toolbox, Ultimate Grid and Ultimate TCP/IP come with full source code, and are compatible with Microsoft Visual Studio versions 6.0 through 2005.

The Ultimate Toolbox and line of related MFC libraries products have been powering professional MFC applications for more than 10 years. We realize that there is a very large number of users who are still coding new applications in Visual C++ and MFC and who are looking for effective and proven libraries to enhance their applications, as well as those with legacy code to maintain and update.

By releasing these long standing MFC libraries to the community we hope that the libraries will continue to grow, evolve and provide a library of useful controls to the development community through the auspices of The Code Project and its members.


Ultimate Grid Features

Ultimate Customization

Ultimate Grid 2005 was built with flexibility in mind, and provides a framework that allows you to replace many of the Grid's components at any time. The customization of Ultimate Grid 2005 is made as simple as possible. We know that each application requires different functionality, and very often our users customize (or develop new) classes for user interaction (e.g. cell types, edit controls, and data access classes).

Some examples of the flexibility of Ultimate Grid configuration:

Cell Borders

Focus Rectangles

Multi Selection styles

XP Themes

Excel Style


Scrolling functionality is vital to all grid components, and this is where you will notice the superiority of the Ultimate Grid. We can scroll through thousands of rows per second, or through as few as one or two. You also have the ability to programmatically scroll Ultimate Grid's view to a specific cell.


Along with the optimized scrolling performance of the Ultimate Grid, the design of the Ultimate Grid also allows you to very effectively make changes to grid's data and display, allowing it to perform well with real time data.

Datasources and Cell Types

Ultimate Grid separates the data and its visual representation through use of datasource and cell type classes. This allows you to easily represent the same data in different forms. The Ultimate Grid comes with number of pre-built datasources (ADO, DAO, ODBC, etc) which allow you to easily connect to a database. The software also comes with a variety of cell types (droplist controls, spin buttons, check boxes, etc) which allow you to easily customize user's experience with your data. And if any of our classes do not fit your needs it is very simple to create the piece that you do need.

Cell Types...

... and more Cell Types


The Ultimate Grid design not only allows you to edit any cell in the grid, (naturally, with you controlling which cells can and cannot be edited through either use of a Read Only flag or through overriding a virtual function), but it also allows you to edit each cell using a different edit control (i.e.: numeric edit control, mask edit control, custom edit control, etc).

Context Sensitive Help

If your application is using context-sensitive help and a user hits F1 (or any other form of context sensitive help activation) then the Ultimate Grid will provide you with a notification specifying which cell the user is asking help on. At that point all that is required is for you to return the relevant help ID and the grid will take care of the rest.

The Drag-and-Drop and Copy-Paste Functionality

The Ultimate Grid provides ability for its data to be shared with other grids or applications through drag-and-drop and Copy-Paste functionality.

Small Footprint

One of the most exciting qualities of Ultimate Grid 2005 is its surprisingly small footprint. It consumes very little memory (e.g. as little as 100k), which is exceptional considering the number of features that it has.


Here are a few articles to get started with - these touch on some of the major points of interest in using the Ultimate Grid in your projects. More info can be gleaned from the class references in the compiled HTML documentation, as well as the samples and demo source code.

Beginner's GuideThe Beginner's Guide to the Ultimate Grid, intended as a quick overview on using the grid in the most common scenarios.
EditingEditing cell contents in the grid, covering basic editing calls and notifications as well as an introduction to advanced editing options.
Cell TypesExplains how celltypes are used, lists those available 'out of the box', and provides a short introduction to creating custom celltypes for use in the grid.
DataSources Explains the basics of the datasource concept, lists the available pre-built datasources, and provides an introduction to providing your own CUGDataSource based class for use in the grid.
FAQA selection of frequently asked questions submitted by users of the Ultimate Grid.



We've split up the components of the Ultimate Grid into separate ZIP files, to make updates easier.

In general, for a code library such as the Ultimate Grid, installation files are a cumbersome nuisance. While they do allow the formality of license agreement acceptance, and are expected of a commercial offering, for our purposes it would be too much trouble to update an entire install in order to accommodate a small update to a core source file or sample.

The samples and library projects all reference relative paths with respect to source and include files, and should compile 'out of the box' if the .zip files are extracted to a common directory - your installation should look more or less like this:

Note - we've bundled the DataSources directory with the Samples zip - this directory contains the source code for each of the custom datasources (ADO, ODBC etc) that ship with the grid, as well as related samples.

Getting Started

Getting started with the Ultimate Grid is as simple as adding a few files to your MFC project and filling in some initial setup information. You can view the Beginner's Guide on line, as well as examine the tutorials in the chm format documentation download.

We've also added on line articles discussing editing, cell types, and using custom datasources with the Ultimate Grid.

Community Support

Support for the products will be community based, and will include participation from core developers of the products, long standing and informed users of the products, and other members of the community


It is our intention that you be able to use the libraries in any manner you wish however specific details of licensing rights, limitation of liability, and other details are included both here, and in a license.txt file included with the downloadable packages


Ultimate Grid 7.3

  • Rolls up all existing updates to UG into a new official release
  • Adds VC2008, VC2010 and VC2012 projects and solutions

August 2007 - Ultimate Grid 7.2 becomes the initial CodeProject release.

Ultimate Grid 7.2

  • An update to the XML classes (courtesy user kvt)
  • Addition of AllExamples and AllDemos projects.
  • Various fix ups to the existing CUGDatasource based classes for Unicode and VS2005 support

Ultimate Grid 7.0/7.1

  • Full support for VC++ 2005 compilation (with 0 warnings)
  • Support for XP themes
  • Drop Down Grid Cell Type
  • A powerful new Grid cell type allowing you to add Master Detail functionality to the grid
  • XML Import/Export Functionality - Define the Grid layout, defaults and data using XML
  • Autofit Column Cell Type - Automatically increase the row height to show the entire text string
  • Improved ADO Datasource - Sorting and additional improvements have been made
  • Excel XP look and feel - Configure Ultimate Grid 2005 to have an Office XP-like look and feel
  • Backwards compatible with Ultimate Grid 97 and Ultimate Grid 6.1. So you don't have to worry about any upgrading issues.
  • Common MFC customer suggestions added - We've listened to the developers using the old version and done what you wanted
  • Enhanced Numeric Support

Ultimate Grid 6.0


  • New drop-down grid celltype, providing functionality to display another Ultimate Grid within a popup window
  • New auto-fit celltype, providing ability for cells to adjust its column and row size in order for the text to be fully displayed.
  • All celltypes were improved to respect the ReadOnly flag
  • All celltypes were improved to function properly with BestFit function
  • The droplist celltype will now properly display when opened with keyboard
  • The multi-font celltype will now properly draw when center or right alignments are selected.
  • A CUGCellType::DrawBackground virtual function was added. This function takes care of drawing the background area of the cells. All standard celltypes were modified to use this function whenever required.
    • By default the DrawBackground function uses the FillRect (with a brush) function to fill-in specified rect. This change provides the grid with a better support for 256 color environments.
  • The CUGCellType::GetBestSize virtual function will now be called with a size parameter initialized to current cells height and width.
    • This information is used by cells with a bitmap to properly calculate width of the bitmap image.
  • The CUGCellType::DrawText will now unselect the font object selected.


  • New XML parser class was added to provide functionality to load and save XML documents. The XML format supported is compatible with XML files used by the MS Excel XP.
  • An IsOpen virtual function was added to the CUGDataSource
  • Improved on the ADO datasource
    • Implemented sorting functionality
    • Implemented IsOpen function to check if a connection is currently open


  • Numbers are stored as numbers now
    • For display purposes the numbers are formatted using clients local settings
    • During edit the numeric value is shown without formatting
    • The formatting of numbers can be disabled using UGCELL_DONOT_LOCALIZE cells property flag. Set through CUGCell::SetPropertyFlags.


  • The BestFit function will now send CUGCellType::OnChangedCellWidth and CUGCtrl::OnColSized notifications
  • The OnSheetSetup will now allow users to setup all of the sheets properly, including side heading width.
  • The CUGCtrl::AdjustComponentSizes and CUGCtrl::Moved will not redraw the grid when paint mode is disabled. The AdjustComponentSizes will perform all sizing calculations, but will not redraw any of the grids components.
  • The CUGCtrl::OnPaint and SetPaintMode (TRUE) will call AdjustComponentSizes instead of RedrawAll
  • The CUGCtrl::OnPaint will not pre-paint the entire grid view area with a button face-color, now this function will only draw the bottom right area that is not covered by the scrollbars or any other grids component
  • Added new notification CUGCtrl::OnSelectionChanged, which is called by the multiselect class to inform the user that selection has changed.
  • Added a CUGCtrl::EnableScrollOnParialCells function which control how grid behaves when user drags mouse over partially visible cells (bottom or right side of the grid area), by default we will treat this area as outside of the grid and we will scroll using current ballistics settings. The benefit of this flag is that it is now possible to prevent the grid from taking any action when the mouse is over this (gray) area.
  • The CUGCtrl::BestFit and CUGCtrl::FitToWindow functions are now virtual
  • Added CUGCtrl::AddFontIndirect function that allows users to add CFont objects to the grids font list by passing a LOGFONT object
  • The CUGCtrl::OnKillFocus will now provide pointer to the new window along with the section that lost focus.


  • Added TempDisableFocusRect and PaintDrawHintsNow functions to allow for even quicker redraw
  • The CUGGrid::OnPaint determines what are the cells that should be updated (if a rect is invalidated), and redraws only the required cells plus the current cell.


  • Added a CUGTab::GetTabLabel function to allow retrieval of a tab label string


  • Tooltips will now work on heading cells
  • The m_paintMode flag is now set to FALSE when the grid is created, this will prevent repainting until the grid creation/setup is completed.
  • The multiselect class will now report number of groups properly.
  • The multiselection will now clear when user selects a block of cells (dragging, or SHIFT-click) and clicks on the last selected cell.
  • The Ultimate Grid will properly compile now when UG_ENABLE_PRINTING is not defined


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


About the Authors

The Ultimate Toolbox
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
Group type: Organisation

447 members
Software Developer (Senior)
Canada Canada
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralRe: Compiler errors Ultimate Grid with update 03 Pin
ehaerim28-Oct-13 19:36
memberehaerim28-Oct-13 19:36 
GeneralPrint in the Dialog Pin
yikai29-Aug-09 3:28
memberyikai29-Aug-09 3:28 
GeneralRe: Print in the Dialog Pin
Tim Deveaux29-Aug-09 13:26
editorTim Deveaux29-Aug-09 13:26 
GeneralRe: Print in the Dialog Pin
yikai29-Aug-09 17:47
memberyikai29-Aug-09 17:47 
Question[Solved] AfxMessageBox shows behind main window after calling CFileDialog when the grid is active [modified] Pin
Member 99665130-Jul-09 5:04
memberMember 99665130-Jul-09 5:04 
AnswerRe: AfxMessageBox shows behind main window after calling CFileDialog when the grid is active Pin
Member 99665130-Jul-09 18:49
memberMember 99665130-Jul-09 18:49 
GeneralExport to excel Pin
yaoleibjfu27-Jul-09 18:20
memberyaoleibjfu27-Jul-09 18:20 
GeneralRe: Export to excel Pin
The Ultimate Toolbox28-Jul-09 5:47
groupThe Ultimate Toolbox28-Jul-09 5:47 
Have a look at the XMLSample project in the DataSources\XML\XMLSample directory.

The XML datasource is technically not a datasource in and of itself, but the underlying XMLParser has a Save() method that can save info from the grid/cells to xml in a format that excel should be able to open.

The CUGDataSource::SaveAs is provided for you to override as you like, but the same functionality can probably be built in to a Save function added to the grid - again, have a look at the XMLSample for some ideas.
GeneralPrinting multitab grid crashes Pin
Pieler2624-Jul-09 5:39
memberPieler2624-Jul-09 5:39 
GeneralRe: Printing multitab grid crashes Pin
The Ultimate Toolbox24-Jul-09 15:04
groupThe Ultimate Toolbox24-Jul-09 15:04 
GeneralCell pattern attribute Pin
vinhx917-Jul-09 6:48
membervinhx917-Jul-09 6:48 
GeneralUpdate Invisible Sheets Pin
Mr_Byte15-Jul-09 11:15
memberMr_Byte15-Jul-09 11:15 
GeneralRe: Update Invisible Sheets Pin
Tim Deveaux15-Jul-09 13:38
editorTim Deveaux15-Jul-09 13:38 
QuestionEdit MultiSelected Cells Pin
Ronny Hatteland15-Jul-09 0:02
memberRonny Hatteland15-Jul-09 0:02 
Generaldraw straight line functionality Pin
vinhx912-Jul-09 7:58
membervinhx912-Jul-09 7:58 
QuestionProgrammatically setup the grid on a given cell in input mode Pin
foobar249-Jul-09 23:55
memberfoobar249-Jul-09 23:55 
AnswerRe: Programmatically setup the grid on a given cell in input mode Pin
Tim Deveaux10-Jul-09 6:00
editorTim Deveaux10-Jul-09 6:00 
GeneralRe: Programmatically setup the grid on a given cell in input mode Pin
foobar2410-Jul-09 7:36
memberfoobar2410-Jul-09 7:36 
GeneralRe: Programmatically setup the grid on a given cell in input mode Pin
Tim Deveaux10-Jul-09 10:18
editorTim Deveaux10-Jul-09 10:18 
GeneralRe: Programmatically setup the grid on a given cell in input mode Pin
foobar2411-Jul-09 7:43
memberfoobar2411-Jul-09 7:43 
GeneralRe: Programmatically setup the grid on a given cell in input mode [modified] Pin
Tim Deveaux11-Jul-09 12:52
editorTim Deveaux11-Jul-09 12:52 
GeneralIt works :) , many thanks Re: Programmatically setup the grid on a given cell in input mode Pin
foobar2412-Jul-09 5:04
memberfoobar2412-Jul-09 5:04 
GeneralRe: It works :) , many thanks Re: Programmatically setup the grid on a given cell in input mode Pin
Tim Deveaux12-Jul-09 5:13
editorTim Deveaux12-Jul-09 5:13 
GeneralPerformance issues - dialogs and WM_PAINT Pin
BDMarler4-Jul-09 22:30
memberBDMarler4-Jul-09 22:30 
GeneralRe: Performance issues - dialogs and WM_PAINT Pin
Tim Deveaux8-Jul-09 5:59
editorTim Deveaux8-Jul-09 5:59 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180218.2 | Last Updated 15 Sep 2013
Article Copyright 2007 by The Ultimate Toolbox,
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid