Click here to Skip to main content
15,893,588 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Calling an application using VC Pin
Sam Hobbs11-Dec-06 0:37
Sam Hobbs11-Dec-06 0:37 
AnswerRe: Calling an application using VC Pin
Hamid_RT15-Dec-06 6:47
Hamid_RT15-Dec-06 6:47 
QuestionVideo For Windows API Pin
Revant Jain8-Dec-06 22:39
Revant Jain8-Dec-06 22:39 
Questioncrashing..plz help Pin
sheetal_068-Dec-06 22:13
sheetal_068-Dec-06 22:13 
AnswerRe: crashing..plz help Pin
Cedric Moonen8-Dec-06 22:25
Cedric Moonen8-Dec-06 22:25 
QuestionHow to send parameter to CRecordset class Pin
prithaa8-Dec-06 21:41
prithaa8-Dec-06 21:41 
AnswerRe: How to send parameter to CRecordset class Pin
Hamid_RT15-Dec-06 6:47
Hamid_RT15-Dec-06 6:47 
QuestionDiscuss: rubber banding - erase a line Pin
includeh108-Dec-06 18:51
includeh108-Dec-06 18:51 
I try to draw a line with mouse moves, similar to line-tool of MS Paint-Brush -
see my previous post any idea to draw this line for more.
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&fr=151[^]

I have downloaded several samples, but all of them are incorrect in basic concept, because they all call update function InvalidateRect(0), RedrawWindow(0) etc - if so, there is no neccessary to use Rubber band tech, as my understanding, rubber banding should only update requied pixels (such as a line) and without touching others (right?).

//--- my MFC code is bellow,
//--- I only copy key code for idea.

CPoint ptStart,ptEnd;
BOOL bDraw=0;

OnLButtonDown(UINT nFlags, CPoint pt)
{
bDraw=1;
ptStart=ptEnd=pt;
}

void OnPaint()
{
CPaintDC dc(this);
if(bDraw)
{
CPen penB(PS_SOLID,10,RGB(0,0,0));
CPen*pPenOld=dc.SelectObject(&penB);
dc.MoveTo(ptStart);
dc.LineTo(ptEnd);
dc.SelectObject(pPenOld);
}
}

void OnMouseMove(UINT nFlags, CPoint pt)
{
if(bDraw)
{
CPoint ptT=ptEnd;
ptEnd=pt;
//erase
RenewLine(ptT);
//display
RenewLine(pt);
}
}

RenewLine(CPoint pt)
{
CDC*pDC=GetDC();

CPen penNull(PS_NULL,10,RGB(0,0,0));
CPen*pPenOld=pDC->SelectObject(&penNull);

UINT u=R2_NOT;
// UINT u=R2_XORPEN;

int iROP=pDC->SetROP2(u);
pDC->MoveTo(ptStart);
pDC->LineTo(pt);
pDC->SetROP2(iROP);

pDC->SelectObject(pPenOld);

ReleaseDC(pDC);
}

//ignore mouse up and capure etc.


Result is none of lines can be seen, what is wrong?
AnswerRe: Discuss: rubber banding - erase a line Pin
Cliff Hatch9-Dec-06 0:24
Cliff Hatch9-Dec-06 0:24 
GeneralRe: Discuss: rubber banding - erase a line Pin
includeh109-Dec-06 1:44
includeh109-Dec-06 1:44 
GeneralRe: Discuss: rubber banding - erase a line Pin
includeh109-Dec-06 2:20
includeh109-Dec-06 2:20 
GeneralRe: Discuss: rubber banding - erase a line Pin
Cliff Hatch9-Dec-06 5:42
Cliff Hatch9-Dec-06 5:42 
Answerposting police Pin
toxcct10-Dec-06 5:01
toxcct10-Dec-06 5:01 
QuestionHow to connect char myvar[] Pin
toeh8-Dec-06 16:10
toeh8-Dec-06 16:10 
AnswerRe: How to connect char myvar[] Pin
David Crow8-Dec-06 16:47
David Crow8-Dec-06 16:47 
AnswerRe: How to connect char myvar[] Pin
Michael Dunn8-Dec-06 19:38
sitebuilderMichael Dunn8-Dec-06 19:38 
QuestionHow to convert string to char* Pin
toeh8-Dec-06 15:45
toeh8-Dec-06 15:45 
AnswerRe: How to convert string to char* Pin
Maximilien8-Dec-06 15:59
Maximilien8-Dec-06 15:59 
Question"couldn't CreateDispatch() for Excel" Pin
sprashanth8-Dec-06 12:46
sprashanth8-Dec-06 12:46 
QuestionLooking for advice on approach to a program Pin
barrem8-Dec-06 12:08
barrem8-Dec-06 12:08 
AnswerRe: Looking for advice on approach to a program Pin
Mark Salsbery8-Dec-06 12:13
Mark Salsbery8-Dec-06 12:13 
GeneralRe: Looking for advice on approach to a program Pin
barrem8-Dec-06 12:15
barrem8-Dec-06 12:15 
GeneralRe: Looking for advice on approach to a program Pin
Mark Salsbery8-Dec-06 12:24
Mark Salsbery8-Dec-06 12:24 
QuestionHow to figure out if bitmap has an alpha channel Pin
Andre xxxxxxx8-Dec-06 11:36
Andre xxxxxxx8-Dec-06 11:36 
AnswerRe: How to figure out if bitmap has an alpha channel Pin
Mark Salsbery8-Dec-06 12:10
Mark Salsbery8-Dec-06 12:10 

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.