git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
| \section{wxGrid classes overview}\label{gridoverview}
 | |
| 
 | |
| wxGrid is a class for displaying and editing tabular information.
 | |
| 
 | |
| To use wxGrid, include the wxgrid.h header file and link with the
 | |
| wxGrid library. Create a wxGrid object, or, if you need to override
 | |
| some default behaviour, create an object of a class derived from wxGrid.
 | |
| You need to call CreateGrid before there are any cells in the grid.
 | |
| 
 | |
| All row and column positions start from zero, and dimensions are in pixels.
 | |
| 
 | |
| If you make changes to row or column dimensions, call UpdateDimensions and
 | |
| then AdjustScrollbars. If you make changes to the grid appearance (such as
 | |
| a change of cell background colour or font), call Refresh for the changes
 | |
| to be shown.
 | |
| 
 | |
| \subsection{Example}
 | |
| 
 | |
| The following fragment is taken from the file samples/grid/test.cpp. Note the
 | |
| call to UpdateDimensions, which is required if the application
 | |
| has changed any dimensions such as column width or row height.
 | |
| You may also need to call AdjustScrollbars. In this case, AdjustScrollbars
 | |
| isn't necessary because it will be called by wxGrid::OnSize which is invoked
 | |
| when the window is first displayed.
 | |
| 
 | |
| \begin{verbatim}
 | |
|   // Make a grid
 | |
|   frame->grid = new wxGrid(frame, 0, 0, 400, 400);
 | |
| 
 | |
|   frame->grid->CreateGrid(10, 8);
 | |
|   frame->grid->SetColumnWidth(3, 200);
 | |
|   frame->grid->SetRowHeight(4, 45);
 | |
|   frame->grid->SetCellValue("First cell", 0, 0);
 | |
|   frame->grid->SetCellValue("Another cell", 1, 1);
 | |
|   frame->grid->SetCellValue("Yet another cell", 2, 2);
 | |
|   frame->grid->SetCellTextFont(wxTheFontList->FindOrCreateFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0);
 | |
|   frame->grid->SetCellTextColour(*wxRED, 1, 1);
 | |
|   frame->grid->SetCellBackgroundColour(*wxCYAN, 2, 2);
 | |
|   frame->grid->UpdateDimensions();
 | |
| \end{verbatim}
 |