开发者

Usage of CScrollView in MFC application

开发者 https://www.devze.com 2023-03-19 20:54 出处:网络
I am using CSCrollView window for our Application in which i have ta开发者_如何学运维ble drawn in View.

I am using CSCrollView window for our Application in which i have ta开发者_如何学运维ble drawn in View. I have derived the CMYclass from CSCrollView, But whenevr i am scrolling the window up and down whatever i have drwan is getting erased. How i can acheive it this... i need to perform same actvity like a Word Pad is doing with images and Text. I want to keep scroll the View Vertically. Till the page ends.

Here is the code snippet:-

void CMyView::OnInitialUpdate()
{
     CSize sizeTotal;
     // TODO: calculate the total size of this view
     sizeTotal.cx = 450;
    sizeTotal.cy = 700;
    SetScrollSizes(MM_TEXT, sizeTotal);
} 

void CMyView::OnDraw(CDC* pDC)
{
    for(int i = 1;i<50;++i)
    {
        AddRow(pDC);
        TopPos = Height+TopPos;//  ![Outpu Window Image][1]
        nCountRow++;
    }
}

it is only drawing 18 rows, but when iam scrolling down above drawn content is no more and also there is nothing coming up in scrolled area.

Is there anything more need to add?

Thanking for help

Regards,

Mukesh


Long time I have used CScrollView. Here is my hint: Try mapping modes other than MM_TEXT. Also look up other functions in CScrollView. I suggest to draw simple stuff first than some complicated rows.

0

精彩评论

暂无评论...
验证码 换一张
取 消