Quantcast
Channel: c# tabcontrol drawitem olayı.
Viewing all articles
Browse latest Browse all 3

c# tabcontrol drawitem olayı.

$
0
0

c# web browser yapıyorumda bi yerde karşıma bi sorun çıktı resimde:

Görüldüğü Üzere yazı dışarı kaçıyor onu nasıl düzeltebilirim ltfen yardm edin.
Örnek Kodlar:
private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
if (tabControl1.TabCount != 1)
{
try
{
Rectangle r = e.Bounds;
r = this.tabControl1.GetTabRect(e.Index);
r.Offset(1, 1);
Brush TitleBrush = new SolidBrush(Color.Black);
Font f = this.Font;
string title = this.tabControl1.TabPages[e.Index].Text;
e.Graphics.DrawString(title, f, TitleBrush, new PointF(r.X, r.Y));
e.Graphics.DrawImage(img, new Point(r.X + (this.tabControl1.GetTabRect(e.Index).Width - _imageLocation.X), _imageLocation.Y));
this.tabControl1.SizeMode = TabSizeMode. Fixed;
}
catch (Exception) { }
}
else
{
try
{
Rectangle r = e.Bounds;
r = this.tabControl1.GetTabRect(e.Index);
r.Offset(1, 1);
Brush TitleBrush = new SolidBrush(Color.Black);
Font f = this.Font;
string title = this.tabControl1.TabPages[e.Index].Text;
e.Graphics.DrawString(title, f, TitleBrush, new PointF(r.X, r.Y));
}
catch (Exception) { }
}
}


Viewing all articles
Browse latest Browse all 3

Latest Images