Click here to Skip to main content
15,905,914 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow can i lock the internet from a C++ program Pin
SNArruda18-Sep-08 5:04
SNArruda18-Sep-08 5:04 
AnswerRe: How can i lock the internet from a C++ program Pin
David Crow18-Sep-08 5:21
David Crow18-Sep-08 5:21 
JokeRe: How can i lock the internet from a C++ program Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:22
Iain Clarke, Warrior Programmer18-Sep-08 5:22 
AnswerRe: How can i lock the internet from a C++ program Pin
Bram van Kampen18-Sep-08 14:55
Bram van Kampen18-Sep-08 14:55 
QuestionRatio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:01
simon alec smith18-Sep-08 5:01 
QuestionRe: Ratio result placing a square not working - when resizing window Pin
David Crow18-Sep-08 5:26
David Crow18-Sep-08 5:26 
AnswerRe: Ratio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:30
simon alec smith18-Sep-08 5:30 
AnswerRe: Ratio result placing a square not working - when resizing window [modified] Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:29
Iain Clarke, Warrior Programmer18-Sep-08 5:29 
Modified for the 2nd time... Looks like I missed the point with your question - dividing an integer with another integer, especially a larger one is going to give you BAD results. - Iain.

Where are you doing these calculations?

class CMyView : public CView
{
    ...
    int m_nHorzOffset;
    ...
};


void CMyView::OnDraw(CDC* pDC)
{
   CRect rc;
   GetClientRect (&rc);
   // Make a point in the middle
   CPoint ptCentre = rc.CenterPoint ();

   ptCentre.x = rc.Width () / 4; // make it 1/4 the way across if we like...

   // draw a vertical centre line
   pDC->MoveTo (ptCentre.x, rc.top);
   pDC->LineTo (ptCentre.x, rc.bottom);

   // draw a triangle, offset by m_nHorzOffset
   pDC->MoveTo (ptCentre.x + m_nHorzOffset - 100, ptCentre.y + 50);
   pDC->LineTo (ptCentre.x + m_nHorzOffset + 100, ptCentre.y + 50);
   pDC->LineTo (ptCentre.x + m_nHorzOffset, ptCentre.y - 100);
   pDC->LineTo (ptCentre.x + m_nHorzOffset - 100, ptCentre.y + 50);
}
...

void CMyView::OnLeftABit ()
{
   m_nHorzOffset -= 10;
   Invalidate ();
}


I'm assuming you have the left arrow mapped via an accelerator to (eg) IDC_LEFTABIT, and have a command handler called OnLeftABit in your view class.

Hopefully that should work.

Iain.

Modified: Added centre line, some comments, and x=width/4 as an example.

modified on Thursday, September 18, 2008 12:07 PM

AnswerRe: Ratio result placing a square not working - when resizing window Pin
Mark Salsbery18-Sep-08 5:56
Mark Salsbery18-Sep-08 5:56 
QuestionWinInet issue Pin
George_George18-Sep-08 4:16
George_George18-Sep-08 4:16 
QuestionDrawing wider dashed lines Pin
softwaremonkey18-Sep-08 2:18
softwaremonkey18-Sep-08 2:18 
AnswerRe: Drawing wider dashed lines Pin
Cedric Moonen18-Sep-08 2:35
Cedric Moonen18-Sep-08 2:35 
GeneralRe: Drawing wider dashed lines Pin
softwaremonkey18-Sep-08 4:44
softwaremonkey18-Sep-08 4:44 
QuestionCSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:09
tenwang18-Sep-08 2:09 
AnswerRe: CSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:11
tenwang18-Sep-08 2:11 
AnswerRe: CSpinButtonControl : undeclared identifier. Pin
KarstenK18-Sep-08 2:13
mveKarstenK18-Sep-08 2:13 
GeneralRe: CSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:19
tenwang18-Sep-08 2:19 
QuestionRe: CSpinButtonControl : undeclared identifier. Pin
Roger Stoltz18-Sep-08 2:20
Roger Stoltz18-Sep-08 2:20 
AnswerRe: Pin
tenwang18-Sep-08 18:39
tenwang18-Sep-08 18:39 
AnswerRe: Pin
Roger Stoltz18-Sep-08 21:29
Roger Stoltz18-Sep-08 21:29 
GeneralRe: Pin
tenwang18-Sep-08 21:51
tenwang18-Sep-08 21:51 
AnswerRe: Pin
Roger Stoltz18-Sep-08 22:16
Roger Stoltz18-Sep-08 22:16 
GeneralRe: Pin
tenwang18-Sep-08 23:12
tenwang18-Sep-08 23:12 
Questiongethostname() function returns errror Pin
Anu_Bala18-Sep-08 1:38
Anu_Bala18-Sep-08 1:38 
AnswerRe: gethostname() function returns errror Pin
Roger Stoltz18-Sep-08 1:55
Roger Stoltz18-Sep-08 1:55 

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.