Jan 23, 2018 10:34 AM
(This post was last modified: Jan 23, 2018 10:37 AM by edin_.)
Hey everyone,
i have this tabcontrol from FireFox theme and i made some changes like resizing tabpages to fit width of tabcontrol as shown on image below but i cannot manage to disable those navigation buttons. Is there any way to hide/disable navigation buttons?
link to image
i have this tabcontrol from FireFox theme and i made some changes like resizing tabpages to fit width of tabcontrol as shown on image below but i cannot manage to disable those navigation buttons. Is there any way to hide/disable navigation buttons?
PHP Code
<?php
Class FirefoxSubTabControlSecond
Inherits TabControl
#Region " Private "
Private G As Graphics
Private TabRect As Rectangle
#End Region
#Region " Control "
Public Overrides ReadOnly Property DisplayRectangle As System.Drawing.Rectangle
Get
Dim rc As Rectangle = MyBase.DisplayRectangle
rc.Offset(-3, -1)
rc.Width += 6
rc.Height += 4
Return rc
End Get
End Property
Sub New()
DoubleBuffered = True
Alignment = TabAlignment.Top
Font = New Font("Segoe UI", 10)
End Sub
Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
SetStyle(ControlStyles.UserPaint, True)
Dim w As Double = Width
Dim items As Integer = TabPages.Count
ItemSize = New Size((w / items), 40)
'ItemSize = New Size(150, 40)
SizeMode = TabSizeMode.Fixed
End Sub
Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
MyBase.OnControlAdded(e)
Try
For i As Integer = 0 To TabPages.Count - 1
TabPages(i).BackColor = Color.FromArgb(255, 255, 255)
TabPages(i).ForeColor = Color.FromArgb(127, 150, 158)
TabPages(i).Font = New Font("Segoe UI", 10)
Next
Catch
End Try
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
G = e.Graphics
G.SmoothingMode = SmoothingMode.HighQuality
G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
MyBase.OnPaint(e)
G.Clear(Color.White)
For i As Integer = 0 To TabPages.Count - 1
TabRect = GetTabRect(i)
Dim FontColor As New Color
Dim titleX As Integer = (GetTabRect(i).Location.X + GetTabRect(i).Width / 2) - (G.MeasureString(TabPages(i).Text, Font).Width / 2)
Dim titleY As Integer = (GetTabRect(i).Location.Y + GetTabRect(i).Height / 2) - (G.MeasureString(TabPages(i).Text, Font).Height / 2)
If SelectedIndex = i Then
Using B As New SolidBrush(Color.FromArgb(253, 253, 253))
G.FillRectangle(B, New Rectangle(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2, GetTabRect(i).Width, GetTabRect(i).Height + 1))
End Using
FontColor = Color.FromArgb(77, 96, 101)
Else
FontColor = Color.FromArgb(127, 150, 158)
End If
Using p As New Pen(Color.FromArgb(235, 235, 235), 1)
G.DrawLine(p, New Point(TabRect.X + TabRect.Width - 3, TabRect.Y + TabRect.Height), New Point(TabRect.X + TabRect.Width - 3, TabRect.Y - 12))
End Using
G.DrawString(TabPages(i).Text, Font, New SolidBrush(FontColor), New Point(titleX, titleY))
Next
Using P As New Pen(Color.FromArgb(235, 235, 235), 1)
'TopMost
G.DrawLine(P, New Point(0, ItemSize.Height + 2), New Point(Width, ItemSize.Height + 2))
'Top
G.DrawLine(P, New Point(0, 0), New Point(Width, 0))
'Left
G.DrawLine(P, New Point(0, 0), New Point(0, Height))
'Bottom
G.DrawLine(P, New Point(0, Height - 1), New Point(Width, Height - 1))
'Right
G.DrawLine(P, New Point(Width - 1, 0), New Point(Width - 1, Height))
End Using
End Sub
#End Region
End Class



![[Image: narwinsig.gif]](https://image.ibb.co/jf6HBa/narwinsig.gif)