Code Monkey home page Code Monkey logo

headertablelayoutpanel's Introduction

HeaderTableLayoutPanel

HeaderTableLayoutPanel is a WinForms control inherited from TableLayoutPanel and provides highlighted header.

Problem

There are a lot of panels for grouping the controls in WinForms. The best one of them is TableLayoutPanel, especially for grouping controls, that are using for editing data. Unfortunately, this panel does not show the header. This necessity appears when there are different kinds of editing controls on the same Windows form.

Solution

It can be solved by GroupBox and TableLayoutPanel. This solution is easy, but may look unpleasant. Another possibility is using Label control in first row of TableLayoutPanel. This solution may be uncomfortable.

I prefer to make inherited panel from TableLayoutPanel with all necessary functions.

How It works

TableLayoutPanel with highlighted header called HeaderTableLayoutPanel is simple, useful, and cute. This control may show the header in a number of different ways:

How It works

The HeaderTableLayoutPanel implements just three properties:

  • CaptionText - string property that contains a text for showing. If this property is string.Empty or null then the header will not be shown
  • CaptionStyle - this is enum (HighlightCaptionStyle) property that points a drawing style. It can be: ForeColor, HighlightColor, ForeStyle, HighlightStyle, NavisionAxaptaStyle, GroupBoxStyle (see the image above)
  • CaptionLineWidth - byte property that points the width of header's line (0 - the line will not be shown)

Be aware of CaptionLineWidth. If CaptionStyle = HighlightCaptionStyle.HighlightStyle, then two lines with Width = CaptionLineWidth will be shown, one will be above the Header and the second one will be below the header. For CaptionStyle = HighlightCaptionStyle.GroupBoxStyle this property does not do anything.

Screens

Screen 1 Screen 2 Screen 3

How to use it

The following example explains the procedure to create a new HeaderTableLayoutPanel:

using CBComponents;
...
var headerTableLayoutPanel = new HeaderTableLayoutPanel()
{
  CaptionText = "Preferred text for header",
  CaptionStyle = HeaderTableLayoutPanel.HighlightCaptionStyle.NavisionAxaptaStyle,
  CaptionLineWidth = 2  
};
this.Controls.Add(headerTableLayoutPanel1);

To install HeaderTableLayoutPanel, run the following command in the Package Manager Console:

PM> Install-Package CBComponents.HeaderTableLayoutPanel 

Alternative option: download compiled library and examples.

Supported .NET Frameworks

HeaderTableLayoutPanel inherits from TableLayoutPanel, which was implemented in Microsoft .NET Framework 3.5. In general HeaderTableLayoutPanel does not use any special requirements. It can be compiled on any Microsoft .NET Framework platform (including the .NET Framework 3.5 client profile).

Contacts

I would appreciate hearing your opinion on this. If you have any questions, please feel free to contact me by email: [email protected]

headertablelayoutpanel's People

Contributors

canadianbeaver avatar datarza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.