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

C / C++ / MFC

 
GeneralCatching the ScrollBar on Clistcontrol Pin
purshi19-Oct-04 10:58
purshi19-Oct-04 10:58 
QuestionHow to change the screen layout after resolution change? Pin
tserg19-Oct-04 10:34
tserg19-Oct-04 10:34 
GeneralVisual Strdio.NET 2003 debugger Newbie Pin
...---...19-Oct-04 10:22
...---...19-Oct-04 10:22 
GeneralRe: Visual Strdio.NET 2003 debugger Newbie Pin
Wes Aday19-Oct-04 10:38
professionalWes Aday19-Oct-04 10:38 
GeneralWMI Tutorial ? (wifi signal strength & c++) Pin
zoid ! 19-Oct-04 10:01
zoid ! 19-Oct-04 10:01 
GeneralRe: WMI Tutorial ? (wifi signal strength & c++) Pin
User 21559719-Oct-04 20:05
User 21559719-Oct-04 20:05 
GeneralPicture Control Pin
Leyu19-Oct-04 9:49
Leyu19-Oct-04 9:49 
GeneralRe: Picture Control Pin
Vikram Kashyap19-Oct-04 19:14
Vikram Kashyap19-Oct-04 19:14 
Hi,;)

Yes, Certainly you can change the bitmap at run time during the MOUSEMOVE or on LBUTTONDOWN. Let's take the example of MOUSEMOVE

void CMouseDlg::OnMouseMove(UINT nFlags, CPoint point)
{
m_Image.GetWindowRect(&rect);
ClientToScreen(&point);
if(rect.PtInRect(point))
{
m_Image.SetBitmap(m_Bitmap1);
}
else
{
m_Image.SetBitmap(m_Bitmap2);
}
CDialog::OnMouseMove(nFlags, point);
}

Here m_Image is the control type variable of Image control created using Class Wizard and rect is CRect object.

// m_Image.GetWindowRect(&rect);
Extract the image control co-ordinates in a rect object.

// ClientToScreen(&point);
ClientToScreen is used to convert the client coordinates of a given point or rectangle on the display to screen coordinates.

Next step is to check whether these points fall under the area where our image is place on the screen using PtInRect. If yes, then change the bitmap to whatever.

m_Bitmap1 and m_Bitmap2 are twom CBitmap type objects defined in the header file.

That's it...you r on ur way to change the bitmaps at runtime

Vikram Kashyap
"You will never fail until you stop trying"
GeneralProper function declaration to avoid a memory leak Pin
georgiek5019-Oct-04 8:47
georgiek5019-Oct-04 8:47 
GeneralRe: Proper function declaration to avoid a memory leak Pin
David Crow19-Oct-04 8:56
David Crow19-Oct-04 8:56 
GeneralRe: Proper function declaration to avoid a memory leak Pin
Joaquín M López Muñoz19-Oct-04 9:06
Joaquín M López Muñoz19-Oct-04 9:06 
GeneralRe: Proper function declaration to avoid a memory leak Pin
georgiek5019-Oct-04 9:12
georgiek5019-Oct-04 9:12 
GeneralRe: Proper function declaration to avoid a memory leak Pin
georgiek5019-Oct-04 9:16
georgiek5019-Oct-04 9:16 
GeneralResize a Static Box to accomodate font change Pin
Ali Niaz19-Oct-04 8:40
Ali Niaz19-Oct-04 8:40 
GeneralRe: Resize a Static Box to accomodate font change Pin
BlackDice19-Oct-04 9:58
BlackDice19-Oct-04 9:58 
GeneralRe: Resize a Static Box to accomodate font change Pin
Ali Niaz19-Oct-04 11:28
Ali Niaz19-Oct-04 11:28 
GeneralRe: Resize a Static Box to accomodate font change Pin
BlackDice20-Oct-04 5:59
BlackDice20-Oct-04 5:59 
GeneralRe: Resize a Static Box to accomodate font change Pin
Ali Niaz20-Oct-04 10:33
Ali Niaz20-Oct-04 10:33 
GeneralRe: Resize a Static Box to accomodate font change Pin
Ali Niaz19-Oct-04 10:11
Ali Niaz19-Oct-04 10:11 
GeneralQuestion regarding Forms App in VC++ .NET Pin
NietzscheDisciple19-Oct-04 8:01
NietzscheDisciple19-Oct-04 8:01 
GeneralVC6 / Debug output: supress "Loaded xyz.dll..." Pin
peterchen19-Oct-04 7:12
peterchen19-Oct-04 7:12 
GeneralRe: VC6 / Debug output: supress "Loaded xyz.dll..." Pin
Ryan Binns19-Oct-04 18:25
Ryan Binns19-Oct-04 18:25 
GeneralVC6 / Debug output: supress "Loaded xyz.dll..." Pin
peterchen19-Oct-04 7:12
peterchen19-Oct-04 7:12 
GeneralData excahnge between dialog and formview Pin
Zombie_Inc19-Oct-04 7:11
Zombie_Inc19-Oct-04 7:11 
GeneralRe: Data excahnge between dialog and formview Pin
Wes Aday19-Oct-04 10:34
professionalWes Aday19-Oct-04 10:34 

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.