Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Windows
 Charting and Real-Time Graphics Tools for Windows
 SetWindowPlacement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

celsolrc

15 Posts

Posted - 05 Dec 2006 :  06:24:16  Show Profile  Reply with Quote
Hi,

What I need change to adjust fonts correctly when call SetWindowPlacement?

In my program I need restart a Window with last state and positions. I call SetWindowPlacement to make this but show all fonts with incorrect size. If I resize window, the fonts resizing too but incorrectly too (normally with big size).

[]s,
Celso L.R. Cruz

quinncurtis

1164 Posts

Posted - 05 Dec 2006 :  09:05:39  Show Profile  Reply with Quote
You need to explain more.

Is this what you are doing ?

Drawing the chart at some initial windows size, with say font size of 12.

Resizing the window to a different size, causing the fonts to change in size, apparent size 8 ?

Saving the size of the final window.

When you restart the Window with the last state and size, how are you drawing the chart? Are you then just calling the same graph build routine as in the intial window, setting the font size to 12, even though the window is now much smaller than when you initially used a font size of 12 ?

Please explain in much more detail.
Go to Top of Page

celsolrc

15 Posts

Posted - 05 Dec 2006 :  09:39:29  Show Profile  Reply with Quote
Hi,

When I call the window (by menu in my program), the fonts and graphics are showed without troubles (corectly).

When I create window and call SetWindowPlacement to resize to my Layout, the fonts and graphics showed with initial values. Whats I can change to change fonts and graphics too when I call SetWindowPlacement ?

My buildPage:

// class CGraphDisplayGiro : public QCRTGraphWnd

void CGraphDisplayGiro::BuildGraph()
{

	WGSetPlotArea (0.05, 0.05, 0.95, 0.95, C_BLACK);

	// Desenhar o retangulo normalizado
	WGRectangleNorm( 0.02, 0.2, 0.83, 0.98, C_WHITE, 1 );

	// Título
	WGSetTextByName (C_LIGHTGREEN, "Arial", 50, TEXT_NORMAL );
    WGTextNorm( _T( "Aproamento" ), 0.25, 0.02, TA_CENTER, TEXT_NORMAL );

	// Modo (manual ou automático)
	WGSetTextByName (C_LIGHTRED, "Arial", 50, TEXT_NORMAL );
	hTxtModo_ = WGTextNorm( _T( "" ), 0.75, 0.02, TA_CENTER, TEXT_NORMAL );

	// Valor do Giro
	WGSetTextByName (C_LIGHTRED, "Arial", 200, TEXT_NORMAL );
	hTxtValor_ = WGTextNorm( _T( "" ), 0.42, 0.30, TA_CENTER, TEXT_NORMAL );

	// Botão do incremento
	WGSetTextByName (C_BLACK, "Arial", 50, TEXT_NORMAL );
	hBtnPlus_ = WRSetButtonControl( BC_STYLE_PUSH, BC_LOOK_LOW, 
									0.85, 0.20, 0.98, 0.45,
									WGGetRGBColor (C_LIGHTGRAY),"+",false);
	// Botão do decremento
	hBtnMinus_ = WRSetButtonControl( BC_STYLE_PUSH, BC_LOOK_LOW, 
									0.85, 0.55, 0.98, 0.80,
									WGGetRGBColor (C_LIGHTGRAY),"-",false);
}


My LoadLayout:


void CLayout::loadLayout()
{

	CPetronav* pApp = (CPetronav*) AfxGetApp();
	CDocument*      pDoc;
	CView*			pView;
	CString			sViewName;

	m_iNumMoveisExcl = 0;
	m_iNumMoveisChangeNav = 0;
	m_iNumSensorExcl = 0;
	
	if(restoreFromDisk( ))
	{
	
		m_bLoading = true;
		POSITION posDocTemplate = pApp->GetFirstDocTemplatePosition();
		UINT iContador = 0;
		while (posDocTemplate != NULL)
		{	
			pView = NULL;
			pDoc = NULL;
			CDocTemplate* pDocTemplate = pApp->GetNextDocTemplate(posDocTemplate);
    		POSITION posDocument = pDocTemplate->GetFirstDocPosition();	
			pDocTemplate->GetDocString(sViewName, CDocTemplate::docName);
			
			if(m_ColBoolAberto[iContador])// Ver se o doc corresponde a uma view que estava aberta quando do salvamento				
			{
				if(iContador == TELA_GRAFICA)//Tela Gráfica
				   loadLayoutTelaGrafica(posDocument,pDocTemplate);
				else 
					pDoc = loadDataFromCol(iContador,posDocument,pDocTemplate);								
			}
			else				
				pDocTemplate->CloseAllDocuments(FALSE);
				
			if (iContador ==TELA_APROAMENTO || iContador ==TELA_GRAF_DIST|| iContador ==TELA_MRU_VAL_INST)
			{
				iContador++;
				continue;
			}
			if(pDoc!= NULL)
			{			
				
				POSITION posView = pDoc->GetFirstViewPosition();
				pView = pDoc->GetNextView( posView );
					
			}			

			if( pView!=NULL )
			{
				pView->GetParentFrame()->SetWindowPlacement(&m_ColWndPlace[iContador]);	

				if( m_iTopWindow == iContador )

					m_pView = pView;
			}
	
		iContador++;
		}
		m_bLoading = false;
		if(m_pView!=NULL)
			m_pView->GetParentFrame()->BringWindowToTop();	
   }
}
	




[]s,
Celso L.R. Cruz
Go to Top of Page

quinncurtis

1164 Posts

Posted - 05 Dec 2006 :  09:59:26  Show Profile  Reply with Quote
If you size the fonts assuming one windows size, but then recreate your window at a smaller size, the size of the fonts obviously aren't going to match. You will have to size the fonts to match the window.

Why don't you just make the font size a variable, that depends on the size of the window ?

Assuming a window width of approximately 500.

int fontsize = windowwidth / 10;

WGSetTextByName (C_LIGHTGREEN, "Arial", fontsize , TEXT_NORMAL );

Or you can recreate your graph as a two stage process. First, always build your graph at the original size; but then resize the graph to your final size after it is built. That way our internal font rescaling will resize the fonts automatically.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07