Need scrollbars in vb

Started by
12 comments, last by PinguinDude 21 years, 7 months ago
ok i have an map editor it uses imageboxes verry much But how do i add scrollbars ? please help me
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)
Advertisement
please anybody
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)
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]
The way of life is: AL :)
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]
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)
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.
The way of life is: AL :)
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
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 LongPrivate VOffset As LongPrivate Sub HScrollBar1_Click()    HOffset = -HScrollBar1.ValueEnd SubPrivate Sub VScrollBar1_Click()    VOffset = -VScrollBar1.ValueEnd SubPrivate Sub Paint()    '' Add HOffset to the target X point, and VOffset to the target Y value to offset the pictureEnd 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?
This piece of randomly insane randomness was brought to you by Thomas
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

no that wont work
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)
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
[Cyberdrek | ]

This topic is closed to new replies.

Advertisement