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

C / C++ / MFC

 
GeneralRe: Removing non-empty directory Pin
George_George29-Jul-07 20:40
George_George29-Jul-07 20:40 
AnswerRe: Removing non-empty directory Pin
Roberto Italy29-Jul-07 20:18
Roberto Italy29-Jul-07 20:18 
GeneralRe: Removing non-empty directory Pin
George_George29-Jul-07 20:31
George_George29-Jul-07 20:31 
AnswerRe: Removing non-empty directory Pin
nitin329-Jul-07 20:27
nitin329-Jul-07 20:27 
GeneralRe: Removing non-empty directory Pin
George_George29-Jul-07 20:33
George_George29-Jul-07 20:33 
GeneralRe: Removing non-empty directory Pin
Iain Clarke, Warrior Programmer30-Jul-07 1:06
Iain Clarke, Warrior Programmer30-Jul-07 1:06 
QuestionGDI problem Pin
trioum29-Jul-07 19:00
trioum29-Jul-07 19:00 
AnswerRe: GDI problem Pin
Nelek29-Jul-07 21:56
protectorNelek29-Jul-07 21:56 
Then you have to save your relative position of your elements and then update them with the position of your CScrollview in every OnDraw. I made it like this:

void CMyView::OnInitialUpdate()
{	CScrollView::OnInitialUpdate();
	
	// DINA4 -> 210, 297 mm (Standard-printable-area 190, 280 mm), Ratio -> 5 Pixels = 1 mm
	CSize sizeTotal;
	sizeTotal.cx = 950;	sizeTotal.cy = 1400;
	SetScrollSizes(MM_TEXT, sizeTotal);

	// Connecting to the FPSDoc to get datas from it or to send datas to it
	CMyDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// To have a relationship with the document in the whole programm
	extern CMyDoc* m_pDoc;
	m_pDoc = GetDocument ();
	// Update Description everytime a file is opened
	pDoc->UpdateDescription ();
	// Load standard cursor
	m_hCursor=AfxGetApp()->LoadStandardCursor(IDC_ARROW);

	return;
}


void CMyView::OnDraw(CDC* pDC)
{	PlaceElement ();
	//Other functions
	return;
}

void CMyView::PlaceElement ()
{	CMyDoc* pDoc = GetDocument ();
	ASSERT_VALID (pDoc);

// Declaration of what is needed
	CClientDC dc(this);			// The window to be drawn is this
	CDC dcNormMem;				// Selected drawing object
	dcNormMem.CreateCompatibleDC (&dc);	// Make it compatible and assign it to window
	CDC dcSelMem;				// Selected drawing object
	dcSelMem.CreateCompatibleDC (&dc);	// Make it compatible and assign it to window

	CString szTempText = "";		// Text for the name of the element
	CPoint cpTempPos, cpTempTextPos, cpScrollPoint = GetScrollPosition ();
	CBitmap bmNormIn, bmNormOut, bmNormReg, bmSel;
	BITMAP bmNormTemp, bmSelTemp;

// Placing ALL NON-SELECTED Elements.
	// Inputs
	for (int nIn = 0; nIn < pDoc->m_cMyListSet.GetCount (); nIn++)
	{	if (!pDoc->m_cMyListSet[nIn].m_bInSel)			// Only when NON-SELECTED
		{	if (bmNormIn.m_hObject != NULL)
				bmNormIn.DeleteObject ();		// Ensure not to have duplicities

			// Load and select the bitmap to be placed
			bmNormIn.LoadBitmap (IDB_NORMIN);
			bmNormIn.GetObject(sizeof(bmNormTemp), &bmNormTemp);	
			dcNormMem.SelectObject(&bmNormIn);

			// Correct Coordinates -> position on the screen
			cpTempPos.x = pDoc->m_cMyListSet[nIn].m_cpInCoord.x - cpScrollPoint.x;
			cpTempPos.y = pDoc->m_cMyListSet[nIn].m_cpInCoord.y - cpScrollPoint.y;
			
			// Place the bitmap on the correct position
			dc.BitBlt(cpTempPos.x, cpTempPos.y, bmNormTemp.bmWidth, 
						bmNormTemp.bmHeight, &dcNormMem, 0, 0, SRCCOPY);
	
			// Configuring and placing Label of the name
			szTempText = pDoc->m_cmlInputSet[nIn].m_szInName;
			dc.SetTextColor(RGB(0,0,0));
			dc.TextOut (cpTempPos.x, cpTempPos.y + SIGHEIGHT + 1, szTempText);
		}
	}
// More code for more Elements
}


With these I put one Bitmap and a label with its name below for every element I have , and when I scroll the View surface its position scrolls as well.

Hope it helps

Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

GeneralRe: GDI problem Pin
trioum30-Jul-07 23:01
trioum30-Jul-07 23:01 
GeneralRe: GDI problem Pin
Nelek2-Aug-07 20:09
protectorNelek2-Aug-07 20:09 
QuestionClip Region of CDC Pin
himuskanhere29-Jul-07 18:56
himuskanhere29-Jul-07 18:56 
AnswerRe: Clip Region of CDC Pin
csc29-Jul-07 20:14
csc29-Jul-07 20:14 
JokeRe: Clip Region of CDC Pin
himuskanhere29-Jul-07 20:55
himuskanhere29-Jul-07 20:55 
Questionrow = mysql_fetch_row(res); Pin
p_29-Jul-07 18:42
p_29-Jul-07 18:42 
AnswerRe: row = mysql_fetch_row(res); Pin
Shouvik Das29-Jul-07 23:48
Shouvik Das29-Jul-07 23:48 
QuestionHow to solve "Out of memory" Pin
Pogo Lin29-Jul-07 16:32
Pogo Lin29-Jul-07 16:32 
AnswerRe: How to solve "Out of memory" Pin
Paul Conrad29-Jul-07 17:16
professionalPaul Conrad29-Jul-07 17:16 
GeneralRe: How to solve "Out of memory" Pin
Pogo Lin31-Jul-07 20:28
Pogo Lin31-Jul-07 20:28 
AnswerRe: How to solve "Out of memory" Pin
Stephen Hewitt29-Jul-07 19:12
Stephen Hewitt29-Jul-07 19:12 
QuestionHow to wirte a text editor from scratch? Pin
lichongbin29-Jul-07 14:03
lichongbin29-Jul-07 14:03 
AnswerRe: How to wirte a text editor from scratch? Pin
Nelek29-Jul-07 22:01
protectorNelek29-Jul-07 22:01 
QuestionMotion sensing Pin
mlibkind29-Jul-07 11:24
mlibkind29-Jul-07 11:24 
AnswerRe: Motion sensing Pin
eraccn29-Jul-07 15:00
eraccn29-Jul-07 15:00 
QuestionWriting My Own: Windows Desktop Shell Pin
convivial.developer29-Jul-07 10:40
convivial.developer29-Jul-07 10:40 
AnswerRe: Writing My Own: Windows Desktop Shell Pin
Stephen Hewitt29-Jul-07 15:03
Stephen Hewitt29-Jul-07 15:03 

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.