发布时间:2017-7-9 7:28:06编辑 分享查询网我要评论
本篇文章主要介绍了"KRBTabControl ",主要涉及到KRBTabControl 方面的内容,对于KRBTabControl 感兴趣的同学可以参考一下。

Sample Image - maximum width is 600 pixels


This article discusses how to make a custom tab control for the Windows Forms Application using the .NET Framework. A sample application is available within the demo and source project zip files.

  • Mnemonic support
  • Supports keyboard navigation
  • Supports drag and drop tab pages from one container to another and also tab changing in the same container
  • Adds tab page show/hide capability by the drop-down menu
  • Gradient the selected tab item and its background
  • Colorizer support for the control caption (RGBA Changer)
  • Supports dynamic properties for end-users
  • Shows how you can add design-time support so your custom controls behave properly at design time
  • Custom msctls_updown32 scroller. Supports 6 different styles
  • Provides keyboard support to the user for the KRBTabControl operations
  • Supports transparent background for the control caption and the selected tab item
  • Serialization support(Loads previous settings or save current settings.)
  • Event Notifications (Drawing changes, drop-down menu changes, tab page selecting and closing actions)

Contents at a Glance

Anyway, what I am going to cover in this article is as follows:

Class Table

The KRBTabControl class provides a basic implementation of its base control class but we need to create specific classes, properties, methods and a few events for our control. To do this, I have implemented custom classes.

Here you can review the class descriptions.

Class Name Description
GradientTab We fill the selected tab item rectangle and its borders with a specific gradient by using this class member. It includes several kinds of properties for drawing operations.
GradientTabConverter Normally, there's no way to set the subproperties of the GradientTab class at design time. To solve this problem, we need to create a custom type converter which is a specialized class that derives from the ExpandableObjectConverter.
GradientTabEditor To support a thumbnail view, we need to create a custom type editor. Type editors give you the change to get a little fancy by creating a custom thumbnail of the gradient in the properties window.
Hatcher With this class, we fill the tab pages header area with various patterns. It contains four properties for painting operations.
HatcherConverter A custom type converter for a live Hatcher object that derives from the ExpandableObjectConverter.
HatcherEditor We define a thumbnail view for our BackgroundHatcher property in the properties window.
HatchStyleConverter Bug! enumeration of HatchStyle, multiple values at the result while calling the HatchStyle enumeration. Therefore we provide the list of HatchStyle standard values.
CaptionGradient You can determine a new caption gradient style for your tab control by using these class members.
CaptionGradientConverter A custom type converter class for CaptionGradient members.
CaptionGradientEditor A custom type editor class. For creating a custom thumbnail of the gradient in the properties window.
ButtonsCaption You can change your active or inactive caption buttons's color by using these class members.
ButtonsCaptionConverter A custom type converter class for ButtonsCaption members.
ButtonsCaptionEditor A custom type editor class. For creating a custom thumbnail of the gradient in the properties window.
RandomizerCaption RGBA (Red, Green, Blue and Alpha) colorizer for our control caption. You can easily change your caption appearance by using this class members.
RandomizerCaptionConverter A simple ExpandableObjectConverter for CaptionRandomizerproperty.
CaptionColorChooserEditor To add a modal dialog box capability to the CaptionRandomizerproperty, we need to create a new UITypeEditor.
TabpageExCollectionEditor We need to create a custom collection editor for creating a new instance of TabPageEx class or destroying existing TabPageEx in our TabPages collection editor.
TabPageExPool This collection class holds our hidden tab pages. You cannot hide a tab page at design-time. It only works in runtime mode.
Custom3DBorder Our separator drawer class. It draws a vertical line connecting the two points specified by the coordinate pairs.
ArrowWindow It appears only while we're dragging a tab item on the another tab item.
UpDown32 To hide or destroy system "msctls-updown32" scroller button from the container, we need to create a native window class that derives from the NativeWindow.
Scroller The scroller class includes left and right RolloverUpDown control. You can change scroller style from the properties dialog.
RolloverUpDown With the rollover updown control, very little work is performed with GDI+. Instead, updown images for all the four states are prepared in a separate program, and imported into the application as resources. These images are then assigned to the control which switches between them seamlessly (by deriving a class from UpDownBase).
UpDownBase To make a custom updown button scroller, it makes most sense to derive directly from the Control class, because you need to implement all the drawing operations on your own. The UpDownBase control is declared as an abstract class so it cannot be instantiated directly.
KRBTabControlDesigner To add design-time conveniences, like designer verbs or smart tags and also remove inappropriate events or properties from view (or add design-time-only events, properties and to create dynamic properties for our custom control). To create a basic control designer, begin by deriving a class from ParentControlDesigner.
KRBTabControlActionList This class has two roles-it configures the collection of DesignerActionItem instances for the smart tag and when a command or change is made, it performs the corresponding operation on the linked control.
TabPageEx Our custom tab page class. We need to change and add some properties on it.
CaptionColorChooser To change RGBA values on the caption bitmap. We need to use a modal dialog box for changing color attributes.
ContextMenuShownEventArgs This class holds our drop-down menu item parameters.
SelectedIndexChangingEventArgs To prevent tab page selection or close, we need to create a custom EventArgs class.

Control Border Styles

KRBTabControl Border Styles

下一篇:String的实例化与static final修饰符


关键词: KRBTabControl