Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Should I upgrade to latest version of VC++? Pin
David Fleming9-May-01 10:47
David Fleming9-May-01 10:47 
AnswerRe: Should I upgrade to latest version of VC++? Pin
Erik Funkenbusch10-May-01 12:40
Erik Funkenbusch10-May-01 12:40 
Generalproblem in getting req data from camera Pin
bobbies9-May-01 1:45
bobbies9-May-01 1:45 
GeneralRe: problem in getting req data from camera Pin
Christian Graus9-May-01 12:42
protectorChristian Graus9-May-01 12:42 
GeneralAligning Objects Pin
8-May-01 23:46
suss8-May-01 23:46 
GeneralRe: Aligning Objects Pin
Christian Graus9-May-01 12:40
protectorChristian Graus9-May-01 12:40 
GeneralResizing columns within the MSFlexGrid control... or.... converting from twips to client co-ords Pin
Baz8-May-01 23:04
Baz8-May-01 23:04 
GeneralRe: Resizing columns within the MSFlexGrid control... or.... converting from twips to client co-ords Pin
Matt Philmon9-May-01 4:44
Matt Philmon9-May-01 4:44 
MSFlexGrid sucks. (Yeah, it IS using twips... you do have to convert.) Check out Chris Maunder's control. It ROCKS and does this crap FOR you though you lose the luxury of creating it in the dialog editor.

As for how to do it, here's a primitive but more or less functioning example:

1) Global: int g_iTwipsPerPixelX=0;

2) In view.... OnCreate
CDC* pDC = GetDC();
int iPixelsPerInch = pDC->GetDeviceCaps(LOGPIXELSX);
if (iPixelsPerInch)
g_iTwipsPerPixelX = int(1440 / iPixelsPerInch);

3) Handle OnSize for the dialog in your formview. Call function AdjustColumnWidths();

4) Here's more or less your function:

void CMyDialog::AdjustColumnWidths()
{
if (m_grid.m_hWnd)
{
// get the width of all the columns exept the second one
CRect rect;
m_grid.GetWindowRect(rect);
long lGridWidth = rect.Width();

// alter the widths of each column
m_grid.SetColWidth(0, lGridWidth*.10*g_iTwipsPerPixelX);
m_grid.SetColWidth(1, lGridWidth*.20*g_iTwipsPerPixelX);
m_grid.SetColWidth(2, lGridWidth*.50*g_iTwipsPerPixelX);
m_grid.SetColWidth(3, lGridWidth*.10*g_iTwipsPerPixelX);
m_grid.SetColWidth(4, lGridWidth*.10*g_iTwipsPerPixelX);
}
}


QuestionHas anyone used "hooks" to monitor windows messages?? Pin
8-May-01 22:19
suss8-May-01 22:19 
GeneralProblem with ClassView Information File. Pin
David Fleming8-May-01 22:18
David Fleming8-May-01 22:18 
GeneralRe: Problem with ClassView Information File. Pin
Christian Graus8-May-01 22:26
protectorChristian Graus8-May-01 22:26 
GeneralRe: Problem with ClassView Information File. Pin
8-May-01 22:41
suss8-May-01 22:41 
GeneralRe: Problem with ClassView Information File. Pin
David Fleming8-May-01 23:40
David Fleming8-May-01 23:40 
GeneralRe: Problem with ClassView Information File. Pin
9-May-01 2:47
suss9-May-01 2:47 
GeneralProblem with ClassView information file. Pin
David Fleming8-May-01 22:17
David Fleming8-May-01 22:17 
GeneralRe: Problem with ClassView information file. Pin
9-May-01 2:45
suss9-May-01 2:45 
GeneralProblem with ClassView information file. Pin
David Fleming8-May-01 22:16
David Fleming8-May-01 22:16 
GeneralProblem with ClassView information file. Pin
David Fleming8-May-01 22:16
David Fleming8-May-01 22:16 
Generalproblems with Threads Pin
yamini8-May-01 20:38
yamini8-May-01 20:38 
QuestionHow to using Win32 API DeviceIoControl to control the LED on the keyboard light or dark? Pin
8-May-01 16:40
suss8-May-01 16:40 
AnswerRe: How to using Win32 API DeviceIoControl to control the LED on the keyboard light or dark? Pin
Tomasz Sowinski9-May-01 3:20
Tomasz Sowinski9-May-01 3:20 
GeneralGot troubles when try to write a long text into a memo field of Access database Pin
8-May-01 15:23
suss8-May-01 15:23 
GeneralRe: Got troubles when try to write a long text into a memo field of Access database Pin
markkuk8-May-01 22:09
markkuk8-May-01 22:09 
GeneralTons of thanks! I got it. Pin
9-May-01 7:55
suss9-May-01 7:55 
GeneralMicrosoft Data Grid Control V6.0 Pin
RobJones8-May-01 13:22
RobJones8-May-01 13:22 

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.