Esempio n. 1
0
/***************************************************
OnSize
	The framework calls this member function after the window's size has changed.
	The Ultimate Grid takes this opportunity to reallocate the off-screen bitmap
	used by the double buffer mode.
Params:
	nType		- please see MSDN for more information on the parameters.
	cx
	cY
Returns:
	<none>
*****************************************************/
void CUGGrid::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);

	// reallocate the double buffer bitmap
	if( m_doubleBufferMode )
		SetDoubleBufferMode( m_doubleBufferMode );
}
Esempio n. 2
0
/***************************************************
OnSetup
	This function is called just after the grid window 
	is created or attached to a dialog item.
	It can be used to initially setup the grid
****************************************************/
void CRealTimeGrid::OnSetup(){
	
	int y;
	int ROWS = 25;
	int COLS = 6;
	int iHeight;
	CUGCell cell;
	CString strTemp;
	CDC* pDC;

	m_pro1Index = AddCellType( &m_pro1 );
	m_pro1.SetCanAdjust( FALSE );
	m_buttonIndex = AddCellType( &m_button );

	pDC = GetDC();
	iHeight = -MulDiv( 10, GetDeviceCaps( pDC->m_hDC, LOGPIXELSY), 72 );
	m_font1.CreateFont( iHeight,0,0,0,800,0,0,0,0,0,0,0,0, _T( "Arial" ) );
	m_font2.CreateFont( iHeight,0,0,0,500,0,0,0,0,0,0,0,0, _T( "Arial" ) );
	ReleaseDC( pDC );
	
	SetDefFont(&m_font2);

	SetUniformRowHeight(TRUE);
	SetDefRowHeight(25);
	SetNumberCols(COLS);
	SetNumberRows(ROWS);
	SetDoubleBufferMode(1);
	Set3DHeight( 2 );

	SetTH_Height( 0 );
	SetSH_Width( 100 );

	for( y = 0 ; y < ROWS ; y++ )
	{
		QuickSetCellType(0,y,m_pro1Index);
		QuickSetAlignment(0,y,UG_ALIGNCENTER|UG_ALIGNVCENTER);
		QuickSetText( 0, y, _T( "20" ) );
		QuickSetTextColor(0,y,RGB(0,0,0));
		QuickSetHTextColor(0,y,RGB(0,0,0));
		JoinCells(0,y,2,y);

		QuickSetAlignment(3,y,UG_ALIGNCENTER|UG_ALIGNVCENTER);
		QuickSetText(3,y,_T( "Normal" ) );
		//QuickSetFont(3,y,&m_font2);

		strTemp.Format( _T( "Sensor %d" ), y );
		QuickSetText( -1, y, strTemp );
	}

	GetColDefault( 4, &cell );
	cell.SetCellType( m_buttonIndex );
	cell.SetText( _T( "Reset" ) );
	cell.SetAlignment( UG_ALIGNCENTER | UG_ALIGNVCENTER );
	cell.SetBackColor( GetSysColor( COLOR_BTNFACE ) );
	SetColDefault( 4, &cell );

	GetColDefault( 5, &cell );
	cell.SetCellType( UGCT_CHECKBOX );
	cell.SetLabelText( _T( "Enabled" ) );
	cell.SetBool( TRUE );
	cell.SetAlignment( UG_ALIGNVCENTER );
	SetColDefault( 5, &cell );
	SetColWidth( 5, GetColWidth( 5 ) + 20 );

	SetTimer( TIMERID, 100, NULL);
}