Archived

This topic is now archived and is closed to further replies.

PinguinDude

Need scrollbars in vb

Recommended Posts

But anyway there are 2 scroll bars in de Control bar of your
Interface. Add them and move the Images When the user hit the scroll bars.



[edited by - rashnu on August 31, 2002 3:48:27 AM]

Share this post


Link to post
Share on other sites
i have an component called MBScroll when i wanna place the imageboxes in it it gets full so the mbscroll gets scrollbars but when i want to scroll them in vb it wont work and if i cant scroll them i cant put in more image boxes and RaSHnU that wont work because i have two scrollbars

[edited by - vbtest on August 31, 2002 4:00:38 AM]

Share this post


Link to post
Share on other sites
Can you send me your code?
My email is in my profile.
I will look at right away and i hope i can give you a good solution.

Share this post


Link to post
Share on other sites
Please don''t use an imagebox for every tile in your map editor (if that is what you are doing). Be sure that you are doing something more sensible like using the GDI functions to blit the tiles to the screen, that way it will also become easier to use the scrollbars to scroll through your map.



The hackers must have gotten into the system through the hyperlink!!

Invader''s Realm

Share this post


Link to post
Share on other sites
To use scrollbars add the standard VB ones (in the tool wotsit) and then write code to link them to the imageboxes/whatevers.

If you are doing a tile-based editor I recommend using the PictureClip control and hooking that up to a PictureBox. You can paint any tile to any part, and you just use the scrollbar values to offset where you paint it. Simple code (not sure if I''ve got the right function names but it should give you a good idea - I think 0,0 is top left):


Private HOffset As Long
Private VOffset As Long

Private Sub HScrollBar1_Click()
HOffset = -HScrollBar1.Value
End Sub

Private Sub VScrollBar1_Click()
VOffset = -VScrollBar1.Value
End Sub

Private Sub Paint()
'' Add HOffset to the target X point, and VOffset to the target Y value to offset the picture
End Sub


Note: the code is untested but it should give you a good idea of what you need to do.

--Thomas McCorkell

Just what is Karma? Is it a way to rate people? A way of assigning privilege levels? Or is karma just an anti-spam system?

Share this post


Link to post
Share on other sites
since it sounds like you use image/pictureboxes for the tiles and not a paint method, here is another "easy" alternative to solve the problem:
-make a new MDIform and set it as the start form
-set the MDIchild proprety of your map form to true
=> now, you should see your map like a document in the MDI window
-resize the map form to the wished dimension
=> tadam! working scrollbars are appearing on the MDI window

Share this post


Link to post
Share on other sites
quote:
Original post by vbtest
no that wont work


It is possible to use the standard VB scrollbars, I have a map editor that I''m working on which uses exactly those scrollbars and they work fine, you simply have to add some code to them. Don''t expect to just be able to use what''s there without any code. That will never happen. You keep saying that won''t work and crap but you don''t give any details. Explain some more so we can help you out. Might want to post some code so we can have a look at what you''ve got and try to help you out.



"DaHjajmajQa''jajHeghmeH!"

Cyberdrek
danielc@iquebec.com
Founder
Laval Linux

/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash

Share this post


Link to post
Share on other sites
ok i post SOMETHING SO YOU CAN GUYS CAN HELP ME OUT


X = image boxes
Y = Scrollbar

XXXXXXXXXXXXY
XXXXXXXXXXXXY
XXXXXXXXXXXXY
XXXXXXXXXXXXY
XXXXXXXXXXXXY
XXXXXXXXXXXXY
YYYYYYYYYYYYY
I HOPE THIS HELPS A BIT

Share this post


Link to post
Share on other sites
that "SOMETHING SO YOU GUYS CAN HELP ME OUT" won''t help in the slightest... ...

put on a horizontal scrollbar from the toolbox...

put all of your "tiles" inside a frame and then put that frame inside another frame... the first frame should be the size of your whole map and the second frame should be the size you want to be able to see at any one time...

now put some code into the scroll bars events that reposition the first frame (the larger one) each time you click to scroll... if you set the min of the scroll bar to be "0" and the max of the scroll bar to be the width of your large frame "minus" the width of your small frame then you simply need to set the .left property of the large frame to be -.value of the scroll bar...

use the same principle for the vertical scroll bar...

hope that helps...

Share this post


Link to post
Share on other sites