troubleshooting Question

Draw a line in CImage object

Avatar of dev_yinz
dev_yinzFlag for Singapore asked on
Editors IDEsSystem ProgrammingVisual C++.NET
19 Comments1 Solution3439 ViewsLast Modified:
I have used CImage class to create a 8-bits mask object. Now I am going to draw lines on this mask using a method called "DrawTrack (int xStart, int yStart, int xEnd, int yEnd)". My problem is, After I use LineTo method to draw the line, I cannot see this line is drawn in the mask picture. Anyone know the reason?
BOOL CMapBuilder::DrawTrack(int xStart, int yStart, int xEnd, int yEnd)
{
	BOOL ret = FALSE;
	HDC hDC = NULL;
	hDC = m_TrackMask.GetDC();
	CDC* memoryDC = CDC::FromHandle(hDC);
	
	memoryDC->SetDCPenColor((COLORREF)255);
	memoryDC->MoveTo(xStart, yStart);
	ret  = memoryDC->LineTo(xEnd, yEnd);
	m_TrackMask.ReleaseDC();
	//COLORREF color = m_TrackMask.GetPixel(0, 0); // For testing
	return ret;
}

Open in new window

ASKER CERTIFIED SOLUTION
pgnatyuk

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 19 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros