Click here to Skip to main content
15,916,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionwrite images in pgm format from picturebox (windows forms c++) Pin
william cplus18-Jul-08 4:56
william cplus18-Jul-08 4:56 
QuestionCo-ordinates of a button Pin
bhanu_850918-Jul-08 3:31
bhanu_850918-Jul-08 3:31 
AnswerRe: Co-ordinates of a button Pin
Alan Balkany18-Jul-08 3:54
Alan Balkany18-Jul-08 3:54 
GeneralRe: Co-ordinates of a button [modified] Pin
bhanu_850918-Jul-08 4:20
bhanu_850918-Jul-08 4:20 
GeneralRe: Co-ordinates of a button Pin
Alan Balkany18-Jul-08 4:32
Alan Balkany18-Jul-08 4:32 
GeneralRe: Co-ordinates of a button Pin
bhanu_850918-Jul-08 5:23
bhanu_850918-Jul-08 5:23 
GeneralRe: Co-ordinates of a button Pin
Alan Balkany18-Jul-08 5:42
Alan Balkany18-Jul-08 5:42 
QuestionRe: Co-ordinates of a button [modified] Pin
bhanu_850921-Jul-08 2:21
bhanu_850921-Jul-08 2:21 
Hello Alan,

I tried like the below. Strangely, when placing mouse over the button changes the bitmap and when I move the mouse over the dialog the button is painted again and again. If I place the mouse over other non-bitmap button and place again over the bitmapbutton didn't change the image. That is the event is triggered for the first time only.

//message map

ON_WM_MOUSEMOVE()
ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave)

//funtions
LONG CdfdgDlg::OnMouseLeave(WPARAM , LPARAM) 
{

	POINT point;
	GetCursorPos(&point);
	ScreenToClient(&point);
	GetDlgItem (IDC_BUTTON4)->GetWindowRect (&rect);  // Window coordinates.
	ScreenToClient (&rect); 
	if (rect.PtInRect(point))
	{
		bool val=m_button4.LoadBitmaps(IDB_BITMAP4,0,IDB_BITMAP4,0);
		m_button4.Invalidate();
		m_button4.UpdateWindow();
	
	}
	
    return 0;
}

void CdfdgDlg::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	TRACKMOUSEEVENT trackmouseevent;
		trackmouseevent.cbSize = sizeof(trackmouseevent);
		trackmouseevent.dwFlags = TME_LEAVE;
		trackmouseevent.hwndTrack = GetSafeHwnd();
		trackmouseevent.dwHoverTime = HOVER_DEFAULT;
		_TrackMouseEvent(&trackmouseevent);
	GetDlgItem (IDC_BUTTON4)->GetWindowRect (&rect);  // Window coordinates.
	ScreenToClient (&rect); 
	if ((!rect.PtInRect(point)) )
	{
		mouse=true;
		bool val=m_button4.LoadBitmaps(IDB_BITMAP2,0,IDB_BITMAP2,0);
		m_button4.Invalidate();
		m_button4.UpdateWindow();
	}
	CDialog::OnMouseMove(nFlags, point);
}


modified on Monday, July 21, 2008 8:50 AM

AnswerRe: Co-ordinates of a button Pin
Alan Balkany21-Jul-08 4:41
Alan Balkany21-Jul-08 4:41 
GeneralRe: Co-ordinates of a button Pin
bhanu_850923-Jul-08 2:55
bhanu_850923-Jul-08 2:55 
GeneralRe: Co-ordinates of a button Pin
Alan Balkany23-Jul-08 8:08
Alan Balkany23-Jul-08 8:08 
AnswerRe: Co-ordinates of a button Pin
David Crow18-Jul-08 10:06
David Crow18-Jul-08 10:06 
AnswerRe: Co-ordinates of a button Pin
Stephen Hewitt20-Jul-08 13:44
Stephen Hewitt20-Jul-08 13:44 
Questionerror C2026: string too big, trailing characters truncated Pin
Rahul Vaishnav18-Jul-08 2:41
Rahul Vaishnav18-Jul-08 2:41 
AnswerRe: error C2026: string too big, trailing characters truncated Pin
CPallini18-Jul-08 3:06
mveCPallini18-Jul-08 3:06 
GeneralRe: error C2026: string too big, trailing characters truncated Pin
Rahul Vaishnav18-Jul-08 4:03
Rahul Vaishnav18-Jul-08 4:03 
AnswerRe: error C2026: string too big, trailing characters truncated Pin
KarstenK18-Jul-08 3:06
mveKarstenK18-Jul-08 3:06 
AnswerRe: error C2026: string too big, trailing characters truncated Pin
David Crow18-Jul-08 10:09
David Crow18-Jul-08 10:09 
Questionproblem in writting urdu on Richedit control Pin
preeti sharma18-Jul-08 1:48
preeti sharma18-Jul-08 1:48 
AnswerRe: problem in writting urdu on Richedit control Pin
_AnsHUMAN_ 18-Jul-08 2:17
_AnsHUMAN_ 18-Jul-08 2:17 
GeneralRe: problem in writting urdu on Richedit control Pin
preeti sharma20-Jul-08 20:21
preeti sharma20-Jul-08 20:21 
QuestionParsing the include-structure of a cpp-project Pin
Tomerland18-Jul-08 1:37
Tomerland18-Jul-08 1:37 
AnswerRe: Parsing the include-structure of a cpp-project Pin
Matthew Faithfull18-Jul-08 2:19
Matthew Faithfull18-Jul-08 2:19 
GeneralRe: Parsing the include-structure of a cpp-project Pin
Tomerland18-Jul-08 2:23
Tomerland18-Jul-08 2:23 
GeneralRe: Parsing the include-structure of a cpp-project Pin
Matthew Faithfull18-Jul-08 2:33
Matthew Faithfull18-Jul-08 2:33 

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.