M
mh1000
Guest
I have 2 programs both having a PICTURE CONTROL. I can LButton click one of them OK, but the other one seems to return a very small "rect" values and as a consequence fails the PtInRect test, even if it shouldn't.
Using the dialog wizard, my PIC CONTROL shows as a very small box, and it does not allow me to stretch the PIC CTRL border drag...
The PIC CTRL remains the size of an icon. Why is that? Maybe that is the reason the code below fails...
Thank you.
void MyDialog::OnLButtonDown(UINT nFlags, CPoint point)
{
CRect rect;
m_staticBitmap.GetWindowRect(&rect);
ScreenToClient(&rect);
if ( rect.PtInRect(point) )
{
// Do something ....
BOOL MyDialog:reTranslateMessage(MSG* pMsg)
{
// This is needed to capture the user-click inside the PICTURE CONTROL
// Picture control (IDC_STATIC_BITMAP) properties must be set as Notify=True using Wizard.
if ( pMsg->message == WM_LBUTTONDOWN && GetDlgItem(IDC_STATIC_BITMAP)->GetSafeHwnd() == pMsg->hwnd )
{
CPoint point(pMsg->pt);
ScreenToClient(&point);
OnLButtonDown(pMsg->wParam, point); //passes the coordinates of the clicked Point in the dialog box
}
return CDialog:reTranslateMessage(pMsg);
}
Continue reading...
Using the dialog wizard, my PIC CONTROL shows as a very small box, and it does not allow me to stretch the PIC CTRL border drag...
The PIC CTRL remains the size of an icon. Why is that? Maybe that is the reason the code below fails...
Thank you.
void MyDialog::OnLButtonDown(UINT nFlags, CPoint point)
{
CRect rect;
m_staticBitmap.GetWindowRect(&rect);
ScreenToClient(&rect);
if ( rect.PtInRect(point) )
{
// Do something ....
BOOL MyDialog:reTranslateMessage(MSG* pMsg)
{
// This is needed to capture the user-click inside the PICTURE CONTROL
// Picture control (IDC_STATIC_BITMAP) properties must be set as Notify=True using Wizard.
if ( pMsg->message == WM_LBUTTONDOWN && GetDlgItem(IDC_STATIC_BITMAP)->GetSafeHwnd() == pMsg->hwnd )
{
CPoint point(pMsg->pt);
ScreenToClient(&point);
OnLButtonDown(pMsg->wParam, point); //passes the coordinates of the clicked Point in the dialog box
}
return CDialog:reTranslateMessage(pMsg);
}
Continue reading...