自定义可折叠的Panel控件

Custom Control Featuring a Collapsible Panel

本文参考http://www.codeproject.com/Articles/53318/C-Custom-Control-Featuring-a-Collapsible-Panel

version

C# Custom Control Featuring a Collapsible Panel

By Mokdes Hamid, 19 Jan 2010

4.71 (28 votes)

1

2

3

4

5

4.71/5 - 28 votes

2 removed

μ 4.46, σa 1.10 [?]

Is your email address OK? You are signed up for our newsletters but your email address is either unconfirmed, or has not been reconfirmed in a long time. Please click here to have a confirmation email sent so we can confirm your email address and start sending you newsletters again. Alternatively, you can update your subscriptions.

Introduction

Having worked with ASP.NET AJAX CollapsiblePanel control extender and finding it practical to fit more content into a relatively small part of a web page or screen real estate, I thought it would be good to have such control for WinForm applications since VS 2005 and VS 2008 toolboxes do not offer such a control.

Background

CollapsiblePanel AJAX web control extender is a cool web control. But unfortunately, there is no such control in VS 2005 or VS 2008 standard toolbox, so I have decided to create one and share it with the community.

Using the Control at Design Time

Using the control at design time is very simple. Basically it behaves the same way as a normal Panel except that it can be expanded and collapsed.

After adding the Control to the toolbox, drag it on the design surface of your form and you'll get:


The control shows a smart tag when clicked it opens a window showing panel's new features and properties that we can use to customize the panel.

时间: 2024-09-20 08:53:50

自定义可折叠的Panel控件的相关文章

怎样自定义一个服务器端的控件

服务器|控件 大家知道在ASP.NET中微软为我们提供了大量的服务器端控件,包括HtmlControl 和WebControl.它们功能强大,为我们的编程提供了极大的方便.更重要的一点是它开放了对第三方控件的使用.这就使我们可以定制自己需要的服务器端控件.   下面我就以一个集成化的上传组件来说明怎样自定义一个服务器端的控件,这个组件其实是HtmlInputFile.Button 和Label以及事件实现的集合.这个组件要达到的功能是要象已有的webcontrol一样,用一个设定了几个属性的标记

Panel 控件,自动维护滚动条位置

我们知道 Page 的 MaintainScrollPositionOnPostBack 属性为 True 时,PostBack 时页面就会自动维护滚动条位置. 而在上一篇「维护 Panel 滚动条位置」文章中,也介绍如何利用 HiddenField 来维护 Panel 滚动条的位置:在这篇文章中,我们将利用相同的原理,扩展 Panel 控件,使得 Panel 控件就自动具有此功能. 我们将继承 Panel 控件下来命名为 TBPanel ,如同 Page 一样,在 TBPanel 中新增一个

界面设计中关于panel控件的使用!

问题描述 做一个单窗口的小程序,就像某些设置向导程序一下,都是在一个窗口中点击"下一步",最后点击完成.大概需要三四个"下一步",我是在窗口上建个多个panel容器控件,再向每个panel容器里添加其他组件,在C#2003里我是这样做的:程序启动时第一个panel控件显示,其它的panel控件隐藏起来,点"下一步"按钮控件的时候第二个panel显示,其他的panel隐藏,上一步则是相反,直到最后"完成",但在C#2005里这样

c# winform项目,将panel控件中的四条边框加粗,且四条边框的颜色为蓝色

问题描述 c# winform项目,将panel控件中的四条边框加粗,且四条边框的颜色为蓝色 在c# winform项目,目前panel控件中的四条边框的样式为细线黑色. 请问如何将panel控件中的四条边框加粗,且四条边框的颜色为蓝色. 请各位帮忙看看有没有相关的源码或参考资料.谢谢! 解决方案 private void panel1_Paint(object sender, PaintEventArgs e) { ControlPaint.DrawBorder(e.Graphics, thi

C# winform 关于ToolStrip控件工具项拖动到指定的Panel控件中

问题描述 C# winform 关于ToolStrip控件工具项拖动到指定的Panel控件中 C# Winform项目中,在form窗体中有一个ToolStrip控件(用于放所有的系统的功能项,目前大概有将近15个功能项,后续会陆续增加应用的功能项), 两个Panel控件(panel1和panel2控件是两个目标区,用于将ToolStrip控件中的子项拖放到的目标区域,在目标区域中打开或执行ToolStrip控件子项) 请问下,怎么样实现如下两个功能: 1.实现鼠标选中ToolStrip控件的子

panel-C# winform 如何实现将PictureBox控件拖动到任意的Panel控件中。

问题描述 C# winform 如何实现将PictureBox控件拖动到任意的Panel控件中. 在C# winform中,有一个form窗体,在form窗体中包函四个Panel控件(panel1.panel2.panel3.panel4)以及多个PictureBox控件. 请问,如何实现将PictureBox控件手动拖动到任意一个Panel控件中,且充满当前拖动到目标的Panel控件中显示. 最好提供相关的源码或参考资料,谢谢. 解决方案 是运行时拖动么?你需要处理drug事件,然后在容器接收

panel-C# winform 如何实现将Label控件的文本内容拖动到任意的Panel控件中。

问题描述 C# winform 如何实现将Label控件的文本内容拖动到任意的Panel控件中. 在C# winform中,有一个form窗体,在form窗体中包函四个Panel控件(panel1.panel2.panel3.panel4)以及三个Label控件(label1.label2.label3). 目前需要实现如下拖动效果: 1.要求将label1控件的text文本内容,手动拖动到任意一个Panel控件中居中显示label1控件text文本内容. 2.并且要求将拖动到Panel控件中的

自定义文件上传控件样式-input透明法

自定义文件上传控件样式-input透明法. 作为一个刚入坑不久的程序小白,今天和一个自定义<input type="file">控件的工作斗智斗勇了一上午.通过各种膜拜大神们的资料,总算最后有了一个还算看的过去的解决方案,来记录一下. 页面中,<input type="file">控件的默认显示 在Chrome中是这样: 在IE里是这样: 要如何使它变成下面这样,点击此区域也能上传文件呢? 原理:将input放进一个具有背景的div标签中,并

Panel 控件概述(Windows 窗体)

Windows 窗体 Panel 控件用于为其他控件提供可识别的分组.通常,使用面板按功能细分窗体.     Panel控件的常用属性           1.Anchor和Dock:这两个属性是所有有用户界面的控件都有的定位属性.           2.Name属性:标识控件的对象名称          3.BorderStyle属性:指示Panel控件的边框样式,共有三个枚举值:          BorderStyle.None(默认)-无边框.          BorderStyle