Exemple #1
0
long GetLinestoFit( HWND hDlg, short win )
{
	long bh,h,t;
	RECT	rc;
	long numlines;
	HWND	hctrl = GetDlgItem(hDlg, IDC_FILEVIEW);

	AddToListView( hctrl, 0, "x" );
	ListView_GetItemRect( hctrl, 0, &rc, LVIR_BOUNDS );
	ListView_DeleteItem( hctrl, 0 );

	t = ListView_GetItemCount(hctrl);
	bh = rc.bottom - rc.top;

	GetControlRect( hDlg, hctrl, &rc );
	h = rc.bottom - rc.top;

	numlines = (h/bh)-1;
	if ( numlines != winStats[win].linesInWin )
	{
		// Changed the size of the window (vertically)
		winStats[win].resetScroll = 1;
		winStats[win].linesInWin = numlines;
	}

	return numlines;
}
void TGridLayout::DoAlign()
{
    ComputeColsWidth();
    ComputeRowsHeight();
    for (size_t col = 0; col < colCount; ++col)
    {
        for (size_t row = 0; row < rowCount; ++row)
        {
            TControl* control = GetControl(col, row);
            if (control != NULL)
            {
                control->Visible = IsVisible(col, row);
                if (control->Visible)
                {
                    TRect cellRect = GetControlRect(col, row);
                    control->SetBounds(cellRect.Left, cellRect.Top, cellRect.Width(), cellRect.Height());
                }
            }
        }
    }
}