Loading

moving large numbers of controls

7 posts / 0 new
Last post
Offline
Joined: 10/22/2009
moving large numbers of controls

I placed a large number of controls(label) on DataGridView, I moves them ( DGV cells & controls) by the scrollbar, but it works very slow. it's because i use for loop on all labels & move them separately.
Is any other way to move these controls , maybe some way to group them ,but without lossing functionality of DGV?

admin's picture
Offline
Joined: 11/14/2008
re: moving large numbers of controls

Show us your code here.

Offline
Joined: 10/22/2009
there is Sub for scroling

there is Sub for scroling Labels on DGV

  1. Private Sub DGV_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles DGV.Scroll
  2. If e.NewValue <> e.OldValue Then
  3. For i = 0 To DGV.Controls.Count - 1
  4. If TypeOf DGV.Controls.Item(i) Is Windows.Forms.Label Then
  5. If e.ScrollOrientation = ScrollOrientation.HorizontalScroll Then
  6. DGV.Controls(i).Location = New System.Drawing.Point(DGV.Controls(i).Location.X + ((e.OldValue - e.NewValue)), DGV.Controls(i).Location.Y)
  7. Else
  8. DGV.Controls(i).Location = New System.Drawing.Point(DGV.Controls(i).Location.X, DGV.Controls(i).Location.Y + ((e.OldValue - e.NewValue) * 20))
  9. End If
  10. End If
  11.  
  12. Next i
  13. Application.DoEvents()
  14.  
  15. If e.ScrollOrientation = ScrollOrientation.VerticalScroll Then
  16. For i = 0 To PanelPokoje.Controls.Count - 1
  17. If TypeOf PanelPokoje.Controls.Item(i) Is Windows.Forms.Label Then
  18. PanelPokoje.Controls(i).Location = New System.Drawing.Point(PanelPokoje.Controls(i).Location.X, PanelPokoje.Controls(i).Location.Y + ((e.OldValue - e.NewValue) * 20))
  19. End If
  20.  
  21. Next i
  22. Application.DoEvents()
  23. Else
  24. For i = 0 To PanelDaty.Controls.Count - 1
  25. If TypeOf PanelDaty.Controls.Item(i) Is Windows.Forms.Label Then
  26. PanelDaty.Controls(i).Location = New System.Drawing.Point(PanelDaty.Controls(i).Location.X + ((e.OldValue - e.NewValue)), PanelDaty.Controls(i).Location.Y)
  27. End If
  28. Next i
  29. Application.DoEvents()
  30. End If
  31. End If
  32.  
  33. End Sub
admin's picture
Offline
Joined: 11/14/2008
re: there is Sub for scroling

I'm just wondering why you use labels to move when scrolling DGV.

Offline
Joined: 10/26/2009
tables

admin i need you help plz.....

Offline
Joined: 10/22/2009
I trying to do schedule with

I trying to do schedule with appointment displayed like in booking system, I want to be able to split cells of schedule on two parts( one for end of elary appointment, second one for beginning of next one).
Do get that I’m using labels as appointments & DGV as a base.
I’m using DGV to add appointment ( multi selecting ) . Labels are appointments with assigned events , to change or to delete them.
After that I’m trying to scroll schedule & I get that slowly working scroll

admin's picture
Offline
Joined: 11/14/2008
re: I trying to do schedule with

It's really hard to guess what do you mean. Upload your code here please.

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.