Click here to Skip to main content
15,921,548 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Neil Urquhart15-Sep-09 6:09
Neil Urquhart15-Sep-09 6:09 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Code-o-mat15-Sep-09 6:13
Code-o-mat15-Sep-09 6:13 
AnswerRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog [modified] Pin
Moak15-Sep-09 14:09
Moak15-Sep-09 14:09 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Neil Urquhart15-Sep-09 20:04
Neil Urquhart15-Sep-09 20:04 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Neil Urquhart15-Sep-09 20:57
Neil Urquhart15-Sep-09 20:57 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Moak15-Sep-09 23:21
Moak15-Sep-09 23:21 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Neil Urquhart16-Sep-09 2:53
Neil Urquhart16-Sep-09 2:53 
I am afraid this doose not seem to work in that the buttons are displayed but when I click on the overlapped buttons nothing happens. I think the picture control is taking the input and not passing it onto the buttons.

My version that makes the picture control and buttons children of the dialog does work. Requires the WS_CLIPCHILDREN & WS_CLIPSIBLINGS properties also.

This is the code that does not work :
BOOL CDesignEditDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	
	// TODO: Add extra initialization here
	CWnd* pImage ;
	WINDOWPLACEMENT wpImage ;
	CRect rect;
	CPoint imgPos ;

	// Set CDesignEditDlg WS_CLIPCHILDREN
	//ModifyStyle(0, WS_CLIPCHILDREN) ;

	// Get the current top left position of the picture control window
	pImage = GetDlgItem(IDC_PAGEIMAGE) ;
	pImage->GetWindowPlacement(&wpImage);
	imgPos.x = wpImage.rcNormalPosition.left ;
	imgPos.y = wpImage.rcNormalPosition.top ;

	// Set picture control WS_CLIPSIBLINGS
	//pImage->ModifyStyle(0, WS_CLIPSIBLINGS);

	// Make picture control child to CDesignEditDlg
	pImage->SetParent(this) ;

	CWnd* pButton ;
	int b ;
	for(b = 0 ; cButPos[b].id > 0 ; b++) {
		// Move the button
		pButton = GetDlgItem(cButPos[b].id);
		pButton->GetWindowRect(rect);
		pButton->MoveWindow(imgPos.x + cButPos[b].x - (rect.Width()/2), imgPos.y + cButPos[b].y, rect.Width(), rect.Height(), TRUE);

		// Make each CButton a child to CDesignEditDlg
		//pButton->SetParent(this) ;
		pButton->SetParent(pImage) ;
	}


This version of the code does work though!!
BOOL CDesignEditDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	
	// TODO: Add extra initialization here
	CWnd* pImage ;
	WINDOWPLACEMENT wpImage ;
	CRect rect;
	CPoint imgPos ;

	// Set CDesignEditDlg WS_CLIPCHILDREN
	ModifyStyle(0, WS_CLIPCHILDREN) ;

	// Get the current top left position of the picture control window
	pImage = GetDlgItem(IDC_PAGEIMAGE) ;
	pImage->GetWindowPlacement(&wpImage);
	imgPos.x = wpImage.rcNormalPosition.left ;
	imgPos.y = wpImage.rcNormalPosition.top ;

	// Set picture control WS_CLIPSIBLINGS
	pImage->ModifyStyle(0, WS_CLIPSIBLINGS);

	// Make picture control child to CDesignEditDlg
	pImage->SetParent(this) ;

	CWnd* pButton ;
	int b ;
	for(b = 0 ; cButPos[b].id > 0 ; b++) {
		// Move the button
		pButton = GetDlgItem(cButPos[b].id);
		pButton->GetWindowRect(rect);
		pButton->MoveWindow(imgPos.x + cButPos[b].x - (rect.Width()/2), imgPos.y + cButPos[b].y, rect.Width(), rect.Height(), TRUE);

		// Make each CButton a child to CDesignEditDlg
		pButton->SetParent(this) ;
		//pButton->SetParent(pImage) ;
	}

GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Moak16-Sep-09 3:19
Moak16-Sep-09 3:19 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Neil Urquhart16-Sep-09 3:56
Neil Urquhart16-Sep-09 3:56 
QuestionRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Moak16-Sep-09 4:21
Moak16-Sep-09 4:21 
AnswerRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Neil Urquhart16-Sep-09 4:41
Neil Urquhart16-Sep-09 4:41 
GeneralRe: How can I force the redraw of buttons which overlay a picture bitmap in a Dialog Pin
Moak16-Sep-09 5:12
Moak16-Sep-09 5:12 
QuestionI want to know which os am using from C code.Is it is possible? Pin
mohant$.net15-Sep-09 2:20
mohant$.net15-Sep-09 2:20 
QuestionRe: I want to know which os am using from C code.Is it is possible? Pin
David Crow15-Sep-09 2:36
David Crow15-Sep-09 2:36 
JokeRe: I want to know which os am using from C code.Is it is possible? Pin
CPallini15-Sep-09 2:46
mveCPallini15-Sep-09 2:46 
GeneralRe: I want to know which os am using from C code.Is it is possible? Pin
mohant$.net15-Sep-09 3:17
mohant$.net15-Sep-09 3:17 
GeneralRe: I want to know which os am using from C code.Is it is possible? Pin
CPallini15-Sep-09 3:30
mveCPallini15-Sep-09 3:30 
GeneralRe: I want to know which os am using from C code.Is it is possible? Pin
Stuart Dootson15-Sep-09 7:07
professionalStuart Dootson15-Sep-09 7:07 
AnswerRe: I want to know which os am using from C code.Is it is possible? Pin
Moak15-Sep-09 23:26
Moak15-Sep-09 23:26 
QuestionGet pixel data from PBITMAPINFO struct? Pin
Sauce!15-Sep-09 2:15
Sauce!15-Sep-09 2:15 
AnswerRe: Get pixel data from PBITMAPINFO struct? [modified] Pin
CPallini15-Sep-09 2:31
mveCPallini15-Sep-09 2:31 
GeneralRe: Get pixel data from PBITMAPINFO struct? Pin
Sauce!15-Sep-09 2:58
Sauce!15-Sep-09 2:58 
QuestionMS Word document creating Pin
Igor IP15-Sep-09 1:41
professionalIgor IP15-Sep-09 1:41 
AnswerRe: MS Word document creating Pin
Stuart Dootson15-Sep-09 1:56
professionalStuart Dootson15-Sep-09 1:56 
GeneralRe: MS Word document creating Pin
Igor IP15-Sep-09 2:02
professionalIgor IP15-Sep-09 2:02 

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.