Click here to Skip to main content
15,897,718 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Comparing bitmap problem Pin
led mike6-Oct-08 7:26
led mike6-Oct-08 7:26 
AnswerRe: Comparing bitmap problem Pin
kaushal kishore sharma6-Oct-08 8:02
kaushal kishore sharma6-Oct-08 8:02 
AnswerRe: Comparing bitmap problem Pin
Hamid_RT6-Oct-08 7:57
Hamid_RT6-Oct-08 7:57 
QuestionRe: Comparing bitmap problem Pin
Mark Salsbery6-Oct-08 8:13
Mark Salsbery6-Oct-08 8:13 
AnswerRe: Comparing bitmap problem Pin
kaushal kishore sharma6-Oct-08 8:30
kaushal kishore sharma6-Oct-08 8:30 
QuestionRe: Comparing bitmap problem Pin
Mark Salsbery6-Oct-08 8:43
Mark Salsbery6-Oct-08 8:43 
QuestionEvent handling in C Pin
massaslayer6-Oct-08 7:06
massaslayer6-Oct-08 7:06 
QuestionConstruct a matrix of rectangles Pin
Laan826-Oct-08 5:30
Laan826-Oct-08 5:30 
Hi all,

I have a new problem...I'm trying to do a matrix of rectangles in my drawcli like application, I have created my own rectangle class CRectangle and I'm trying to draw on screen a matrix of 640x480 rectangles. My problem is the slowness of the application. I have implement a for loop to draw on screen the rectangles, and I have store the matrix of rectangles in a CTypedPtrList. Could you give me any ideas to make the application going faster?
The code is pasted below:
In this part I implement the matrix of rectangles and I store it in the CTypedPtrList
void CGOEView::OnElementiCaricamatrice()
{
	// TODO: aggiungere qui il codice per la gestione dei comandi.
	if(rMatr==0)
	{
		CGOEDoc* pDoc = GetDocument();
		int x=50;
		int y=-60;
		rMatr++;
		m_pTempElement=0;
		CClientDC aDC(this);
		OnPrepareDC(&aDC);
		for(int j=0;j<480;j++)
		{
			for(int i=0;i<640;i++)
			{
				CPoint* m_FirstPoint=new CPoint(x,y);
				CPoint* m_SecondPoint=new CPoint((x+2),(y-2));
				m_pTempElement=new CRectangle(*m_FirstPoint,*m_SecondPoint,pDoc->GetElementColor(),m_DimPen);
				//m_pTempElement->Draw(&aDC);
				pDoc->AddElement(m_pTempElement);
				m_pTempElement=0;
				delete m_pTempElement;
				x=x+3;
				
			}
			y=y-3;
			x=50;

		}
	}
}


Then in the part of the code pasted below I draw the rectangle element on screen:
void CGOEView::OnDraw(CDC* pDC)
{
	CGOEDoc* pDoc = GetDocument();
	
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;
	CElement* mElement=0;
	if(rMatr!=0)
	{
		
	POSITION bPos = pDoc->GetHeadElectrode();
		while(bPos)
		{
			mElement = pDoc->GetNextElectrode(bPos);
		TRACE( "The value of x is %d\n", rMatr );
			if(pDC->RectVisible(mElement->GetBoundRect())) 
			{
				sel=FALSE;
				mElement->Draw(pDC,m_pSelected,sel);
				//ResetScrollSize();
			
			}
		}
	}
}

Thank for the help
AnswerRe: Construct a matrix of rectangles Pin
led mike6-Oct-08 7:25
led mike6-Oct-08 7:25 
GeneralRe: Construct a matrix of rectangles Pin
Laan826-Oct-08 8:53
Laan826-Oct-08 8:53 
GeneralRe: Construct a matrix of rectangles Pin
led mike6-Oct-08 9:48
led mike6-Oct-08 9:48 
GeneralRe: Construct a matrix of rectangles Pin
Laan826-Oct-08 21:29
Laan826-Oct-08 21:29 
QuestionI'cant run my Visual Studio created Apps in an other PC whitout VS installed. Pin
Apstolo6-Oct-08 4:49
Apstolo6-Oct-08 4:49 
QuestionRe: I'cant run my Visual Studio created Apps in an other PC whitout VS installed. Pin
David Crow6-Oct-08 4:51
David Crow6-Oct-08 4:51 
AnswerRe: I'cant run my Visual Studio created Apps in an other PC whitout VS installed. Pin
Apstolo6-Oct-08 5:05
Apstolo6-Oct-08 5:05 
AnswerRe: I'cant run my Visual Studio created Apps in an other PC whitout VS installed. Pin
Chandrasekharan P6-Oct-08 20:37
Chandrasekharan P6-Oct-08 20:37 
QuestionRe: I'cant run my Visual Studio created Apps in an other PC whitout VS installed. Pin
David Crow7-Oct-08 3:10
David Crow7-Oct-08 3:10 
AnswerRe: I'cant run my Visual Studio created Apps in an other PC whitout VS installed. Pin
Apstolo8-Oct-08 1:41
Apstolo8-Oct-08 1:41 
AnswerRe: I'cant run my Visual Studio created Apps in an other PC whitout VS installed. Pin
Cedric Moonen6-Oct-08 4:58
Cedric Moonen6-Oct-08 4:58 
QuestionMinimal Compilation, please help ! [modified] Pin
Ahmed Charfeddine6-Oct-08 4:14
Ahmed Charfeddine6-Oct-08 4:14 
QuestionRe: Minimal Compilation, please help ! Pin
David Crow6-Oct-08 4:29
David Crow6-Oct-08 4:29 
AnswerRe: Minimal Compilation, please help ! Pin
Ahmed Charfeddine6-Oct-08 4:47
Ahmed Charfeddine6-Oct-08 4:47 
GeneralRe: Minimal Compilation, please help ! Pin
David Crow6-Oct-08 4:50
David Crow6-Oct-08 4:50 
GeneralRe: Minimal Compilation, please help ! Pin
Ahmed Charfeddine6-Oct-08 5:17
Ahmed Charfeddine6-Oct-08 5:17 
GeneralRe: Minimal Compilation, please help ! Pin
Mark Salsbery6-Oct-08 5:43
Mark Salsbery6-Oct-08 5:43 

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.