Skip to main content
Email Password   helpLost your password?

Contents

  1. Introduction.
  2. Everything is in one.
  3. How does it work? The demo application.
  4. Conclusion.

Sample screenshot

Introduction

The idea of this project appeared when I implemented a project, when a client wanted to receive a control that wasn�t in standard Microsoft libraries. I decided to write my own control. In the process of work on the project, the class acquired additional modules and various extenders. Some of them became classes, some of them could not be in a class. As a result, it was a small library including dozens of classes and several interfaces. During the writing of these classes, I had got a lot of questions and it wasn�t simple to find answers to them. The purpose of this article is to provide a description of the functionality of the components developed by me and their application. It will be interesting to view some of the parts of my source code. C# was used to create the classes. The source code is taken from a real application (http://www.eboris.com/, http://www.borisbord.com/).

Everything is in one.

In the library, I combined the functionality of TabControl with ToolBar. I implemented DragAndDrop of buttons-tab-headers with a possibility to select buttons and corresponding pages (TabPage). In the developed library, there is a control that can work as a standard TabControl. However, we aren�t limited in the selection of forms, colors and other properties. This control can also be used as ToolBar with a possibility of selection of forms, colors and positions. Now, one object executes various functions.

Implementation of the library classes.

Expanded methods of ImageButton:

NormalDisableImageIndex , NormalLeaveImageIndex, NormalPressImageIndex, NormalEnterImageIndex, CheckedDisableImageIndex, CheckedLeaveImageIndex, CheckedPressImageIndex, CheckedEnterImageIndex - status of the buttons that can have got positive values of the icon number corresponding to ImageList set in TabButtonExtender.ImageList field. If a value of one of 8 properties is -1 then an image will be taken from a corresponding property of ImageButton. It means that a programmer has a possibility to select a place where the image is taken from: ImageList or ImageButton property.

PaintExtender gives a possibility to join any classes inherited from BorisBord.WinForms.IPaintHelper interface:

public interface IPaintHelper
{
  void Paint(object sender, System.Windows.Forms.PaintEventArgs pe);                 
}

In addition to it, the expanded class has a possibility that is set during the creation of an instance. This property of ImageList type shows what ImageList created by you is connected with this instance of the class.

There are 3 �eccentricities� PaintHelperRect, PaintHelperRhomb, PaintHelperEllipse.

They are inherited from BorisBord.WinForms.IPaintHelper interface showing variants of dispbookmark of ImageButton. Each of them has got 6 properties: 5 of them have got System.Drawing.Color type corresponding to 4 statuses EnterBackColor, LeaveBackColor, CheckBackColor, PressBackColor and the BorderColor border color. There is also Alpha parameter of transparence of background for darkening.

The implementation of these classes should be spoken about separately that�s why I wrote them only to show that using of TabButton + TabHeader + TabPage bunch allows creating miracles. They implement one of the variants of button backlighting (similar to OfficeXP) and draw darkening in rectangle, rhomb or ellipse shape. I wrote them fast and they are all clones of each other except Paint method (object sender, �) but the result is interesting.

ImageButton

How does it work? The demo application.

The application is a form with tab pages. All functions in the application can be done with a mouse. At the bottom part of the form, there is a window where promptings are shown. The size of the window can be changed with Splitter. Try to move the mouse over the form. When the cursor is over a functional region, you will see messages that will help you.

Each page is an example showing one or several possibilities of the developed classes.

  1. �TabControl� Panel - shows examples of TabHeader + TabPage as standard TabControl. Here there are possibilities that the standard TabControl doesn�t have. The header of TabHeader can be placed separately independent from TabPage and since TabHeader is inherited from TabPage it can be used as TabPage. It will appear and disappear also from the screen as well as usual TabPage. Affiliated TabHeader can have its own TabPage or TabHeader. By the way, already on this page, it is possible to take advantage of function DragAndDrop. You can drag TabButton three affiliated TabHeader from one to another. In these TabHeader pages TabPage are not moved behind buttons.

    Page TabControl

  2. "Buttons" Panel shows opportunities of buttons of TabButton class. They are shown as tab headers and various variants of a kind of buttons. At the left is TrackBar that allows changing darkening of a background of buttons with the expanded properties.

    Page Buttons

  3. "DragAndDrop" Panel represents ToolBar panels carrying out functions of TabControl at the same time. And, each of its page is an independent TabHeader.

    Now try to grasp a button (selected or not selected) and move them all over again on one TabHeader, and then do it with others.

  4. "All are assembled" Panel represents overlapping all opportunities given by the developed classes.

I want you to notice, that all you see looks absolutely on miscellaneous, but everything is made with only three controls TabHeader, TabPage and TabButton.

Conclusion

In summary, I want to note, that the given article describes receptions and methods applied in the library a little. A lot of code has been written quickly and is not optimized. I will be glad to answer all your questions and if you are interested, I shall keep on publications, discussions and updating of the code. I am waiting for your comments.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralVery Cool Pin
Agent 86
19:58 9 Mar '04  
GeneralRe: Very Cool Pin
Boris Bord
10:59 10 Mar '04  
GeneralNice! Pin
Frank Hileman
6:48 2 Mar '04  
GeneralRe: Nice! Pin
Boris Bord
7:39 2 Mar '04  
GeneralRe: Nice! Pin
Frank Hileman
10:14 2 Mar '04  
GeneralRe: Nice! Pin
Boris Bord
5:12 4 Mar '04  


Last Updated 8 Feb 2005 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009