如何在滚动时创建冻结第一行文本的MFC滚动窗口? [英] How do I create an MFC scrolling window that freezes the first row of text while scrolling?

查看:104
本文介绍了如何在滚动时创建冻结第一行文本的MFC滚动窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio MFC中,我正在尝试创建一个滚动窗口,当用户滚动窗口时,该窗口会冻结第一行文本。此类效果类似于Microsoft Excel中的冻结窗格效果,您可以在向下滚动时保持第一行可见,这样用户始终可以看到标题。



我试图自己完成这个,但是我被困住了,我认为我需要的是一个简单的示例程序,告诉我该怎么做。



如果有人有一个示例MFC程序来演示此功能,我将不胜感激!或者......你可以把我指向互联网上的一个地方!



再次感谢您的帮助和支持!



我尝试了什么:



创建我自己的MFC程序,我知道你可以抓到一个窗口每当有人滚动窗口时都会显示消息,但有时候,它不会转到需要重新绘制文本的OnDraw。

In Visual Studio MFC, I am trying to create a scrolling window which "freezes" the first line of text as a user is scrolling the window. This type of effect is similar to the "Freeze Panes" effect in Microsoft Excel, where you can keep the first row visible while scrolling downward, so that the user always sees the headers.

I have tried to accomplish this on my own, but I am stuck and I think that what I need is a simple sample program that shows me what to do.

If anyone out there has a sample MFC program that demonstrates this feature, I would greatly appreciate it! Or...you can point me to a place on the Internet that does!

Thanks again for all your help and support!

What I have tried:

Creating my own MFC program and I know that you can catch a windows message whenever someone scrolls the window, but occasionally, it doesn't go to OnDraw, where the text needs to be repainted.

推荐答案

您只需修改OnPaint即可方法,因此它始终在视图顶部绘制相同的行。
You just need to modify your OnPaint method so it always paints the same line at the top of the view.


这篇关于如何在滚动时创建冻结第一行文本的MFC滚动窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