|
-
Jun 8th, 2007, 02:22 AM
#1
[2005] Panel roll up/down ideas
Hi All,
I have created a few corner-rounded gradient panels that replicate the XP 'MyComputer' (left hand menu items) theme.
I can currently click on the panel title (a Label) and the panel retracts up to the bottom of the Label. No problem here except I would like it to progressively (scroll) shrink up (and down if re-clicked) as the panels in the XP theame does.
I guess I could use a Timer, and reduce the .Height property but I was curious if there is a better idea someone has come up with 
Cheers 'n' Beers,
Last edited by Bruce Fox; Jun 8th, 2007 at 04:48 AM.
Reason: Corrected the .Top property to .Height - being the property in question :)
-
Jun 8th, 2007, 03:02 AM
#2
Hyperactive Member
Re: [2005] Panel roll up/down ideas
Just a guess but maybe try a loop and decrease the height every loop.
Prefix has no suffix, but suffix has a prefix.
-
Jun 8th, 2007, 03:10 AM
#3
Re: [2005] Panel roll up/down ideas
Hi Troy,
Yep, thats another option. But I would pause during that loop so it takes about 0.5 sec to roll up etc.
-
Jun 8th, 2007, 04:28 AM
#4
Re: [2005] Panel roll up/down ideas
Ok, this seems to work. I would appreciate feedback/criticism etc.... 
vb Code:
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
' Note: The second Parameter could (should) be captured at Form_Load in a varable for example
Roll_Panel(Panel1, 100, Label1.Height, 1)
End Sub
Private Sub Roll_Panel(ByRef pnl As Panel, ByVal intOriginalPanelHeight As Integer, ByVal intLabelHeight As Integer, ByVal intDelay As Integer)
If pnl.Height <> intLabelHeight Then
Do Until pnl.Height <= intLabelHeight
pnl.Height -= 1
Threading.Thread.Sleep(intDelay)
pnl.Refresh()
Loop
Else
Do Until pnl.Height >= intOriginalPanelHeight
pnl.Height += 1
Threading.Thread.Sleep(intDelay)
pnl.Refresh()
Loop
End If
End Sub
Last edited by Bruce Fox; Jun 8th, 2007 at 04:38 AM.
-
Jun 8th, 2007, 01:27 PM
#5
Hyperactive Member
Re: [2005] Panel roll up/down ideas
The main problem I see is that you are telling your UI thread to sleep. This may not be an issue if the delay is low enough, though.
Instead of using <= and >= just use =, since your increment (or decrement) is only one pixel.
Another thought is since you are sleeping for 1 millisecond and the panel is only 100 pixels high, this would mean it would take 100 milliseconds to complete. If it takes longer than this then your code is slowing down. It is not bad that your code slows the process, but on a faster computer the same process might take less time.
Those are just thoughts.
Prefix has no suffix, but suffix has a prefix.
-
Jun 8th, 2007, 01:37 PM
#6
Re: [2005] Panel roll up/down ideas
I don’t see why you don’t want to use Timer component. The problem with the current code is that you use Thread.Sleep in the same thread so your app is being frozen during that time. But Timer is a separate thread so it does a better performance. Bottom of the line they both do the same.
-
Jun 8th, 2007, 02:29 PM
#7
Re: [2005] Panel roll up/down ideas
 Originally Posted by Bruce Fox
Ok, this seems to work. I would appreciate feedback/criticism etc....
vb Code:
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
' Note: The second Parameter could (should) be captured at Form_Load in a varable for example
Roll_Panel(Panel1, 100, Label1.Height, 1)
End Sub
Private Sub Roll_Panel(ByRef pnl As Panel, ByVal intOriginalPanelHeight As Integer, ByVal intLabelHeight As Integer, ByVal intDelay As Integer)
If pnl.Height <> intLabelHeight Then
Do Until pnl.Height <= intLabelHeight
pnl.Height -= 1
Threading.Thread.Sleep(intDelay)
pnl.Refresh()
Loop
Else
Do Until pnl.Height >= intOriginalPanelHeight
pnl.Height += 1
Threading.Thread.Sleep(intDelay)
pnl.Refresh()
Loop
End If
End Sub
If you want to use this method, you'd need to modify it to run in a thread, so the application doesnt look "frozen" during the sleeping.
-
Jun 9th, 2007, 03:22 AM
#8
Re: [2005] Panel roll up/down ideas
Thanks for the replies guys.
The time it takes is small, and the UI freeze is negligible in this case - However, there is room for improvement.
VBDT, I may try a Timer as a different method too - will be good to compare.
At least using a Timer will also allow use on a different machine with different specs.
I will remove the <> as I was experimenting with values. They can go as it's one pixel as mentioned.
Thanks again all for your input.
-
Jun 9th, 2007, 05:01 AM
#9
Re: [2005] Panel roll up/down ideas
Sup Bruce! Long time no see.
I have done this already and ran into an issue with using a timer. You accidentally double click or click again before the "animation scroll" is completed it will queue the click and look stupid lol.
Have you tried searching the forums for my threads on my XP Nav Panel control?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 9th, 2007, 08:06 AM
#10
Re: [2005] Panel roll up/down ideas
Hey Rob,
I emailed you a about four weeks ago - not sure if it got thru I used my work email.
I haven't looked for that Nav Panel, but will now tho.
I remember you did something like this a few years back, and I did find some classes that helped.
I wasthinking of a timer, and a flag that would prevent any additional operations. Never the less, I will look for your Nav Panel.
Hope all is well your way
-
Jun 9th, 2007, 12:20 PM
#11
Re: [2005] Panel roll up/down ideas
Thanks, things are ok and hope they are good with you as well. Didnt get the email.
I just remembered that I had a performance issue too because of resizing the panel. Not just one panel but when I had multiple panels. Say you collapsed the top one, well when you resize it you have to move the other ones up like it works in XP. I had too many steps in the timer resizing it by 4-8 pizels at a time. Best scenerio is to resize it by 1/2-1/3 steps so its allot less intense.
Using a boolean flag to make a click will work to prevent wueueing of clicks I think.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 10th, 2007, 03:03 AM
#12
-
Jun 10th, 2007, 03:58 AM
#13
Re: [2005] Panel roll up/down ideas
Nope, but I heard something about some minor issues with it.
Have you looked at vbaccelerator's site where they have a good similar XP nav control?
I started out doing what your doing with a grouping of controls and then I found I was going to need it on other forms so I figured it would be worht creating the UC. But little did I know how deep I would get into it
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 10th, 2007, 06:50 AM
#14
Re: [2005] Panel roll up/down ideas
I could imagine.
I have been playing with the 'XpTaskBox' from the XPCC items - nice (but I have already done most of it - but for a simple adding of a reference may be worth it). That said it seems to be a great one stop shop!
One thing that I realized I could improve in the code snippet I posted was to sleep and refresh based on Mod - every 2 or 3rd iteration; that keeps the speed up etc. This came about from collapsing the panel up to the one above that was collapsed.
I will now continue a look into the 'XP nav control'. - cheers
-
Jun 10th, 2007, 07:23 AM
#15
Re: [2005] Panel roll up/down ideas
Hmmm, seems the only thing available now from vbaccelerator (circa 2004) is the '.NET ExplorerBar Control'.
Not to worry, I think I'm good - it's an app for me in any case (famous last words right ).
-
Jun 10th, 2007, 01:53 PM
#16
Re: [2005] Panel roll up/down ideas
Yes, that was what it was called. Yes, its VB 6 but its a very very close duplication of the original windows control.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|