|
how to use scroll bar in pictur box
Piyush Vardhan Singh
|
|
|
|
|
You'd have to write the code yourself to make the scrollbar have the right extent, and to move the image. IMO you're better off just drawing the image in your paint event, it makes scrolling easier to control.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
my dear i had done this but its not working
Piyush Vardhan Singh
|
|
|
|
|
but its working fine for me !!!!
Happy Programming
-----
Abhijit
|
|
|
|
|
Did you put the PictureBox INSIDE the Panel control??
|
|
|
|
|
Hello Piyush,
I hope the following code helps:
Private bWindowIsResizable As Boolean
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTBOTTOMRIGHT = 17
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Form_Load()
HScroll1.Height = 255
VScroll1.Width = 255
'set flag indicating a resizable window
bWindowIsResizable = (Me.BorderStyle = vbSizable) Or _
(Me.BorderStyle = vbSizableToolWindow)
'set up the picture box used to fill
'the corner between the H and V scroll
'bars, and if the window is sizable
'print a 'gripper' image to the control
With Picture3
.AutoRedraw = True
.AutoSize = True
.ForeColor = &H80000015
.BackColor = Me.BackColor
.BorderStyle = 0
.ZOrder 0
'if sizable windows print the gripper image
If bWindowIsResizable Then
.Font.Size = 11
.Font.Name = "Marlett"
.Font.Bold = False
Picture3.CurrentX = 10
Picture3.CurrentY = 10
Picture3.Print "o"
End If
End With
With Picture1
.BorderStyle = 0
.Move 0, 0
.Cls
End With
With Picture2 'inner (cyan) picture box
'as we're loading an image, expand pix2
'to the size of the loaded graphic
.AutoSize = True
.BorderStyle = 0
.Move 0, 0
.Cls
'obviously, change this to a valid image on your system
.Picture = LoadPicture("c:\windows\xp5layout.jpg")
End With
With HScroll1
.Max = (Picture2.ScaleWidth - Picture1.ScaleWidth)
.LargeChange = .Max \ 10
.SmallChange = .Max \ 25
.Enabled = (Picture1.ScaleWidth <= Picture2.ScaleWidth)
.ZOrder 0
End With
With VScroll1
.Max = (Picture2.ScaleHeight - Picture1.ScaleHeight)
.LargeChange = .Max \ 10
.SmallChange = .Max \ 25
.Enabled = (Picture1.ScaleHeight <= Picture2.ScaleHeight)
.ZOrder 0
End With
Picture3.ZOrder 0
End Sub
Private Sub Form_Resize()
'Picture1 is the *outer* pix box (the red viewport)
'Picture2 is the inner pix box (the cyan container to scroll within the viewport)
'don't attempt resizing if minimized!
If Me.WindowState <> vbMinimized Then
'this prevents an error if
'the form is sized too small
If (Me.ScaleHeight > HScroll1.Height) And _
(Me.ScaleWidth > VScroll1.Width) Then
Picture1.Move 0, 0, Me.ScaleWidth - VScroll1.Width, _
Me.ScaleHeight - HScroll1.Height
With HScroll1
.Left = 0
.Top = Picture1.Height
.Width = Picture1.Width
.ZOrder 0
.Enabled = (Picture1.ScaleWidth < Picture2.ScaleWidth)
'if the form has been resized to
'display the entire pixbox,
'disable the scrollbars
If .Enabled Then
.Max = (Picture2.ScaleWidth - Picture1.ScaleWidth)
End If
End With
With VScroll1
.Left = Picture1.Width
.Top = 0
.Height = Picture1.Height
.ZOrder 0
.Enabled = (Picture1.ScaleHeight < Picture2.ScaleHeight)
If .Enabled Then
.Max = (Picture2.ScaleHeight - Picture1.ScaleHeight)
End If
End With
'position the fake sizing grip
Picture3.Move VScroll1.Left, HScroll1.Top
End If '(Me.ScaleHeight > HScroll1.Height) And ...
End If 'Me.WindowState
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set Form1 = Nothing
End Sub
Private Sub Picture3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'if a sizable window..
If bWindowIsResizable Then
'..fake a resize grabber action
If Button = vbLeftButton Then
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&
End If
End If
End Sub
Private Sub Picture3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'if a sizable window..
If bWindowIsResizable Then
'..users expect a sizing arrow
Picture3.MousePointer = vbSizeNWSE
End If
End Sub
Private Sub VScroll1_Change()
Picture2.Top = -VScroll1.Value
End Sub
Private Sub VScroll1_Scroll()
Picture2.Top = -VScroll1.Value
End Sub
Private Sub HScroll1_Change()
Picture2.Left = -HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
Picture2.Left = -HScroll1.Value
End Sub
Have a nice day.
Regards,
James
James Smith
www.componentone.com
|
|
|
|
|
Does any one have code to retrieve HardDisk serial no on VB.net 2003. I got some code from internet but its not working.
Thanks & Regards
|
|
|
|
|
U can Try This one also !!!!This is using WMI
Imports System.Management
Dim searcher As New ManagementObjectSearcher( _
"root\CIMV2", _
"SELECT * FROM Win32_PhysicalMedia")
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("HDD Serial No :")
Console.WriteLine("SerialNumber: {0}", queryObj("SerialNumber"))
Next
Happy Programming
-----
Abhijit
|
|
|
|
|
finally, this works for me.
thanks again...
|
|
|
|
|
welcome !!!
Happy Programming
-----
Abhijit
|
|
|
|
|
good day everyone,
i hope you can again help me with this:
code :
dim strVal() as string
dim sVal as string = "a-b-c" - this can be changeable
dim result as string = ""
dim xCnt as integer
strVal = split(sVal, "-")
for xCnt = 0 to strVal -1
result & = strVal(xCnt)
next
first run : result = abc
second run: result = abcabc <<-- this is the problem
the code above runs smoothly, and no errors:
but for the second runtime of the code above it does not clear the previous "strVal" value / results.
how to clear the first result value of "strVal" ?
thank you in advance, your help are highly appreciated.
links/code are most highly appreciated thank you...
start a new beginning in every ending; thats what life for......
|
|
|
|
|
Start with result = string.Empty at the top of the loop.
You can't clear an array, it is a fixed size object.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Dear Friends,
I am trying to run an VB.NET 2003 project in 2005. After the successful conversion, If I run the project it is showing the below error.
"Visual studio cannot start debugging because the debug target "c:\.... project.exe" is missing. Please build the project and retry, or set the output path and Assembly name properties appropriately to point at the correct location for the target assembly"
Please help to avoid this error
Regards
Azeem
|
|
|
|
|
From Build Menu , Rebuild ur Application .....
Hope will work !!!!
Happy Programming
-----
Abhijit
|
|
|
|
|
Thank you for your timely reply.
I have tried this but its the same
Regards
Azeem
|
|
|
|
|
There's lot of possible causes... here[^].
|
|
|
|
|
What you need is some code to read and write to a database - sorry but no one here is going to do all you work for you - buy a book. Amazon sell books - please dont let your next post be "Help needed using amzon to buy book".
Dan
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
If you were to spend a few mintues on google you would have found:
http://www.w3schools.com/sql/default.asp
and would have solved it in less than the time it has taken to wait for a reply.
Dan
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Look I am not going to rise to the bait and start arguing. If you need to update a table you use the update SQL command with the columns you would like to update and the clause for which rows you would like to update (if not all).
I suggested you buy a book because if you are working on databases and struggle with the simple things (thats not a dig - every one starts somewhere) then it would be a wise idea to read up on the topic - that way you will be better equipped to make informed decisions about the best way to work with your tables and it will also benefit you in the long term.
As for nervous - I am not sure where you got that from - the only thing I am nervous about is that they let people like you near databases.
Dan
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
10x alot Dan and sorry if i disturbed u,i didnt mean to.
it was nice knowing you.i'll try today to search more for the update syntax i need.
|
|
|
|
|
I do experience doing autonum in vb 6.0 but it's very complicated much more in vb.net for me. And I'm still a student.... tnx...
How to autonum in vb.net?...
My database is MSAccess.
-- modified at 22:51 Monday 8th October, 2007
|
|
|
|
|
|
Your subject line said you had a "problem about Autonum", but you failed to describe what that problem was.
|
|
|
|
|
Does anybody knows where to find a vb 6 code that can manipulate database.. e.g. add, edit and delete a field... also code that can manipulate existing fields.. thnks..
|
|
|
|