Click here to Skip to main content
15,917,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcall menu item from program Pin
vancouver7778-Oct-03 18:12
vancouver7778-Oct-03 18:12 
GeneralRe: call menu item from program Pin
Terry O'Nolley8-Oct-03 19:03
Terry O'Nolley8-Oct-03 19:03 
GeneralRe: call menu item from program Pin
KaЯl9-Oct-03 3:12
KaЯl9-Oct-03 3:12 
GeneralRe: call menu item from program Pin
sdfdsfa9-Oct-03 6:05
sdfdsfa9-Oct-03 6:05 
GeneralRe: call menu item from program Pin
KaЯl9-Oct-03 6:27
KaЯl9-Oct-03 6:27 
GeneralMsFlexGrid editable Pin
act_x8-Oct-03 17:02
act_x8-Oct-03 17:02 
GeneralRe: MsFlexGrid editable Pin
Toni788-Oct-03 17:50
Toni788-Oct-03 17:50 
GeneralRe: MsFlexGrid editable Pin
tidhar8-Oct-03 23:06
tidhar8-Oct-03 23:06 
Here's what I've done in my project:

long lCellTopTwips = m_Grid.GetCellTop();
long lCellLeftTwips = m_Grid.GetCellLeft();
long lCellWidthTwips = m_Grid.GetCellWidth();
long lCellHeightTwips = m_Grid.GetCellHeight();

long lCellTopPixels;
long lCellLeftPixels;
long lCellWidthPixels;
long lCellHeightPixels;

TwipsToPixels(lCellTopTwips,
lCellLeftTwips,
lCellTopPixels,
lCellLeftPixels);

TwipsToPixels(lCellWidthTwips,
lCellHeightTwips,
lCellWidthPixels,
lCellHeightPixels);


m_Grid.GetWindowRect(&rect);
ScreenToClient(rect);
pEdit->MoveWindow(rect.left + lCellLeftPixels,
rect.top + lCellTopPixels,
lCellWidthPixels,
lCellHeightPixels);

#define TWIPS_PER_INCH (1440.0f) //A twip is 1/1440 of an inch (from MSDN)

//////////////////////////////////////////////////////////////functionstart//
void GUI_MntTreeDlg::TwipsToPixels(long lTwipsX,
long lTwipsY,
long &lPixelsX,
long &lPixelsY)
//
// DESCRIPTION: Convert from Twips (screen independent units) to pixels
// A twip is 1/1440 of an inch (from MSDN)
//
// WARNINGS:
//
// ERRORS:
//
//////////////////////////////////////////////////////////////functionend//
{
CDC* pDC = this->GetDC();

long lPixelsPerInchX = pDC->GetDeviceCaps(LOGPIXELSX);
long lPixelsPerInchY= pDC->GetDeviceCaps(LOGPIXELSY);

this->ReleaseDC(pDC);

lPixelsX = (float)lTwipsX / TWIPS_PER_INCH * (float)lPixelsPerInchX;
lPixelsY = (float)lTwipsY / TWIPS_PER_INCH * (float)lPixelsPerInchY;
}

//////////////////////////////////////////////////////////////functionstart//
void GUI_MntTreeDlg::PixelsToTwips(long lPixelsX,
long lPixelsY,
long &lTwipsX,
long &lTwipsY)
//
// DESCRIPTION: Convert from pixels to Twips (screen independent units)
// A twip is 1/1440 of an inch (from MSDN)
//
// WARNINGS:
//
// ERRORS:
//
//////////////////////////////////////////////////////////////functionend//
{
CDC* pDC = this->GetDC();

long lPixelsPerInchX = pDC->GetDeviceCaps(LOGPIXELSX);
long lPixelsPerInchY= pDC->GetDeviceCaps(LOGPIXELSY);

this->ReleaseDC(pDC);

lTwipsX = (float)lPixelsX * TWIPS_PER_INCH / (float)lPixelsPerInchX;
lTwipsY = (float)lPixelsY * TWIPS_PER_INCH / (float)lPixelsPerInchY;

}

GeneralRe: MsFlexGrid editable Pin
act_x9-Oct-03 4:37
act_x9-Oct-03 4:37 
GeneralRe: MsFlexGrid editable Pin
tidhar9-Oct-03 4:44
tidhar9-Oct-03 4:44 
GeneralNeed help in simple game Pin
Snyp8-Oct-03 14:55
Snyp8-Oct-03 14:55 
GeneralRe: Need help in simple game Pin
parths8-Oct-03 16:09
parths8-Oct-03 16:09 
GeneralRe: Need help in simple game Pin
Terry O'Nolley8-Oct-03 19:23
Terry O'Nolley8-Oct-03 19:23 
GeneralRe: Need help in simple game Pin
YaronNir9-Oct-03 0:05
YaronNir9-Oct-03 0:05 
GeneralRe: Need help in simple game Pin
Member 139425924-Dec-04 20:05
Member 139425924-Dec-04 20:05 
Generalbuttons and word doc's Pin
N.Byarley8-Oct-03 14:37
N.Byarley8-Oct-03 14:37 
GeneralRe: buttons and word doc's Pin
Terry O'Nolley8-Oct-03 18:45
Terry O'Nolley8-Oct-03 18:45 
GeneralRe: buttons and word doc's Pin
N.Byarley8-Oct-03 20:33
N.Byarley8-Oct-03 20:33 
GeneralRe: buttons and word doc's Pin
Terry O'Nolley8-Oct-03 23:32
Terry O'Nolley8-Oct-03 23:32 
QuestionHow can I make the property sheet buttons in the XP style? Pin
bin89228-Oct-03 13:19
bin89228-Oct-03 13:19 
Generalwarning C4273 - inconsistent dll linkage. dllexport assumed. Pin
YaronNir8-Oct-03 12:54
YaronNir8-Oct-03 12:54 
QuestionHow to change the color of the dialog box Pin
Deepak Samuel8-Oct-03 12:15
Deepak Samuel8-Oct-03 12:15 
AnswerRe: How to change the color of the dialog box Pin
YaronNir8-Oct-03 13:16
YaronNir8-Oct-03 13:16 
QuestionEM_STREAMOUT and EditStreamCallback() function? Pin
Kayembi8-Oct-03 12:07
Kayembi8-Oct-03 12:07 
QuestionHow to make a dialog box pop up on receiving an event Pin
Deepak Samuel8-Oct-03 11:18
Deepak Samuel8-Oct-03 11:18 

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.