Click here to Skip to main content
15,901,205 members
Articles / Desktop Programming / MFC

The Ultimate Grid Home Page

Rate me:
Please Sign up or sign in to vote.
5.00/5 (122 votes)
14 Sep 2013CPOL10 min read 4.7M   82K   418   1K
The Ultimate Grid is now Open Source

Image 1Image 2Image 3Image 4



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
Image 5

Focus Rectangles
Image 6

Multi Selection styles
Image 7

XP Themes
Image 8

Excel Style
Image 9


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.

Image 10
Cell Types...

Image 11
... 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:

Image 12

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)

Written By
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.
This is a Organisation

476 members

Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

BugDateTimePicker cell type isn't working (CUGCTDateTimePicker) Pin
Tomas Ramirez18-Nov-22 15:47
Tomas Ramirez18-Nov-22 15:47 
Question4K Monitors Pin
DroogsAlex9-Aug-22 7:06
DroogsAlex9-Aug-22 7:06 
QuestionCompile Excel Demo with "Use MFC in a Static Library" and /MTd result link error Pin
uniteryspace15-Jun-22 15:01
uniteryspace15-Jun-22 15:01 
QuestionConvert numeric data in grid from mm->inch and inch->mm Pin
Member 39550234-Feb-21 9:20
Member 39550234-Feb-21 9:20 
Questionm_lastKey set to 0 in OnEditFinish when ESC is pressed Pin
Member 1497773428-Oct-20 12:00
Member 1497773428-Oct-20 12:00 
QuestionIs it possible to disable the whole grid? Pin
Maximilien21-Feb-20 10:29
Maximilien21-Feb-20 10:29 
AnswerRe: Is it possible to disable the whole grid? Pin
Tim Deveaux28-Apr-20 15:13
Tim Deveaux28-Apr-20 15:13 
GeneralRe: Is it possible to disable the whole grid? Pin
Maximilien29-Apr-20 1:44
Maximilien29-Apr-20 1:44 
GeneralRe: Is it possible to disable the whole grid? Pin
Tim Deveaux29-Apr-20 8:00
Tim Deveaux29-Apr-20 8:00 
QuestionCUGGrid high DPI scaling behaviors Pin
Rui Frazao21-Jun-19 6:11
Rui Frazao21-Jun-19 6:11 
AnswerRe: CUGGrid high DPI scaling behaviors Pin
Rui Frazao25-Jun-19 23:35
Rui Frazao25-Jun-19 23:35 
GeneralRe: CUGGrid high DPI scaling behaviors Pin
Tomas Ramirez30-Jan-23 20:31
Tomas Ramirez30-Jan-23 20:31 
Questionreadonly but selectable droplist in a cell Pin
Hai Jin24-Aug-18 16:20
Hai Jin24-Aug-18 16:20 
QuestionDrag and Drop within Grid Pin
Shazir18-Jun-18 12:12
Shazir18-Jun-18 12:12 
QuestionHow do I show a scrollbar inside a cell? Pin
Youn-seong Cho29-May-18 17:07
Youn-seong Cho29-May-18 17:07 
AnswerRe: How do I show a scrollbar inside a cell? Pin
Member 466346820-Jun-19 2:41
Member 466346820-Jun-19 2:41 
QuestionCan this package be used for commercial propose? Pin
Kyle.CY2-May-18 20:04
Kyle.CY2-May-18 20:04 
AnswerRe: Can this package be used for commercial propose? Pin
The Ultimate Toolbox3-May-18 13:11
The Ultimate Toolbox3-May-18 13:11 
QuestionImpossible to use it on const functions Pin
Member 568844320-Apr-18 1:18
Member 568844320-Apr-18 1:18 
QuestionHow to fix Uglibsel.h in 64bit system? Pin
Member 119057673-Dec-17 20:46
Member 119057673-Dec-17 20:46 
AnswerRe: How to fix Uglibsel.h in 64bit system? Pin
Tim Deveaux5-Dec-17 7:06
Tim Deveaux5-Dec-17 7:06 
Questioninsert bitmap into grid dynamically Pin
Member 79935124-Oct-17 7:45
Member 79935124-Oct-17 7:45 
QuestionDemo Application Pin
Member 114026469-Jun-17 7:38
Member 114026469-Jun-17 7:38 
QuestionCopy/paste from excel Pin
Member 127948737-Apr-17 5:12
Member 127948737-Apr-17 5:12 
QuestionMultiple Grid Pin
Member 1279487318-Feb-17 7:05
Member 1279487318-Feb-17 7:05 

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.