您的位置:程序门 -> .net技术 -> c#



如何指定一个panel里面内容显示的位置?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


如何指定一个panel里面内容显示的位置?[已结贴,结贴人:flyskylf]
发表于:2007-01-27 12:24:51 楼主
一个panel高只有100,里面放了很多的控件,下面有一些显示不出来,如何点击一个按钮把下面的控件显示出来,就是类似滚动条向下拉的效果,各位帮忙!!
发表于:2007-01-27 12:48:131楼 得分:0
加个滚动条不行吗

如果要实现你说的效果,可以在这个panel里嵌两个panel,当点按钮后,隐藏一个,显示另一个就行了
发表于:2007-01-27 12:53:342楼 得分:0
我写了这样的代码
private   void   button1_click(object   sender,   eventargs   e)
                {
                        system.drawing.point   currentpoint;  
                        currentpoint   =   panel1.autoscrollposition;  

                        this.panel1.autoscroll   =   true;
                        panel1.autoscrollposition   =   new   point(math.abs(panel1.autoscrollposition.x),   math.abs(currentpoint.y)   +   10);  
                }
现在可以实现panel的滚动,但是会显示滚动条,如何让滚动条不显示?
发表于:2007-01-27 12:56:013楼 得分:0
加上滚动条比较难看,我想在界面上面加上一个向下的按钮,这样就可以通过点击这个按钮实现滚动了.
发表于:2007-01-27 12:57:114楼 得分:5
把   panel   的   autosize   设   true
把   panel   的上级容器的   autoscroll   设   true
发表于:2007-01-27 13:01:255楼 得分:0
那样还是会出现滚动条,感觉不好看
发表于:2007-01-27 13:07:306楼 得分:5
考虑下使用scrollwindow这个api:

[dllimport( "user32.dll ",   charset   =   charset.auto,   exactspelling   =   true)]
[return:   marshalas(unmanagedtype.bool)]
private   static   extern   bool   scrollwindow(intptr   hwnd,   int   nxamount,   int   nyamount,   ref   rect   rectscrollregion,   ref   rect   rectclip);
发表于:2007-01-27 13:07:487楼 得分:5
你的panel是单一底色吧,可以用css把滚动条过滤掉,这是一个例子,参考下吧

<style   type=text/css>  
<!--  
#talk{line-height:   100%;   scrollbar-arrow-color:#3b3b3b;   scrollbar-face-color:#3b3b3b;   scrollbar-darkshadow-color:#3b3b3b;   scrollbar-highlight-color:#3b3b3b;   scrollbar-3dlight-color:#3b3b3b;   scrollbar-shadow-color:#3b3b3b;   scrollbar-track-color:#3b3b3b;filter:chroma(   color   =   #3b3b3b   );   allowtrancparency:true;}
-->  
</style>
发表于:2007-01-27 13:09:408楼 得分:0
学习
发表于:2007-01-27 13:12:539楼 得分:0
to:hbxtlhx(平民百姓)   (   )
小弟水平比较菜,能否给个demo谢谢!!
发表于:2007-01-27 13:13:2110楼 得分:0
to:hbxtlhxlxcnn(过客)
我的是winform的,也可以马?
发表于:2007-01-27 13:20:4311楼 得分:5
呵呵,winform啊,不好意思,没注意哪个版块的,没这么搞过,看看百姓兄的方法吧


快速检索

最新资讯
热门点击