473,385 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Panel set to autoscroll is too limited

!NoItAll
297 100+
I am using a panel control in vb.net (2010) to build a timeline of images. These are very small images (320x180) and I am running into a limit of 240. While the panel does not complain when I add more - it will only scroll to the 240th one.
Here is what my timeline looks like:

mouse-over to see the whole thing...

My question is: Any ideas on how I can do this? I am counting on some of the built-in functionality of the panel in autoscroll mode (being able to bring any of the thumbnails into view), etc. I am certainly not averse to purchasing a third party control for this. I really need to be able to display 1000 or more thumbnails!
p.s. the image itself is hosted in a small custom control that I made... perhaps this just uses too much memory...??
Oct 7 '11 #1

✓ answered by !NoItAll

Ok - found the answer. The problem is that the panel control will not allow you to set the .left value of any child objects to anything greater than 32767 (short). I have no idea why this is. If you set it to anything larger it will just ignore you and reset it to 32767. So as I built my timeline all of my thumbnail windows that needed to go beyond a .left of 32767 were getting plopped on top of each other.
The answer was to NOT use the panel control, but to create my own container made of system.windows.forms.form. It required a little setup, but that was relatively easy and straight-forward. Here is a test harness I created to make it work:
Expand|Select|Wrap|Line Numbers
  1. Imports WXC
  2. Public Class Form1
  3.     Private WinHost As New System.Windows.Forms.Form
  4.     Private tWin() As WXC.ThumbnailWindow
  5.  
  6.  
  7.     Private Sub MakeTimeline()
  8.  
  9.         'size and position the host window
  10.  
  11.         With WinHost
  12.             .TopLevel = False
  13.             .Visible = False
  14.             .Parent = Me
  15.             .Left = pnltl.Left + 2
  16.             .Top = pnltl.Top + 2
  17.             .Height = pnltl.Height - 4
  18.             .Width = pnltl.Width - 4
  19.             .BackColor = Color.DimGray
  20.             .FormBorderStyle = Windows.Forms.FormBorderStyle.None
  21.             .Cursor = Cursors.Hand
  22.             .AutoScroll = True
  23.         End With
  24.  
  25.         ReDim tWin(800)
  26.  
  27.         WinHost.SuspendLayout()
  28.         For I = 0 To UBound(tWin)
  29.             tWin(I) = New ThumbnailWindow(My.Resources.Axis_320x180_6034e_thumb, String.Empty)
  30.             tWin(I).Parent = WinHost
  31.             tWin(I).Picture = My.Resources.Axis_320x180_6034e_thumb
  32.             tWin(I).Location = New System.Drawing.Point((I * 128) + 3, 2)
  33.             tWin(I).DayAndTime = I.ToString & " " & tWin(I).Left.ToString
  34.             WinHost.Controls.Add(tWin(I))
  35.         Next
  36.         WinHost.ResumeLayout()
  37.         WinHost.Refresh()
  38.         WinHost.BringToFront()
  39.         WinHost.Visible = True
  40.         MsgBox("Done")
  41.  
  42.     End Sub
  43.  
  44.     Private Sub btnMakePanels_Click(sender As System.Object, e As System.EventArgs) Handles btnMakePanels.Click
  45.         MakeTimeline()
  46.     End Sub
  47.  
  48.     Private Sub btnBegin_Click(sender As System.Object, e As System.EventArgs) Handles btnBegin.Click
  49.         With WinHost
  50.             .ScrollControlIntoView(tWin(0))
  51.         End With
  52.     End Sub
  53.  
  54.     Private Sub btnEnd_Click(sender As System.Object, e As System.EventArgs) Handles btnEnd.Click
  55.         WinHost.ScrollControlIntoView(tWin(UBound(tWin)))
  56.     End Sub
  57. End Class
  58.  
The wxc.thumbnailwindow object is a simple custom control that I made. Sorry I can't share it here because it is the IP of my employer - suffice to say it is just a very simple control made up of a panel, a picturebox and a label. I created this for simplicity. You could make the same thing without creating a custom control.
The only problem I run into now is that there is a limit to the number of Handles Windows will allow (~2000) - but I'm not worried about that limit for my application.
I should also explain that pnltl is a panel control that I put on the form as a placeholder for the new control (the one made from system.forms.form). I did this so there isn't a big empty space to stare at before the timeline is made. It also provides the dimensions and a pretty border for my final control.
The result is great and looks exactly the way I want. There are also plenty of scroll events and methods to give me programatic control.

float mouse over image to see the whole thing
The thumbnails above each show the thumbnail number and the .left property - so you can see it goes well above the 32767 allowed by the wimpy panel control.
Yay.

