MFC应用程序中CScrollView的使用
我正在为我们的应用程序使用 CSCrollView 窗口,其中我在视图中绘制了表格。 我从 CSCrollView 派生了 CMYclass,但是当我上下滚动窗口时,我所拥有的任何内容都会被删除。我如何才能实现它......我需要执行与写字板处理图像和文本相同的活动。我想继续垂直滚动视图。直到页面结束。
这是代码片段:-
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++;
}
}
它只绘制了 18 行,但是当我向下滚动时,绘制的内容不再存在,并且滚动区域中也没有出现任何内容。
还有什么需要补充的吗?
感谢您的帮助
问候,
穆克什
I am using CSCrollView window for our Application in which i have table 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经使用
CScrollView
很长时间了。这是我的提示:尝试MM_TEXT
以外的映射模式。还要查找CScrollView
中的其他函数。我建议首先绘制简单的东西,而不是一些复杂的行。Long time I have used
CScrollView
. Here is my hint: Try mapping modes other thanMM_TEXT
. Also look up other functions inCScrollView
. I suggest to draw simple stuff first than some complicated rows.