Click here to Skip to main content
15,922,584 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCombo box Dropdown length Pin
Donguy19765-Feb-10 14:17
Donguy19765-Feb-10 14:17 
AnswerRe: Combo box Dropdown length Pin
Richard MacCutchan6-Feb-10 0:01
mveRichard MacCutchan6-Feb-10 0:01 
GeneralRe: Combo box Dropdown length Pin
Donguy19766-Feb-10 3:44
Donguy19766-Feb-10 3:44 
GeneralRe: Combo box Dropdown length Pin
Richard MacCutchan6-Feb-10 5:31
mveRichard MacCutchan6-Feb-10 5:31 
QuestionAny common multi-threaded smart pointer implementations that exist? Pin
Cyrilix5-Feb-10 11:30
Cyrilix5-Feb-10 11:30 
QuestionMFC ODBC Consumer Wizard Problem Pin
cfilorux5-Feb-10 9:02
cfilorux5-Feb-10 9:02 
AnswerNo Answers ?! what did I do Wrong ? Pin
cfilorux17-Feb-10 11:58
cfilorux17-Feb-10 11:58 
QuestionHow to develop tab control dialog in MFC using MS SSTab Pin
Vaclav_5-Feb-10 8:44
Vaclav_5-Feb-10 8:44 
AnswerRe: How to develop tab control dialog in MFC using MS SSTab Pin
cfilorux11-Feb-10 2:38
cfilorux11-Feb-10 2:38 
QuestionA Basic iButton Interface By Marc Clifton Pin
elchino20105-Feb-10 6:57
elchino20105-Feb-10 6:57 
QuestionRe: A Basic iButton Interface By Marc Clifton Pin
Iain Clarke, Warrior Programmer5-Feb-10 7:01
Iain Clarke, Warrior Programmer5-Feb-10 7:01 
AnswerRe: A Basic iButton Interface By Marc Clifton [modified] Pin
elchino20105-Feb-10 8:34
elchino20105-Feb-10 8:34 
AnswerRe: A Basic iButton Interface By Marc Clifton Pin
Maximilien5-Feb-10 7:19
Maximilien5-Feb-10 7:19 
GeneralRe: A Basic iButton Interface By Marc Clifton Pin
elchino20105-Feb-10 10:29
elchino20105-Feb-10 10:29 
QuestionRe-direction on VS Visual Studio Pin
ForNow5-Feb-10 6:22
ForNow5-Feb-10 6:22 
AnswerRe: Re-direction on VS Visual Studio Pin
Stuart Dootson5-Feb-10 9:50
professionalStuart Dootson5-Feb-10 9:50 
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 

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.