Click here to Skip to main content
16,006,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalappliction freezing.. Pin
10-Jun-02 15:13
suss10-Jun-02 15:13 
GeneralRe: appliction freezing.. Pin
Roman Nurik10-Jun-02 15:47
Roman Nurik10-Jun-02 15:47 
GeneralRe: appliction freezing.. Pin
10-Jun-02 16:12
suss10-Jun-02 16:12 
GeneralRe: appliction freezing.. Pin
Le centriste11-Jun-02 3:40
Le centriste11-Jun-02 3:40 
GeneralImage transformations Pin
SuperGeek10-Jun-02 14:20
SuperGeek10-Jun-02 14:20 
GeneralRe: Image transformations Pin
moswal10-Jun-02 15:45
moswal10-Jun-02 15:45 
GeneralRe: Image transformations Pin
Christian Graus10-Jun-02 16:47
protectorChristian Graus10-Jun-02 16:47 
Generalsize of a control (MSFlexGrid) Pin
BlackDogEngineering10-Jun-02 13:45
BlackDogEngineering10-Jun-02 13:45 
I am trying to dynamically size the column widths of a MSFlexGrid control. Presently, the code I'm using is this (which was hard enough to figure out):

// resize the column widths based on the dialog size
// and the number of columns.

// get the size of the control...
CDC * dc;
dc = this->GetDC();
dc->SetMapMode( MM_TWIPS );
CRect rc;
m_TheGrid.GetClientRect( &rc );

// convert the size to twips, required by SetColWidth...
dc->DPtoLP(&rc);  // convert rc to twips

int Width = rc.Width() / (CellsPerRow + 1);

// set a column and see what it acutally uses...
m_TheGrid.SetColWidth(1, Width );
Width = m_TheGrid.GetColWidth(1);

for ( int i=1; i < CellsPerRow+1; i++ )
{
   m_TheGrid.SetColWidth(i, Width );
}
// the first column is given all the extra width
int Remainder = rc.Width() - Width * CellsPerRow;
m_TheGrid.SetColWidth(0, Remainder );


What I've noticed is that even though I set a particular size like this:

m_TheGrid.SetColWidth(1, 332);


the size read via GetColWidth() is usually something different, like 330. That isn't too much of a problem, since I set one column, read what was actually set, then set all the columns (except the first one) to that value. I then account for errors by putting the remaining size into the first column.

BUT:

The size that is returned by the GetClientRect() call does not encompass the entire space available. That is, when I've got all my columns layed out, I still have stubstantial space available on the right.

I was halfway expecting to have LESS room because of a scroll bar. But the size reported by GetClientRect() underreports.

Does anyone have an idea about what is happening here?

I don't think it should matter, but I've set the font in this control to fixedsys.


Ron
GeneralCStringArray and pointers Pin
10-Jun-02 13:42
suss10-Jun-02 13:42 
GeneralRe: CStringArray and pointers Pin
Chris Losinger10-Jun-02 13:55
professionalChris Losinger10-Jun-02 13:55 
General10x Pin
10-Jun-02 13:55
suss10-Jun-02 13:55 
GeneralDuplicate insert block Pin
Stew10-Jun-02 12:07
Stew10-Jun-02 12:07 
GeneralRe: Duplicate insert block Pin
Rama Krishna Vavilala10-Jun-02 12:32
Rama Krishna Vavilala10-Jun-02 12:32 
GeneralDisable MRU file list Pin
Haakon S.10-Jun-02 11:48
Haakon S.10-Jun-02 11:48 
GeneralRe: Disable MRU file list Pin
10-Jun-02 19:40
suss10-Jun-02 19:40 
GeneralRe: Disable MRU file list Pin
Haakon S.10-Jun-02 20:37
Haakon S.10-Jun-02 20:37 
GeneralRe: Disable MRU file list Pin
Alexandru Savescu10-Jun-02 21:30
Alexandru Savescu10-Jun-02 21:30 
GeneralRe: Disable MRU file list Pin
Stephen C. Steel11-Jun-02 8:19
Stephen C. Steel11-Jun-02 8:19 
QuestionHow do i found out if multiple items is selected in my ListView control? Pin
redeemer10-Jun-02 11:29
redeemer10-Jun-02 11:29 
AnswerRe: How do i found out if multiple items is selected in my ListView control? Pin
Gary Kirkham10-Jun-02 11:40
Gary Kirkham10-Jun-02 11:40 
GeneralRe: How do i found out if multiple items is selected in my ListView control? Pin
redeemer10-Jun-02 11:36
redeemer10-Jun-02 11:36 
GeneralRe: How do i found out if multiple items is selected in my ListView control? Pin
Michael Dunn10-Jun-02 17:57
sitebuilderMichael Dunn10-Jun-02 17:57 
GeneralCalling Applicaiton functions from a DLL Pin
10-Jun-02 11:28
suss10-Jun-02 11:28 
GeneralRe: Calling Applicaiton functions from a DLL Pin
Rama Krishna Vavilala10-Jun-02 11:36
Rama Krishna Vavilala10-Jun-02 11:36 
GeneralRe: Calling Applicaiton functions from a DLL Pin
Mike Nordell10-Jun-02 12:35
Mike Nordell10-Jun-02 12:35 

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.