Click here to Skip to main content
15,896,549 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Re-direction on VS Visual Studio Pin
ForNow5-Feb-10 10:38
ForNow5-Feb-10 10:38 
GeneralOr you can just save the Output to a file Pin
cfilorux6-Feb-10 2:19
cfilorux6-Feb-10 2:19 
Questionlinker error....?? Pin
AmbiguousName5-Feb-10 5:07
AmbiguousName5-Feb-10 5:07 
AnswerRe: linker error....?? Pin
Chris Losinger5-Feb-10 6:09
professionalChris Losinger5-Feb-10 6:09 
GeneralRe: linker error....?? Pin
AmbiguousName6-Feb-10 0:25
AmbiguousName6-Feb-10 0:25 
AnswerRe: linker error....?? Pin
Maximilien5-Feb-10 6:37
Maximilien5-Feb-10 6:37 
GeneralRe: linker error....?? Pin
AmbiguousName6-Feb-10 0:22
AmbiguousName6-Feb-10 0:22 
QuestionPolyLine and graph scaling Pin
npuleio5-Feb-10 3:11
npuleio5-Feb-10 3:11 
Hello everyone here!!

I have an array of POINTs where X are represented by consecutive integers from 0 to n and Y are represented with RAND values...
So I represent this array on the canvas using PolyLine and I'm trying also to "rescaling" graphic when resizing window but it doesn't work... I have coded the OnPaint procedure like below:

void CMyDLL::OnPaint()
{
        CPaintDC dc(this); // device context for painting
        dc.SetBkColor(RGB(0,0,0));
       
        CRect rect;
        GetClientRect(&rect);
 
        int save = dc.SaveDC();
 
        if(bSetDraw)
        {
                CMemDC mDC(&dc);
 
                //mDC.SetBkColor(RGB(0,0,0));
                mDC.SetMapMode(MM_ANISOTROPIC);
                mDC.SetWindowOrg(rect.BottomRight());
                mDC.SetViewportOrg(0, 0);
                mDC.SetViewportExt(-1, -1);
                mDC.SetWindowExt(1, 1);
                // ********** Background ***********
                // Grid
                if (bActivateGrid)
                {
                        CPen qLinePen(PS_SOLID, 1, RGB(0,139,0));
                        mDC.SelectObject(&qLinePen);
 
                        // Grid - Horizontal lines
                        mDC.MoveTo(1, 0);
                        mDC.LineTo(rect.Width(), 0);
                        int height = rect.Height();
                        int maxlines = height / (int)12.5;
                        for (int i=1;i<=maxlines;i++){
                                int y_axis = (int)((double)i * 12.5);
                                if (y_axis <= rect.Height()) {
                                        mDC.MoveTo(1, y_axis);
                                        mDC.LineTo(rect.Width(), y_axis);
                                }
                        }
 
                        // Grid - Vertical lines
                        mDC.MoveTo(0, 0);
                        mDC.LineTo(0, rect.Height());
                        int width = rect.Width();
                        maxlines = width / (int)12.5;
                        for (int i=1;i<=maxlines;i++){
                                int x_axis = (int)(((double)i * 12.5) - gridOffset);
                                if (x_axis <= rect.Width()) {
                                        mDC.MoveTo(x_axis, 1);
                                        mDC.LineTo(x_axis, rect.Height());
                                }
                        }
 
                        qLinePen.DeleteObject();
                }
                // *********** graphic component ***********
                // based on choice of graph type
                CPen qPolylinePen(PS_SOLID, 1, RGB(0, 255, 0));
                switch (iGraphType)
                {
                case GRAPH_BARS:
                        break;
 
                case GRAPH_LINES:
                        {                              
                                if (vtPoints.capacity() == 1)
                                {
                                        mDC.SelectObject(qPolylinePen);
                                        vectfPoints* pointsline = &vtPoints[0];
                                        mDC.Polyline(&(*pointsline)[0], (int)pointsline->size());
                                        //mDC->PolyPolyline()
                                        qPolylinePen.DeleteObject();
                                }
                        }
                        break;
 
                default:
                        break;
                }
                GDI_FLUSH();
        }
 
        dc.RestoreDC(save);
}


Could I have forgot something? Or coded wrong something else in this code?...
Thanks in advance to everyone
Ciao, Luigi
AnswerRe: PolyLine and graph scaling Pin
CPallini5-Feb-10 3:51
mveCPallini5-Feb-10 3:51 
GeneralRe: PolyLine and graph scaling Pin
npuleio5-Feb-10 4:10
npuleio5-Feb-10 4:10 
AnswerRe: PolyLine and graph scaling - aka Fer shame Carlo. Pin
Iain Clarke, Warrior Programmer5-Feb-10 6:12
Iain Clarke, Warrior Programmer5-Feb-10 6:12 
GeneralRe: PolyLine and graph scaling - aka Fer shame Carlo. Pin
CPallini5-Feb-10 6:53
mveCPallini5-Feb-10 6:53 
GeneralRe: PolyLine and graph scaling - aka Fer shame Carlo. Pin
Iain Clarke, Warrior Programmer5-Feb-10 6:59
Iain Clarke, Warrior Programmer5-Feb-10 6:59 
GeneralRe: PolyLine and graph scaling - aka Fer shame Carlo. Pin
CPallini5-Feb-10 8:06
mveCPallini5-Feb-10 8:06 
GeneralRe: PolyLine and graph scaling - aka Fer shame Carlo. Pin
npuleio7-Feb-10 23:30
npuleio7-Feb-10 23:30 
QuestionDoubts about sockets in vc++ Pin
thangvel5-Feb-10 0:32
thangvel5-Feb-10 0:32 
AnswerRe: Doubts about sockets in vc++ Pin
Richard MacCutchan5-Feb-10 0:46
mveRichard MacCutchan5-Feb-10 0:46 
AnswerRe: Doubts about sockets in vc++ Pin
CPallini5-Feb-10 0:52
mveCPallini5-Feb-10 0:52 
AnswerRe: Doubts about sockets in vc++ Pin
fat_boy5-Feb-10 1:04
fat_boy5-Feb-10 1:04 
AnswerRe: Doubts about sockets in vc++ Pin
Moak5-Feb-10 2:26
Moak5-Feb-10 2:26 
QuestionIOCTL_STORAGE_GET_DEVICE_NUMBER fail to get disk number Pin
MKC0024-Feb-10 22:26
MKC0024-Feb-10 22:26 
AnswerRe: IOCTL_STORAGE_GET_DEVICE_NUMBER fail to get disk number Pin
vasu_sri4-Feb-10 22:36
vasu_sri4-Feb-10 22:36 
GeneralRe: IOCTL_STORAGE_GET_DEVICE_NUMBER fail to get disk number Pin
MKC0024-Feb-10 23:21
MKC0024-Feb-10 23:21 
GeneralRe: IOCTL_STORAGE_GET_DEVICE_NUMBER fail to get disk number Pin
vasu_sri4-Feb-10 23:40
vasu_sri4-Feb-10 23:40 
GeneralRe: IOCTL_STORAGE_GET_DEVICE_NUMBER fail to get disk number Pin
Adam Roderick J5-Feb-10 0:10
Adam Roderick J5-Feb-10 0: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.