This tab control is created by Dev Components .
the tab control looks like this.
Create a new class and add the codes and build your project then you will see the tab control in your toolbox.
Codes :
Imports System.Drawing.Drawing2D
Class DotNetBarTabcontrol
Inherits TabControl
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
DoubleBuffered = True
SizeMode = TabSizeMode.Fixed
ItemSize = New Size(44, 136)
End Sub
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Alignment = TabAlignment.Left
End Sub
Function ToPen(ByVal color As Color) As Pen
Return New Pen(color)
End Function
Function ToBrush(ByVal color As Color) As Brush
Return New SolidBrush(color)
End Function
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim B As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(B)
Try : SelectedTab.BackColor = Color.White : Catch : End Try
G.Clear(Color.White)
G.FillRectangle(New SolidBrush(Color.FromArgb(246, 248, 252)), New Rectangle(0, 0, ItemSize.Height + 4, Height))
'G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(Width - 1, 0), New Point(Width - 1, Height - 1)) 'comment out to get rid of the borders
'G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(ItemSize.Height + 1, 0), New Point(Width - 1, 0)) 'comment out to get rid of the borders
'G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(ItemSize.Height + 3, Height - 1), New Point(Width - 1, Height - 1)) 'comment out to get rid of the borders
G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(ItemSize.Height + 3, 0), New Point(ItemSize.Height + 3, 999))
For i = 0 To TabCount - 1
If i = SelectedIndex Then
Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
Dim myBlend As New ColorBlend()
myBlend.Colors = {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240)}
myBlend.Positions = {0.0F, 0.5F, 1.0F}
Dim lgBrush As New LinearGradientBrush(x2, Color.Black, Color.Black, 90.0F)
lgBrush.InterpolationColors = myBlend
G.FillRectangle(lgBrush, x2)
G.DrawRectangle(New Pen(Color.FromArgb(170, 187, 204)), x2)
G.SmoothingMode = SmoothingMode.HighQuality
Dim p() As Point = {New Point(ItemSize.Height - 3, GetTabRect(i).Location.Y + 20), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 14), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 27)}
G.FillPolygon(Brushes.White, p)
G.DrawPolygon(New Pen(Color.FromArgb(170, 187, 204)), p)
If ImageList IsNot Nothing Then
Try
If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then
G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(x2.Location.X + 8, x2.Location.Y + 6))
G.DrawString(" " & TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
Else
G.DrawString(TabPages(i).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End If
Catch ex As Exception
G.DrawString(TabPages(i).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End Try
Else
G.DrawString(TabPages(i).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End If
G.DrawLine(New Pen(Color.FromArgb(200, 200, 250)), New Point(x2.Location.X - 1, x2.Location.Y - 1), New Point(x2.Location.X, x2.Location.Y))
G.DrawLine(New Pen(Color.FromArgb(200, 200, 250)), New Point(x2.Location.X - 1, x2.Bottom - 1), New Point(x2.Location.X, x2.Bottom))
Else
Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height + 1))
G.FillRectangle(New SolidBrush(Color.FromArgb(246, 248, 252)), x2)
G.DrawLine(New Pen(Color.FromArgb(170, 187, 204)), New Point(x2.Right, x2.Top), New Point(x2.Right, x2.Bottom))
If ImageList IsNot Nothing Then
Try
If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then
G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(x2.Location.X + 8, x2.Location.Y + 6))
G.DrawString(" " & TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
Else
G.DrawString(TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End If
Catch ex As Exception
G.DrawString(TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End Try
Else
G.DrawString(TabPages(i).Text, Font, Brushes.DimGray, x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End If
End If
Next
e.Graphics.DrawImage(B.Clone, 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class
If you're using earlier versions of vb.net you would get errors in these lines:
myBlend.Colors = {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240)} myBlend.Positions = {0.0F, 0.5F, 1.0F}
an Anonymous commenter gave a solution for this, replace those two lines of code with these :
myBlend.Colors = New Color() {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240)} myBlend.Positions = New Single() {0.0F, 0.5F, 1.0F}
Thank You
Work from anywhere on any device with a virtual cloud desktop by CloudDesktopOnline.com . For more hosted Microsoft applications such as Exchange, SharePoint, Dynamics CRM, Project Server and more, try Apps4Rent .
47 comments
The TabPage Buttons are not Clickabel (Click -> Code window) or could anyone fix that ?
Replythx
it was my fault, I have this component compared with the original's all Okay!
Replybut Thanks
greez Crusher
Hello Sir.. I got problem with this:
Replyhttp://i39.tinypic.com/34q6xdh.png
How to fix it?
If you are using an older version of visual studio/visual basic .net then you would get errors sometimes.
ReplyI don't know why it's not clickable for you
ReplyThis Rocks! Thanks
ReplyThanks for this.. :-) it works ^_^
ReplyVery nice.
ReplyThank you
I've got a problem with the two lines:
ReplymyBlend.Colors = {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232,
240), Color.FromArgb(232, 232, 240)}
myBlend.Positions = {0.0F, 0.5F, 1.0F}
the error is "Expression Expected" on the opening brace
I think you are using an older version of vb.net, this works with vb.net 2010 or higher.
ReplyI don't know how to change this code to vb.net 2008
ReplymyBlend.Colors = {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232,
240), Color.FromArgb(232, 232, 240)}
myBlend.Positions = {0.0F, 0.5F, 1.0F}
please help..
You cannot change this code to visual basic 2008, why not try visual basic 2010? or 2012?
ReplyHello can we add others controls to your tabcontrol like textbox, so everytime the we add a tabpage also come with the textbox inside each tab...
ReplyThank you!
Hello,
ReplyFor that look at other themes how textboxes are added and customize this on your own. I wish I could make it for you but unfortunately I can't think of doing any activities on my computer.
hi,
Replyhow to align the tabs horizontal?
Greetings
Hey,
ReplyI think theres a property for that.
Can you do that it's adjustable?
ReplyIf Option Strict On -> i have to put some extra Code:
ReplyDim cloneBitmap As Bitmap = CType(B.Clone, Bitmap)
e.Graphics.DrawImage(cloneBitmap, 0, 0)
It works fine!
THANK YOU
ReplyChange code like below for working in earlier version of .net
ReplymyBlend.Colors = New Color() {Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240), Color.FromArgb(232, 232, 240)}
myBlend.Positions = New Single() {0.0F, 0.5F, 1.0F}
Hey,
ReplyThank you so much..! I'll update the post.
Put New Color() in front of the first curly bracket and New Size() in front of the second set.
ReplyWhen I run the code the form is empty. Do I need to input tab control from the toolbox to the form ? thank you =)
ReplyThank you so much, i like this Tab Control.
Replyi don't know to apply those codes... I created a new class and paste the code... then a new form with tab from toolbox... when I run..no changes in my tab control... please help
ReplyAfter adding the codes to your class, debug your project and stop. Now check your toolbox for a new tool(It's not the old tabcontrol)
ReplyI create a new form1.vb ... and then I create a new class DotNetBarTabcontrol... then I pasted the codes.... then I create tab control in my form1.vb...
ReplyYes but not the usual tab control, check the top of the toolbox for a new tool.
Replycan you give us download?
Replywhat download? :)
Replywhat will make me trust this component cause the watermark component from this site i used introduced an error into my project and i did not have a backup i had to start again
ReplyWhat do you mean by watermark? I don't understand what you say.
ReplyThe designer could not be shown for this file because none of the classes within it can be designed. That's the error i get! Please help!
Replyno tab page click event for this tab control? please help. TIA
Replyworking. awesome
Replyplease please please provide more free controls
Thanx works great
ReplyVery nice, thanks....
Replythanks very much
ReplyPravin Savaliya
Very nice tab control thank you! I have one question though, how to change the color from blue to say gray or something
ReplyAi có Project không cho mình xin đi !
ReplyHello,
ReplyI have been using this custom tab control for some time. Very cool. I plenty of tab pages with tons of code behind each.
Recently the custom control disappeared from the toolbox and everything is gone.
Here is the error on the form main designer.
Could not find type 'WindowsApplication1.Custom_Tab_Control'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.
The Class is still there just the custom control is not in the toolbox even after compiling again.
Any advice would be greatly appreciated.
Thanks,
Russ
Why not take all of the phucking pop ups and shove where the sun dons't shine you phucking idiot
ReplyGood day sir, Sir how can i Run this code to vb ? I will copy it to a class then ?
ReplyMake a new class, delete the text in the class you created, paste the code from this example, save the project (Ctrl+Shift+S) and go to Build (in menu) and press Build. Then go to your toolbox and there will be an item named DotNetBarTabcontrol. Place it on your form like any other item
ReplyNice ;)
ReplyEs hora de esta replicas relojes Rolex Sky-Dweller revisión de fotos. No querÃa mantener a los chicos esperando demasiado tiempo para esto porque sé que los nuevos modelos de relojes Rolex réplica son siempre de gran interés desde el segundo dÃa Rolex lanza ellos. Bueno, la paciencia es clave en este caso e incluso si sé que la paciencia es una virtud difÃcil aquà confÃa en mà es para tu propio bien.
ReplyLa mejor parte es que por lo general vale la pena y si haces tu tarea bien y prestas suficiente atención acabas con una replicas rolex de buena calidad Rolex Sky-Dweller como la de mis fotos. Lo más importante es no pagar demasiado y conseguir un buen reloj Rolex falso que puede disfrutar durante mucho tiempo. Para esto usted tiene que poner algunas de las piezas del rompecabezas replicas omega juntas y emparejar la imagen final.
Best SAP Training and Placement Institute is CIITN. Contestant will learn according to current Industry trends by Certified and Industry Experts & SAP Training Institute in Noida. They Provide 100% placement Assistance.
ReplySAP Training Institute in Noida
sap training in noida
sap institute in noida
sap course in noida
best sap training institute in noida
Post a Comment
Note: Only a member of this blog may post a comment.