Git Product home page Git Product logo

tabcontrol-extra's Introduction

TabControlExtra

An improved TabControl for Windows Forms (.Net)

The System.Windows.Forms TabControl provided by Microsoft in the .Net Library has a number of limitations that make it unpleasant to use.

This project grew out of an excellent effort by Mark Jackson on CodeProject to improve on the Microsoft TabControl. It was named CustomTabControl, and the original can be found here:

Painting Your Own Tabs - Second Edition

This link includes a good description of the failings of Microsoft's TabControl, and describes in detail the approach taken by Mark to improve it.

In 2011 I found a need for a tab control that avoids the limitations of the Microsoft TabControl, and I came across Mark's CustomTabControl at the link above.

Mark's code dates back to 2010, and there have been no updates since then, and I discovered a number of bugs that needed to be fixed. I also wanted some additional customizations (for example flat rectangular tabs). So I spent quite a bit of time over the years since then modifying it to meet my needs.

I have a number of projects that I want to publish on GitHub that use my modified version, and although the CodeProject Open Licence (under which Mark's code was licensed) would permit me to do this, I feel strongly that such a useful component should be more easily and widely accessible and should therefore be a free-standing project on GitHub in its own right.

Hence this project. I have renamed it to TabControl-Extra, rather than its original name, CustomTabControl.

The initial source code in the repository is Mark's code that I downloaded in 2011, and my accumulated amendments are in subsequent commits. So the gross history of the project is represented in the repository, though not the detailed process of my amendments (ie there are not separate commits for all the various bug fixes and enhancements I made up to the creation of this repository).

Licence

This project is licensed under the Code Project Open License (CPOL) Version 1.02 (see the License.md file or go here).

tabcontrol-extra's People

Contributors

rlktradewright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tabcontrol-extra's Issues

Issue with TabClosing event

I'm currently using your custom control for a private software (and it is perfect by the way), but I ran into an issue dealing with the TabClosing event.
This event is currently raised after the tab is closed, instead of being raised before the tab is closed. It seems like moving the if (this.TabClosing != null) statement at the top of the OnTabClosing method (in TabControlExtra.cs) solves the issue. May you make a commit solving the problem? Thank you for your great work!

Aligment=left, DisplayRectangle is error when Aligment=left and SizeMode=Fixed

tabcontrol-extra/TabControlExtra/TabControl/TabControlExtra.cs line 238
if (this.Alignment <= TabAlignment.Bottom)
{
itemHeight = this.ItemSize.Height;
}
else
{
itemHeight = this.ItemSize.Width;
}

fix:
itemHeight = this.ItemSize.Height;


if Aligment=left and SizeMode=Fixed
rect = new Rectangle(tabStripHeight, 2, Width - tabStripHeight - 2, Height - 4)
rect .x must is this.ItemSize.Height

Add / New Tab button

Hi

Firstly great project, works really well

Unless I am missing it, I can't see that it has an option to show a button to be able to add / open a new tab e.g. like a + icon or similar?

Thank you

Change namespace?

The current version of the TabControlExtra control uses the System.Windows.Forms namespace. The original justification for doing so is that it makes it easy to substitute TabControlExtra in a program that already uses the Microsoft TabControl.

I'm uncomfortable using this namespace, as it really seems a bit of a cheek to me, although there aren't any technical problems with it. I feel that Microsoft 'owns' System.Windows.Forms, and we shouldn't really be using it for our own purposes.

So I propose a namespace change to something that fits in with the TradeWright namespace scheme. This would be something like:

TradeWright.UI.Forms

I realise this is a breaking change and would require changing some existing references or adding new using or Imports statements, but these changes are trivial (and I suspect few people are using TabControlExtra anyway).

So any reactions to this proposed change please?

Drag'n'drop was broken

The point passed to GetActiveTabIndex should be the client coordinate.
Thus the corresponding code in TabControlExtra.OnDragOver should be:

var dragPoint = new Point(drgevent.X, drgevent.Y);
var tabPoint = this.PointToScreen(Point.Empty);
dragPoint.Offset(-tabPoint.X, -tabPoint.Y);
if (this.GetActiveTab(dragPoint) == dragTab) {
    return;
}

int insertPoint = this.GetActiveIndex(dragPoint);
if (insertPoint < 0) return;

Please make the demo project DPI-aware

app.zip

You can add the above app.manifest file and use it in the demo project's Manifest property.
After that, it is DPI-aware.
Tab height will be automatically adjusted in various DPI settings.

Adjustable TabCloserButtonSize

Currently the size of the closer button is a constant.
I tested it and found that it could be changed to a property.

I suggest that:
If the value is positive, it is an absolute size.
If the value is negative or zero, TabControlExtra calculates rendered size = tab height - padding + TabCloserButtonSize.

MenuStrip attached to tabcontrol

Hello,

Thank you for making such a great control, it is very useful. But I would like to have a menustrip attached to it like below.

image

Is it possible to implement such thing or not worth to try? Can you give me suggestions please about how to do it?

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.