|
-
Feb 25th, 2004, 05:04 AM
#1
Bloody Scrollbars!
I'm trying to scroll a bitmap in a picture box using 2 scrollbars like you'd expect.
But the code only works if I set the Largechange property of the scrollbars to 0. If I use a number greater than 0 then the bitmap appears in the wrong place.
I can't see how LargeChange should make any difference.
What is the normal method for showing a bitmap in a picturebox using scrollbars?
Code would be great, please.
I don't live here any more.
-
Feb 25th, 2004, 07:45 AM
#2
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 25th, 2004, 08:31 AM
#3
That'll do nicely, thanks.
-
Feb 25th, 2004, 08:02 PM
#4
lol it's really weird how someone else asked the same question again in a short time
btw pax, I was getting some weird errors. One thing that was really really weird was that at certain times (I think when I scrolled really fast repeatedly? cant remember what I did)... scrollbar.value would have a value greater than scrollbar.maximum (whitout raising any errors) and so I had to check the Value property outside of the scrollbar class to make sure its on the right range...
also in another situation ( I dont remember again when this would happen)... when I would change the value of Maximum it wouldnt change anything. It was weird because after calling the function 3 times it would then work fine. I just took a backup of LargeChange before changing the maximum and it fixed it:
VB Code:
Public Shadows Property Maximum() As Integer
Get
' Return the real maximum
Return MyBase.Maximum - Me.LargeChange + 1
End Get
Set(ByVal Value As Integer)
' Calculate the 'virtual' maximum
Dim tmp As Integer = MyBase.LargeChange
MyBase.Maximum = Value + Me.LargeChange - 1
MyBase.LargeChange = tmp
End Set
End Property
anyways wossname why are you using a scrollbar for scrolling an image? you can just use a panel, put the picturebox in it, and set the AutoScroll property of the panel to true. It would do everything for you nicely. I had to use these scrollbars because I'm drawing my image manually, dunno about you
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 26th, 2004, 04:09 AM
#5
I don't live here any more.
-
Feb 26th, 2004, 04:27 AM
#6
I've tried that, but the scrollbars on the panel don't appear when the image loads.
Autosize and autoscroll on the respective controls are set true but nothing happens when a large picture is shown. I'm setting the Image property of the picturebox to a bitmap loaded using
Code:
PicMaster.Image = new Bitmap(Bitmap.FromFile(MyFileName))
What (else) am I doing wrong?
-
Feb 26th, 2004, 04:58 AM
#7
Never mind, I've got it working.
I must say though, the scrolling was much smoother when I was drawing the image manually with Graphics.DrawImage().
I might go back to that.
-
Feb 26th, 2004, 05:38 PM
#8
Originally posted by wossname
Never mind, I've got it working.
I must say though, the scrolling was much smoother when I was drawing the image manually with Graphics.DrawImage().
I might go back to that.
hehe why was it smoother?
care to post your code so I see what you're doing?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
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
|