3 4130
Rabbit
12,516 Expert Mod 8TB
You could use a paging type solution instead of a scroll.
Oct 7 '11 #2
!NoItAll
297 100+
Hmmm - that actually makes me think the problem may be a limit on the width of the window rather than anything else. Your suggesting may work if I just add another row below the current one. The normal user metaphor for this kind of thing is a left-to-right timeline, but a real timeline doesn't typically show every frame so some deviation from that might be appropriate...
But - just in case, does anyone know about a 3rd party control that might do the trick?
Oct 7 '11 #3
!NoItAll
297 100+
Ok - found the answer. The problem is that the panel control will not allow you to set the .left value of any child objects to anything greater than 32767 (short). I have no idea why this is. If you set it to anything larger it will just ignore you and reset it to 32767. So as I built my timeline all of my thumbnail windows that needed to go beyond a .left of 32767 were getting plopped on top of each other.
The answer was to NOT use the panel control, but to create my own container made of system.windows.forms.form. It required a little setup, but that was relatively easy and straight-forward. Here is a test harness I created to make it work:
Expand|Select|Wrap|Line Numbers
  1. Imports WXC
  2. Public Class Form1
  3.     Private WinHost As New System.Windows.Forms.Form
  4.     Private tWin() As WXC.ThumbnailWindow
  5.  
  6.  
  7.     Private Sub MakeTimeline()
  8.  
  9.         'size and position the host window
  10.  
  11.         With WinHost
  12.             .TopLevel = False
  13.             .Visible = False
  14.             .Parent = Me
  15.             .Left = pnltl.Left + 2
  16.             .Top = pnltl.Top + 2
  17.             .Height = pnltl.Height - 4
  18.             .Width = pnltl.Width - 4
  19.             .BackColor = Color.DimGray
  20.             .FormBorderStyle = Windows.Forms.FormBorderStyle.None
  21.             .Cursor = Cursors.Hand
  22.             .AutoScroll = True
  23.         End With
  24.  
  25.         ReDim tWin(800)
  26.  
  27.         WinHost.SuspendLayout()
  28.         For I = 0 To UBound(tWin)
  29.             tWin(I) = New ThumbnailWindow(My.Resources.Axis_320x180_6034e_thumb, String.Empty)
  30.             tWin(I).Parent = WinHost
  31.             tWin(I).Picture = My.Resources.Axis_320x180_6034e_thumb
  32.             tWin(I).Location = New System.Drawing.Point((I * 128) + 3, 2)
  33.             tWin(I).DayAndTime = I.ToString & " " & tWin(I).Left.ToString
  34.             WinHost.Controls.Add(tWin(I))
  35.         Next
  36.         WinHost.ResumeLayout()
  37.         WinHost.Refresh()
  38.         WinHost.BringToFront()
  39.         WinHost.Visible = True
  40.         MsgBox("Done")
  41.  
  42.     End Sub
  43.  
  44.     Private Sub btnMakePanels_Click(sender As System.Object, e As System.EventArgs) Handles btnMakePanels.Click
  45.         MakeTimeline()
  46.     End Sub
  47.  
  48.     Private Sub btnBegin_Click(sender As System.Object, e As System.EventArgs) Handles btnBegin.Click
  49.         With WinHost
  50.             .ScrollControlIntoView(tWin(0))
  51.         End With
  52.     End Sub
  53.  
  54.     Private Sub btnEnd_Click(sender As System.Object, e As System.EventArgs) Handles btnEnd.Click
  55.         WinHost.ScrollControlIntoView(tWin(UBound(tWin)))
  56.     End Sub
  57. End Class
  58.  
The wxc.thumbnailwindow object is a simple custom control that I made. Sorry I can't share it here because it is the IP of my employer - suffice to say it is just a very simple control made up of a panel, a picturebox and a label. I created this for simplicity. You could make the same thing without creating a custom control.
The only problem I run into now is that there is a limit to the number of Handles Windows will allow (~2000) - but I'm not worried about that limit for my application.
I should also explain that pnltl is a panel control that I put on the form as a placeholder for the new control (the one made from system.forms.form). I did this so there isn't a big empty space to stare at before the timeline is made. It also provides the dimensions and a pretty border for my final control.
The result is great and looks exactly the way I want. There are also plenty of scroll events and methods to give me programatic control.

float mouse over image to see the whole thing
The thumbnails above each show the thumbnail number and the .left property - so you can see it goes well above the 32767 allowed by the wimpy panel control.
Yay.
Oct 8 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Marco | last post by:
I need to set the SmallChange property of a scrollbar of a panel (AutoScroll = true), but I donīt see how to acess it. Any help ? _____ Marco
0
by: Marco Rego | last post by:
I need to set the SmallChange property of the VScrollbar of a Panel (AutoScroll = true), but I donīt see how to access it. Thanx for any help and God bless. _____ Marco
2
by: newsgroper | last post by:
I set the AutoScroll property of a windows panel to true. How can I tell when the scrollbar becomes visible?
1
by: John | last post by:
I'm trying to use the DrawText() method to draw some very long string text on the Panel with AutoScroll enabled. However, for some unknown reasons, I could not trigger the ScrollBar to show up. ...
0
by: Tom | last post by:
I have a panel that is set for autoscrolling, however I -DON'T- want the scrollbars to show up. Do anyone know of any way to make a panel autoscroll and yet have no scrollbars? I know that is an...
1
by: Kent | last post by:
Hi, I have a form which contain 2 panels, Master and Detail, Master panel is on top and Detail panel is at the bottom. In the form, I set Detail panel to Dock to the bottom and Master panel...
2
by: YYZ | last post by:
I discovered something very interesting today, and it will save me a bunch of time...maybe. If you set Panel1.Autoscroll to true, and have a panel2 inside of it, I can add all sorts of controls...
4
by: Thiru .Net | last post by:
hi wagner, i have a doubt in panel control in windows application. i have a panel control wherein i have put a picturebox control. i show picture into picturbox control. now i need to zoom in...
7
by: Sharon | last post by:
I’m using the Panel control that contains a PictureBox control (for implementing the http://www.codeproject.com/cs/miscctrl/PictureBox.asp). The Panel is set to AutoScroll = true. I wish to...
4
by: mateusz.zajakala | last post by:
Hi, I have panel (with autoscroll property) on which I'm dynamicaly adding of controls. When I want to scroll my panel using scrollbars it freezes all the controls added on that panel, makes...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.