Tabcontrol tabpage indented canvas

  • Thread starter Rex the Strange
  • Start date
R

Rex the Strange

I suspect the answer to this question is "you can't," but here goes
anyway:

I have a tabcontrol which contains, of course, various tabpages (added
programmatically at runtime, but this is irrelevent to the question).
I've noticed, however, that the actual drawing canvas of the tabpage is
not flush with the edge of the tabpage. There is always a small one
pixel border on the top, right and bottom and a three pixel border on
the left. So, when I put my custom control on the page and dock it to
full there's always this ugly white line around it.

How do I get rid of that? I've tried adjusting padding and margins of
all controls and nothing seems to work. Is this impossible? Does it
require manually redrawing the tabpage and component (god, I hope not).

tia
rts
 
M

Mick Doherty

Inherit from TabControl and override the DisplayRectangle.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace MyNameSpace
{
public class MyTabControl : TabControl
{
public override System.Drawing.Rectangle DisplayRectangle
{
get
{
Rectangle r = base.DisplayRectangle;
r.Inflate(2, 1);
r.Offset(-1, 0);
return r;
}
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top