TabHeader 의 높이(위치가 Top 일때)를 임의 크기로 변경
좌측상단 꺽이는 부분을 없애기 위함
변경사항
Customizing 을 위해 별도 클래스 생성
using System.Drawing;
using DevExpress.XtraTab;
using DevExpress.XtraTab.ViewInfo;
namespace KKOMZI
{
public class MyTabControl : XtraTabControl
{
public MyTabControl() : base()
{
DevExpress.XtraTab.Registrator.PaintStyleCollection.DefaultPaintStyles.Add(new MyViewInfoRegistrator());
}
}
public class MyViewInfoRegistrator : DevExpress.XtraTab.Registrator.SkinViewInfoRegistrator
{
public override string ViewName
{
get
{
// return base.ViewName;
return "MyView";
}
}
public override BaseTabHeaderViewInfo CreateHeaderViewInfo(BaseTabControlViewInfo viewInfo)
{
return new MyHeaderViewInfo(viewInfo);
}
}
public class MyHeaderViewInfo : DevExpress.XtraTab.ViewInfo.SkinTabHeaderViewInfo
{
/// <summary>
/// 탭 헤더 높이
/// </summary>
private int TabHeight = 40;
public MyHeaderViewInfo(BaseTabControlViewInfo viewInfo) : base(viewInfo) { }
protected override Size CalcHPageSize(BaseTabPageViewInfo info)
{
Size size = base.CalcHPageSize(info);
// size.Height += 50;
size.Height = TabHeight;
size.Height = TabHeight; return size;
}
protected override Rectangle CalcRowClientBounds(BaseTabRowViewInfo row, Rectangle headerClient)
{
Rectangle rect = base.CalcRowClientBounds(row, headerClient);
// rect.Inflate(0, -20);
return rect;
}
/// <summary>
/// 탭 헤더 시작위치 변경(좌측 상단 꺽이는 부분을 없애기 위해) : 스킨마다 좀 다른듯?
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
protected override Point CalcStartPoint(Point p)
{
int num = -1;
int num2 = 2;
if (this.IsSideLocation)
{
p.Y += num;
if (this.HeaderLocation == TabHeaderLocation.Left)
p.X += num2;
}
else
{
p.X += num;
if (this.HeaderLocation == TabHeaderLocation.Top)
p.Y += num2;
}
return p;
}
}
}
실제 사용시 PaintStyleName 를 맞춰주면됨
myTabControl1.LookAndFeel.SetStyle(DevExpress.LookAndFeel.LookAndFeelStyle.Skin, false, false, "Office 2007 Blue");
myTabControl1.PaintStyleName = "MyView";
0 Comments