![]() |
|
Anim TabControl Class - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: Anim TabControl Class (/Thread-Anim-TabControl-Class) Pages:
1
2
|
Anim TabControl Class - barukoru - 08-15-2013 Code: Public Class AnimTab
Inherits TabControl
Dim OldIndex As Integer
Private _Speed As Integer = 9
Property Speed As Integer
Get
Return _Speed
End Get
Set(ByVal value As Integer)
If value > 20 Or value < -20 Then
MsgBox("Speed needs to be in between -20 and 20.")
Else
_Speed = value
End If
End Set
End Property
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw, True)
End Sub
Sub DoAnimationScrollLeft(ByVal Control1 As Control, ByVal Control2 As Control)
Dim G As Graphics = Control1.CreateGraphics()
Dim P1 As New Bitmap(Control1.Width, Control1.Height)
Dim P2 As New Bitmap(Control2.Width, Control2.Height)
Control1.DrawToBitmap(P1, New Rectangle(0, 0, Control1.Width, Control1.Height))
Control2.DrawToBitmap(P2, New Rectangle(0, 0, Control2.Width, Control2.Height))
For Each c As Control In Control1.Controls
c.Hide()
Next
Dim Slide As Integer = Control1.Width - (Control1.Width Mod _Speed)
Dim a As Integer
For a = 0 To Slide Step _Speed
G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
G.DrawImage(P2, New Rectangle(a - Control2.Width, 0, Control2.Width, Control2.Height))
Next
a = Control1.Width
G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
G.DrawImage(P2, New Rectangle(a - Control2.Width, 0, Control2.Width, Control2.Height))
SelectedTab = Control2
For Each c As Control In Control2.Controls
c.Show()
Next
For Each c As Control In Control1.Controls
c.Show()
Next
End Sub
Protected Overrides Sub OnSelecting(ByVal e As System.Windows.Forms.TabControlCancelEventArgs)
If OldIndex < e.TabPageIndex Then
DoAnimationScrollRight(TabPages(OldIndex), TabPages(e.TabPageIndex))
Else
DoAnimationScrollLeft(TabPages(OldIndex), TabPages(e.TabPageIndex))
End If
End Sub
Protected Overrides Sub OnDeselecting(ByVal e As System.Windows.Forms.TabControlCancelEventArgs)
OldIndex = e.TabPageIndex
End Sub
Sub DoAnimationScrollRight(ByVal Control1 As Control, ByVal Control2 As Control)
Dim G As Graphics = Control1.CreateGraphics()
Dim P1 As New Bitmap(Control1.Width, Control1.Height)
Dim P2 As New Bitmap(Control2.Width, Control2.Height)
Control1.DrawToBitmap(P1, New Rectangle(0, 0, Control1.Width, Control1.Height))
Control2.DrawToBitmap(P2, New Rectangle(0, 0, Control2.Width, Control2.Height))
For Each c As Control In Control1.Controls
c.Hide()
Next
Dim Slide As Integer = Control1.Width - (Control1.Width Mod _Speed)
Dim a As Integer
For a = 0 To -Slide Step -_Speed
G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
G.DrawImage(P2, New Rectangle(a + Control2.Width, 0, Control2.Width, Control2.Height))
Next
a = Control1.Width
G.DrawImage(P1, New Rectangle(a, 0, Control1.Width, Control1.Height))
G.DrawImage(P2, New Rectangle(a + Control2.Width, 0, Control2.Width, Control2.Height))
SelectedTab = Control2
For Each c As Control In Control2.Controls
c.Show()
Next
For Each c As Control In Control1.Controls
c.Show()
Next
End Sub
End ClassRE: Anim TabControl Class - F1L15K0 - 09-01-2013 put some pictures man! just a suggestion. RE: Anim TabControl Class - GreyPhantom - 10-28-2013 Nothing special with this class. RE: Anim TabControl Class - GreyPhantom - 10-28-2013 Nothing special with this class. RE: Anim TabControl Class - GreyPhantom - 10-28-2013 Nothing special with this class. RE: Anim TabControl Class - GreyPhantom - 10-28-2013 Nothing special with this class. RE: Anim TabControl Class - barukoru - 10-28-2013 Code: Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each tc In {AnimTab1}
With tc
.SuspendLayout()
.SizeMode = TabSizeMode.Fixed
.ItemSize = New Size(0, 1)
.Appearance = TabAppearance.Buttons
.ResumeLayout()
End With
Next
End Sub
Public Class TabcontrolWithoutTabs
Inherits TabControl
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = &H1328 Then
m.Result = CType(1, IntPtr)
Else
MyBase.WndProc(m)
End If
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AnimTab1.SelectedIndex = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AnimTab1.SelectedIndex = 1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AnimTab1.SelectedIndex = 2
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AnimTab1.SelectedIndex = 3
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
AnimTab1.SelectedIndex = 4
End Sub
End ClassRE: Anim TabControl Class - barukoru - 10-28-2013 Code: Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each tc In {AnimTab1}
With tc
.SuspendLayout()
.SizeMode = TabSizeMode.Fixed
.ItemSize = New Size(0, 1)
.Appearance = TabAppearance.Buttons
.ResumeLayout()
End With
Next
End Sub
Public Class TabcontrolWithoutTabs
Inherits TabControl
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = &H1328 Then
m.Result = CType(1, IntPtr)
Else
MyBase.WndProc(m)
End If
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AnimTab1.SelectedIndex = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AnimTab1.SelectedIndex = 1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AnimTab1.SelectedIndex = 2
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AnimTab1.SelectedIndex = 3
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
AnimTab1.SelectedIndex = 4
End Sub
End ClassRE: Anim TabControl Class - barukoru - 10-28-2013 Code: Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each tc In {AnimTab1}
With tc
.SuspendLayout()
.SizeMode = TabSizeMode.Fixed
.ItemSize = New Size(0, 1)
.Appearance = TabAppearance.Buttons
.ResumeLayout()
End With
Next
End Sub
Public Class TabcontrolWithoutTabs
Inherits TabControl
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = &H1328 Then
m.Result = CType(1, IntPtr)
Else
MyBase.WndProc(m)
End If
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AnimTab1.SelectedIndex = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AnimTab1.SelectedIndex = 1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AnimTab1.SelectedIndex = 2
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AnimTab1.SelectedIndex = 3
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
AnimTab1.SelectedIndex = 4
End Sub
End ClassRE: Anim TabControl Class - barukoru - 10-28-2013 Code: Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each tc In {AnimTab1}
With tc
.SuspendLayout()
.SizeMode = TabSizeMode.Fixed
.ItemSize = New Size(0, 1)
.Appearance = TabAppearance.Buttons
.ResumeLayout()
End With
Next
End Sub
Public Class TabcontrolWithoutTabs
Inherits TabControl
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = &H1328 Then
m.Result = CType(1, IntPtr)
Else
MyBase.WndProc(m)
End If
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AnimTab1.SelectedIndex = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AnimTab1.SelectedIndex = 1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AnimTab1.SelectedIndex = 2
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AnimTab1.SelectedIndex = 3
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
AnimTab1.SelectedIndex = 4
End Sub
End Class |