broadbent
asked on
Sliding windows?
I like the flat look of the Visual Studio environment, and have been trying to write something that allows 'panels' to dock against a side and particular to 'slide' in and out.
I've tried using the Windows API AnimateWindow, but it only works on forms.
So I tried writing a MDI form with the new forms sliding in and out of the blank space, but you get a window box around the blank area of the parent form.
Any ideas how this might be done?
I've tried using the Windows API AnimateWindow, but it only works on forms.
So I tried writing a MDI form with the new forms sliding in and out of the blank space, but you get a window box around the blank area of the parent form.
Any ideas how this might be done?
http://www.windowsforms.net/default.aspx?tabindex=6&tabid=47&ItemID=9&mid=142
ASKER
Doesn't help, because there is a whole solution written in C, and it is difficult to get to grips with it.
Can you at least point me to the area I need to be looking at.
Is this Windows API?
Is this a clever MDI without borders?
There seems to be a timer at work, but does this involve redraws?
Thanks again.
Thanks for your previous help.
Can you at least point me to the area I need to be looking at.
Is this Windows API?
Is this a clever MDI without borders?
There seems to be a timer at work, but does this involve redraws?
Thanks again.
Thanks for your previous help.
For the slide it is real easy:
Add a timer to your form
On the click method of a button (whatever) enable the timer
On the timer_tick method move your item in increments:
'Assumes that Panel1 is shifted to the left of the form edge
Dim XPos as Integer
XPos = Me.Left 'Set XPos to the left of the form
Panel1.Left += 2 'Move the panel to the right by 2
If Panel1.Left >= XPos Then Timer1.Enabled = False 'If the left edge of the panel hits the left edge of the form, turn the timer off.
The docking is a little more engaging, but can be done. You have to do a lot of checks. See this site: http://www.divil.co.uk/
Regards
Add a timer to your form
On the click method of a button (whatever) enable the timer
On the timer_tick method move your item in increments:
'Assumes that Panel1 is shifted to the left of the form edge
Dim XPos as Integer
XPos = Me.Left 'Set XPos to the left of the form
Panel1.Left += 2 'Move the panel to the right by 2
If Panel1.Left >= XPos Then Timer1.Enabled = False 'If the left edge of the panel hits the left edge of the form, turn the timer off.
The docking is a little more engaging, but can be done. You have to do a lot of checks. See this site: http://www.divil.co.uk/
Regards
ASKER
Sorry, but the form looks awful when moving.
Use a panel instead of a form...Also adjust the timer count and the increment. Depending on how you set it, the movement is smooth.
ASKER
I've been trying to do this without much success. Redrawing the controls etc. takes too long for it to work neatly. AnimateWindow API does it neatly, but it only works on forms.
Below is posted code from a test app I threw together. I was using hot keys (adding labels) to slide in/out the panel (in the window's generated code it was called "nicepanel1".
The form has two timers a panel and a few buttons. Look it over and see how the slide effect happens.
Imports SySWideHotKey.Components.H otKey
Public Class Form1
Inherits SySWideHotKey.Components.H otKey.HotK eyForm
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents NicePanel1 As PureComponents.NicePanel.N icePanel
Friend WithEvents TabControl1 As System.Windows.Forms.TabCo ntrol
Friend WithEvents TabPage1 As System.Windows.Forms.TabPa ge
Friend WithEvents TabPage2 As System.Windows.Forms.TabPa ge
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents Button1 As System.Windows.Forms.Butto n
Friend WithEvents Button2 As System.Windows.Forms.Butto n
Friend WithEvents Timer2 As System.Windows.Forms.Timer
Friend WithEvents lblRight As System.Windows.Forms.Label
Friend WithEvents lblLeft As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextB ox
Friend WithEvents Button3 As System.Windows.Forms.Butto n
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Cont ainer
Dim ContainerImage1 As PureComponents.NicePanel.C ontainerIm age = New PureComponents.NicePanel.C ontainerIm age
Dim resources As System.Resources.ResourceM anager = New System.Resources.ResourceM anager(Get Type(Form1 ))
Dim HeaderImage1 As PureComponents.NicePanel.H eaderImage = New PureComponents.NicePanel.H eaderImage
Dim HeaderImage2 As PureComponents.NicePanel.H eaderImage = New PureComponents.NicePanel.H eaderImage
Dim PanelStyle1 As PureComponents.NicePanel.P anelStyle = New PureComponents.NicePanel.P anelStyle
Dim ContainerStyle1 As PureComponents.NicePanel.C ontainerSt yle = New PureComponents.NicePanel.C ontainerSt yle
Dim PanelHeaderStyle1 As PureComponents.NicePanel.P anelHeader Style = New PureComponents.NicePanel.P anelHeader Style
Dim PanelHeaderStyle2 As PureComponents.NicePanel.P anelHeader Style = New PureComponents.NicePanel.P anelHeader Style
Me.NicePanel1 = New PureComponents.NicePanel.N icePanel
Me.lblLeft = New System.Windows.Forms.Label
Me.TabControl1 = New System.Windows.Forms.TabCo ntrol
Me.TabPage1 = New System.Windows.Forms.TabPa ge
Me.TabPage2 = New System.Windows.Forms.TabPa ge
Me.lblRight = New System.Windows.Forms.Label
Me.Timer1 = New System.Windows.Forms.Timer (Me.compon ents)
Me.Button1 = New System.Windows.Forms.Butto n
Me.Button2 = New System.Windows.Forms.Butto n
Me.Timer2 = New System.Windows.Forms.Timer (Me.compon ents)
Me.TextBox1 = New System.Windows.Forms.TextB ox
Me.Button3 = New System.Windows.Forms.Butto n
Me.NicePanel1.SuspendLayou t()
Me.TabControl1.SuspendLayo ut()
Me.SuspendLayout()
'
'NicePanel1
'
Me.NicePanel1.BackColor = System.Drawing.Color.Trans parent
ContainerImage1.Alignment = System.Drawing.ContentAlig nment.Midd leLeft
ContainerImage1.ClipArt = PureComponents.NicePanel.I mageClipAr t.None
ContainerImage1.Image = CType(resources.GetObject( "Container Image1.Ima ge"), System.Drawing.Image)
ContainerImage1.Size = PureComponents.NicePanel.C ontainerIm ageSize.Sm all
ContainerImage1.Transparen cy = 0
Me.NicePanel1.ContainerIma ge = ContainerImage1
Me.NicePanel1.ContextMenuB utton = False
Me.NicePanel1.Controls.Add (Me.lblLef t)
Me.NicePanel1.Controls.Add (Me.TabCon trol1)
Me.NicePanel1.Controls.Add (Me.lblRig ht)
HeaderImage1.ClipArt = PureComponents.NicePanel.I mageClipAr t.None
HeaderImage1.Image = Nothing
Me.NicePanel1.FooterImage = HeaderImage1
Me.NicePanel1.FooterText = "Control Panel"
Me.NicePanel1.ForeColor = System.Drawing.Color.Black
HeaderImage2.ClipArt = PureComponents.NicePanel.I mageClipAr t.ControlP anel
HeaderImage2.Image = Nothing
Me.NicePanel1.HeaderImage = HeaderImage2
Me.NicePanel1.HeaderText = "UNWD Viewer"
Me.NicePanel1.IsExpanded = True
Me.NicePanel1.Location = New System.Drawing.Point(0, 0)
Me.NicePanel1.MouseMoveTar get = PureComponents.NicePanel.M ouseMoveTa rget.Self
Me.NicePanel1.Name = "NicePanel1"
Me.NicePanel1.OriginalFoot erVisible = True
Me.NicePanel1.OriginalHeig ht = 0
Me.NicePanel1.Size = New System.Drawing.Size(328, 392)
ContainerStyle1.BackColor = System.Drawing.Color.White Smoke
ContainerStyle1.BaseColor = System.Drawing.Color.Trans parent
ContainerStyle1.BorderColo r = System.Drawing.Color.Gray
ContainerStyle1.BorderStyl e = PureComponents.NicePanel.B orderStyle .Double
ContainerStyle1.CaptionAli gn = PureComponents.NicePanel.C aptionAlig n.Left
ContainerStyle1.FadeColor = System.Drawing.Color.Gains boro
ContainerStyle1.FillStyle = PureComponents.NicePanel.F illStyle.D iagonalFor ward
ContainerStyle1.FlashItemB ackColor = System.Drawing.Color.Red
ContainerStyle1.FocusItemB ackColor = System.Drawing.Color.FromA rgb(CType( 192, Byte), CType(255, Byte), CType(255, Byte))
ContainerStyle1.Font = New System.Drawing.Font("Segoe UI", 7.8!, System.Drawing.FontStyle.R egular, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
ContainerStyle1.ForeColor = System.Drawing.Color.Black
ContainerStyle1.Shape = PureComponents.NicePanel.S hape.Round ed
PanelStyle1.ContainerStyle = ContainerStyle1
PanelHeaderStyle1.BackColo r = System.Drawing.Color.Gray
PanelHeaderStyle1.ButtonCo lor = System.Drawing.Color.FromA rgb(CType( 172, Byte), CType(191, Byte), CType(227, Byte))
PanelHeaderStyle1.FadeColo r = System.Drawing.Color.Light Gray
PanelHeaderStyle1.FillStyl e = PureComponents.NicePanel.F illStyle.H orizontalF ading
PanelHeaderStyle1.FlashBac kColor = System.Drawing.Color.FromA rgb(CType( 243, Byte), CType(122, Byte), CType(1, Byte))
PanelHeaderStyle1.FlashFad eColor = System.Drawing.Color.FromA rgb(CType( 255, Byte), CType(215, Byte), CType(159, Byte))
PanelHeaderStyle1.FlashFor eColor = System.Drawing.Color.White
PanelHeaderStyle1.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!)
PanelHeaderStyle1.ForeColo r = System.Drawing.Color.Gains boro
PanelHeaderStyle1.Size = PureComponents.NicePanel.P anelHeader Size.Small
PanelStyle1.FooterStyle = PanelHeaderStyle1
PanelHeaderStyle2.BackColo r = System.Drawing.Color.Silve r
PanelHeaderStyle2.ButtonCo lor = System.Drawing.Color.Gains boro
PanelHeaderStyle2.FadeColo r = System.Drawing.Color.FromA rgb(CType( 51, Byte), CType(51, Byte), CType(51, Byte))
PanelHeaderStyle2.FillStyl e = PureComponents.NicePanel.F illStyle.V erticalFad ing
PanelHeaderStyle2.FlashBac kColor = System.Drawing.Color.FromA rgb(CType( 243, Byte), CType(122, Byte), CType(1, Byte))
PanelHeaderStyle2.FlashFad eColor = System.Drawing.Color.FromA rgb(CType( 255, Byte), CType(215, Byte), CType(159, Byte))
PanelHeaderStyle2.FlashFor eColor = System.Drawing.Color.White
PanelHeaderStyle2.Font = New System.Drawing.Font("Micro soft Sans Serif", 9.75!, System.Drawing.FontStyle.B old)
PanelHeaderStyle2.ForeColo r = System.Drawing.Color.White Smoke
PanelHeaderStyle2.Size = PureComponents.NicePanel.P anelHeader Size.Mediu m
PanelStyle1.HeaderStyle = PanelHeaderStyle2
Me.NicePanel1.Style = PanelStyle1
Me.NicePanel1.TabIndex = 3
'
'lblLeft
'
Me.lblLeft.Anchor = CType(((System.Windows.For ms.AnchorS tyles.Top Or System.Windows.Forms.Ancho rStyles.Bo ttom) _
Or System.Windows.Forms.Ancho rStyles.Le ft), System.Windows.Forms.Ancho rStyles)
Me.lblLeft.Image = CType(resources.GetObject( "lblLeft.I mage"), System.Drawing.Image)
Me.lblLeft.Location = New System.Drawing.Point(0, 136)
Me.lblLeft.Name = "lblLeft"
Me.lblLeft.Size = New System.Drawing.Size(16, 120)
Me.lblLeft.TabIndex = 8
'
'TabControl1
'
Me.TabControl1.Anchor = CType((((System.Windows.Fo rms.Anchor Styles.Top Or System.Windows.Forms.Ancho rStyles.Bo ttom) _
Or System.Windows.Forms.Ancho rStyles.Le ft) _
Or System.Windows.Forms.Ancho rStyles.Ri ght), System.Windows.Forms.Ancho rStyles)
Me.TabControl1.Controls.Ad d(Me.TabPa ge1)
Me.TabControl1.Controls.Ad d(Me.TabPa ge2)
Me.TabControl1.HotTrack = True
Me.TabControl1.Location = New System.Drawing.Point(16, 48)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedInd ex = 0
Me.TabControl1.Size = New System.Drawing.Size(296, 320)
Me.TabControl1.TabIndex = 2
'
'TabPage1
'
Me.TabPage1.BackColor = System.Drawing.Color.White Smoke
Me.TabPage1.ForeColor = System.Drawing.Color.Trans parent
Me.TabPage1.Location = New System.Drawing.Point(4, 27)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(288, 289)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "TabPage1"
'
'TabPage2
'
Me.TabPage2.Location = New System.Drawing.Point(4, 25)
Me.TabPage2.Name = "TabPage2"
Me.TabPage2.Size = New System.Drawing.Size(288, 291)
Me.TabPage2.TabIndex = 1
Me.TabPage2.Text = "TabPage2"
Me.TabPage2.Visible = False
'
'lblRight
'
Me.lblRight.Anchor = CType(((System.Windows.For ms.AnchorS tyles.Top Or System.Windows.Forms.Ancho rStyles.Bo ttom) _
Or System.Windows.Forms.Ancho rStyles.Ri ght), System.Windows.Forms.Ancho rStyles)
Me.lblRight.Image = CType(resources.GetObject( "lblRight. Image"), System.Drawing.Image)
Me.lblRight.Location = New System.Drawing.Point(312, 136)
Me.lblRight.Name = "lblRight"
Me.lblRight.Size = New System.Drawing.Size(16, 120)
Me.lblRight.TabIndex = 7
'
'Timer1
'
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(424, 312)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(80, 32)
Me.Button1.TabIndex = 4
Me.Button1.Text = "Button1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(424, 360)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(80, 32)
Me.Button2.TabIndex = 5
Me.Button2.Text = "Button2"
'
'Timer2
'
Me.Timer2.Interval = 10
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(392, 40)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(280, 248)
Me.TextBox1.TabIndex = 6
Me.TextBox1.Text = "TextBox1"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(424, 408)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 7
Me.Button3.Text = "Button3"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 18)
Me.ClientSize = New System.Drawing.Size(720, 496)
Me.Controls.Add(Me.Button3 )
Me.Controls.Add(Me.TextBox 1)
Me.Controls.Add(Me.Button2 )
Me.Controls.Add(Me.Button1 )
Me.Controls.Add(Me.NicePan el1)
Me.Font = New System.Drawing.Font("Segoe UI", 7.8!, System.Drawing.FontStyle.R egular, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.Name = "Form1"
Me.Text = "Form1"
Me.NicePanel1.ResumeLayout (False)
Me.TabControl1.ResumeLayou t(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim XPos As Integer, YPos As Integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
XPos = NicePanel1.Left
Panel1.Left = -400
Timer1.Interval = 1
' add an event handler for hot key pressed (or could just use Handles)
AddHandler Me.HotKeyPressed, AddressOf hotKey_Pressed
' set the hotkey:
Dim htk As HotKey = New HotKey("Show Panel", Keys.PageUp, HotKey.HotKeyModifiers.MOD _CONTROL)
Me.HotKeys.Add(htk)
Dim htk2 As HotKey = New HotKey("Hide Panel", Keys.PageDown, HotKey.HotKeyModifiers.MOD _CONTROL)
Me.HotKeys.Add(htk2)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Panel1.Left += 2
If Panel1.Left >= XPos Then Timer1.Enabled = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer2.Enabled = True
End Sub
Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Panel1.Left -= 2
If Panel1.Left = -400 Then Timer2.Enabled = False
End Sub
Private Sub hotKey_Pressed(ByVal sender As System.Object, ByVal e As HotKeyPressedEventArgs)
If e.HotKey.Name Is "Show Panel" Then
If Timer2.Enabled = False Then
Timer1.Enabled = True
Else
Timer2.Enabled = False
Timer1.Enabled = True
End If
End If
If e.HotKey.Name Is "Hide Panel" Then
If Timer1.Enabled = False Then
Timer2.Enabled = True
Else
Timer1.Enabled = False
Timer2.Enabled = True
End If
End If
End Sub
Private Sub lblLeft_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLeft.Click
End Sub
Private Sub lblRight_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblRight.Click
If Timer1.Enabled = False Then
Timer2.Enabled = True
Else
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.Mouse EventArgs) Handles Panel1.MouseUp
If Panel1.Left + 25 > Me.Width Then
Panel1.Left = Me.Width - Panel1.Width + 5
Exit Sub
End If
If Panel1.Left < Me.Left Then
Panel1.Left = Me.Left
Exit Sub
End If
If Panel1.Top < Me.Bottom Then
Panel1.Top = Me.Bottom - Panel1.Height
Exit Sub
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class
The form has two timers a panel and a few buttons. Look it over and see how the slide effect happens.
Imports SySWideHotKey.Components.H
Public Class Form1
Inherits SySWideHotKey.Components.H
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents NicePanel1 As PureComponents.NicePanel.N
Friend WithEvents TabControl1 As System.Windows.Forms.TabCo
Friend WithEvents TabPage1 As System.Windows.Forms.TabPa
Friend WithEvents TabPage2 As System.Windows.Forms.TabPa
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents Button1 As System.Windows.Forms.Butto
Friend WithEvents Button2 As System.Windows.Forms.Butto
Friend WithEvents Timer2 As System.Windows.Forms.Timer
Friend WithEvents lblRight As System.Windows.Forms.Label
Friend WithEvents lblLeft As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextB
Friend WithEvents Button3 As System.Windows.Forms.Butto
<System.Diagnostics.Debugg
Me.components = New System.ComponentModel.Cont
Dim ContainerImage1 As PureComponents.NicePanel.C
Dim resources As System.Resources.ResourceM
Dim HeaderImage1 As PureComponents.NicePanel.H
Dim HeaderImage2 As PureComponents.NicePanel.H
Dim PanelStyle1 As PureComponents.NicePanel.P
Dim ContainerStyle1 As PureComponents.NicePanel.C
Dim PanelHeaderStyle1 As PureComponents.NicePanel.P
Dim PanelHeaderStyle2 As PureComponents.NicePanel.P
Me.NicePanel1 = New PureComponents.NicePanel.N
Me.lblLeft = New System.Windows.Forms.Label
Me.TabControl1 = New System.Windows.Forms.TabCo
Me.TabPage1 = New System.Windows.Forms.TabPa
Me.TabPage2 = New System.Windows.Forms.TabPa
Me.lblRight = New System.Windows.Forms.Label
Me.Timer1 = New System.Windows.Forms.Timer
Me.Button1 = New System.Windows.Forms.Butto
Me.Button2 = New System.Windows.Forms.Butto
Me.Timer2 = New System.Windows.Forms.Timer
Me.TextBox1 = New System.Windows.Forms.TextB
Me.Button3 = New System.Windows.Forms.Butto
Me.NicePanel1.SuspendLayou
Me.TabControl1.SuspendLayo
Me.SuspendLayout()
'
'NicePanel1
'
Me.NicePanel1.BackColor = System.Drawing.Color.Trans
ContainerImage1.Alignment = System.Drawing.ContentAlig
ContainerImage1.ClipArt = PureComponents.NicePanel.I
ContainerImage1.Image = CType(resources.GetObject(
ContainerImage1.Size = PureComponents.NicePanel.C
ContainerImage1.Transparen
Me.NicePanel1.ContainerIma
Me.NicePanel1.ContextMenuB
Me.NicePanel1.Controls.Add
Me.NicePanel1.Controls.Add
Me.NicePanel1.Controls.Add
HeaderImage1.ClipArt = PureComponents.NicePanel.I
HeaderImage1.Image = Nothing
Me.NicePanel1.FooterImage = HeaderImage1
Me.NicePanel1.FooterText = "Control Panel"
Me.NicePanel1.ForeColor = System.Drawing.Color.Black
HeaderImage2.ClipArt = PureComponents.NicePanel.I
HeaderImage2.Image = Nothing
Me.NicePanel1.HeaderImage = HeaderImage2
Me.NicePanel1.HeaderText = "UNWD Viewer"
Me.NicePanel1.IsExpanded = True
Me.NicePanel1.Location = New System.Drawing.Point(0, 0)
Me.NicePanel1.MouseMoveTar
Me.NicePanel1.Name = "NicePanel1"
Me.NicePanel1.OriginalFoot
Me.NicePanel1.OriginalHeig
Me.NicePanel1.Size = New System.Drawing.Size(328, 392)
ContainerStyle1.BackColor = System.Drawing.Color.White
ContainerStyle1.BaseColor = System.Drawing.Color.Trans
ContainerStyle1.BorderColo
ContainerStyle1.BorderStyl
ContainerStyle1.CaptionAli
ContainerStyle1.FadeColor = System.Drawing.Color.Gains
ContainerStyle1.FillStyle = PureComponents.NicePanel.F
ContainerStyle1.FlashItemB
ContainerStyle1.FocusItemB
ContainerStyle1.Font = New System.Drawing.Font("Segoe
ContainerStyle1.ForeColor = System.Drawing.Color.Black
ContainerStyle1.Shape = PureComponents.NicePanel.S
PanelStyle1.ContainerStyle
PanelHeaderStyle1.BackColo
PanelHeaderStyle1.ButtonCo
PanelHeaderStyle1.FadeColo
PanelHeaderStyle1.FillStyl
PanelHeaderStyle1.FlashBac
PanelHeaderStyle1.FlashFad
PanelHeaderStyle1.FlashFor
PanelHeaderStyle1.Font = New System.Drawing.Font("Micro
PanelHeaderStyle1.ForeColo
PanelHeaderStyle1.Size = PureComponents.NicePanel.P
PanelStyle1.FooterStyle = PanelHeaderStyle1
PanelHeaderStyle2.BackColo
PanelHeaderStyle2.ButtonCo
PanelHeaderStyle2.FadeColo
PanelHeaderStyle2.FillStyl
PanelHeaderStyle2.FlashBac
PanelHeaderStyle2.FlashFad
PanelHeaderStyle2.FlashFor
PanelHeaderStyle2.Font = New System.Drawing.Font("Micro
PanelHeaderStyle2.ForeColo
PanelHeaderStyle2.Size = PureComponents.NicePanel.P
PanelStyle1.HeaderStyle = PanelHeaderStyle2
Me.NicePanel1.Style = PanelStyle1
Me.NicePanel1.TabIndex = 3
'
'lblLeft
'
Me.lblLeft.Anchor = CType(((System.Windows.For
Or System.Windows.Forms.Ancho
Me.lblLeft.Image = CType(resources.GetObject(
Me.lblLeft.Location = New System.Drawing.Point(0, 136)
Me.lblLeft.Name = "lblLeft"
Me.lblLeft.Size = New System.Drawing.Size(16, 120)
Me.lblLeft.TabIndex = 8
'
'TabControl1
'
Me.TabControl1.Anchor = CType((((System.Windows.Fo
Or System.Windows.Forms.Ancho
Or System.Windows.Forms.Ancho
Me.TabControl1.Controls.Ad
Me.TabControl1.Controls.Ad
Me.TabControl1.HotTrack = True
Me.TabControl1.Location = New System.Drawing.Point(16, 48)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedInd
Me.TabControl1.Size = New System.Drawing.Size(296, 320)
Me.TabControl1.TabIndex = 2
'
'TabPage1
'
Me.TabPage1.BackColor = System.Drawing.Color.White
Me.TabPage1.ForeColor = System.Drawing.Color.Trans
Me.TabPage1.Location = New System.Drawing.Point(4, 27)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(288, 289)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "TabPage1"
'
'TabPage2
'
Me.TabPage2.Location = New System.Drawing.Point(4, 25)
Me.TabPage2.Name = "TabPage2"
Me.TabPage2.Size = New System.Drawing.Size(288, 291)
Me.TabPage2.TabIndex = 1
Me.TabPage2.Text = "TabPage2"
Me.TabPage2.Visible = False
'
'lblRight
'
Me.lblRight.Anchor = CType(((System.Windows.For
Or System.Windows.Forms.Ancho
Me.lblRight.Image = CType(resources.GetObject(
Me.lblRight.Location = New System.Drawing.Point(312, 136)
Me.lblRight.Name = "lblRight"
Me.lblRight.Size = New System.Drawing.Size(16, 120)
Me.lblRight.TabIndex = 7
'
'Timer1
'
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(424, 312)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(80, 32)
Me.Button1.TabIndex = 4
Me.Button1.Text = "Button1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(424, 360)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(80, 32)
Me.Button2.TabIndex = 5
Me.Button2.Text = "Button2"
'
'Timer2
'
Me.Timer2.Interval = 10
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(392, 40)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(280, 248)
Me.TextBox1.TabIndex = 6
Me.TextBox1.Text = "TextBox1"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(424, 408)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 7
Me.Button3.Text = "Button3"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 18)
Me.ClientSize = New System.Drawing.Size(720, 496)
Me.Controls.Add(Me.Button3
Me.Controls.Add(Me.TextBox
Me.Controls.Add(Me.Button2
Me.Controls.Add(Me.Button1
Me.Controls.Add(Me.NicePan
Me.Font = New System.Drawing.Font("Segoe
Me.Name = "Form1"
Me.Text = "Form1"
Me.NicePanel1.ResumeLayout
Me.TabControl1.ResumeLayou
Me.ResumeLayout(False)
End Sub
#End Region
Dim XPos As Integer, YPos As Integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
XPos = NicePanel1.Left
Panel1.Left = -400
Timer1.Interval = 1
' add an event handler for hot key pressed (or could just use Handles)
AddHandler Me.HotKeyPressed, AddressOf hotKey_Pressed
' set the hotkey:
Dim htk As HotKey = New HotKey("Show Panel", Keys.PageUp, HotKey.HotKeyModifiers.MOD
Me.HotKeys.Add(htk)
Dim htk2 As HotKey = New HotKey("Hide Panel", Keys.PageDown, HotKey.HotKeyModifiers.MOD
Me.HotKeys.Add(htk2)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Panel1.Left += 2
If Panel1.Left >= XPos Then Timer1.Enabled = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer2.Enabled = True
End Sub
Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Panel1.Left -= 2
If Panel1.Left = -400 Then Timer2.Enabled = False
End Sub
Private Sub hotKey_Pressed(ByVal sender As System.Object, ByVal e As HotKeyPressedEventArgs)
If e.HotKey.Name Is "Show Panel" Then
If Timer2.Enabled = False Then
Timer1.Enabled = True
Else
Timer2.Enabled = False
Timer1.Enabled = True
End If
End If
If e.HotKey.Name Is "Hide Panel" Then
If Timer1.Enabled = False Then
Timer2.Enabled = True
Else
Timer1.Enabled = False
Timer2.Enabled = True
End If
End If
End Sub
Private Sub lblLeft_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLeft.Click
End Sub
Private Sub lblRight_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblRight.Click
If Timer1.Enabled = False Then
Timer2.Enabled = True
Else
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.Mouse
If Panel1.Left + 25 > Me.Width Then
Panel1.Left = Me.Width - Panel1.Width + 5
Exit Sub
End If
If Panel1.Left < Me.Left Then
Panel1.Left = Me.Left
Exit Sub
End If
If Panel1.Top < Me.Bottom Then
Panel1.Top = Me.Bottom - Panel1.Height
Exit Sub
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class
ASKER
what's Imports SySWideHotKey.Components.H otKey?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works fine on simple forms, but where forms need a lot of repainting???