CodePudding user response:
To handle the control position, such as can all put into a Frame, and then adjust the position of the FrameCodePudding user response:
New picture of the coordinates of the position including the width and height, I are calculation can get, how to put in a frame? How to produce a scroll barCodePudding user response:
How to drag controls at run time know?Can only give you look at a simple example of himself, the rest to you want to be, the scroll bar look ugly is also a "
Add a Frame1 controls' form
Private mx As Single
Private my As Single
Private Sub Frame1_MouseDown (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=1 Then
Mx=X
My=Y
End the If
End Sub
Private Sub Frame1_MouseMove (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=1 Then
The Frame1) Left=Frame1) Left + (X - mx)
Frame1. Top=Frame1. Top + (Y - my)
End the If
End Sub
CodePudding user response:
My code like this: now display effect, but when the height of the inside box number more than the form, there is no scroll bar, in the form in a picturebox control, and the index set to 0, named as PictThe code is as follows:
Dim numBox As Integer 'each row shows the box number
Dim leftStart topStart, img tags like HSpace, VSpace, WBox, HBox As Integer 'x, y starting point; The horizontal and vertical spacing
Dim oriTop As Integer 'y direction the initial coordinate values
Dim x_pos, y_pos As Integer 'current x and y values
Private Sub Form_Load ()
CreatePictArray
ListBox
End Sub
Private Sub CreatePictArray ()
Dim As Integer I
For I=1 To 400
The Load Pict (I)
Pict (I). The Width=800
Pict (I). The Height=800
Pict (I). The Visible=False
Next
Pict (0). The Visible=False
End Sub
Private Sub ListBox ()
NumBox=8
LeftStart=200
TopStart=200
OriTop=200
Img tags like HSpace=40
VSpace=40
WBox=800
HBox=800
Dim As Integer I
For I=1 To 60
If I Mod numBox=0 Then
X_pos=leftStart + ((I Mod numBox) + numBox - 1) * (WBox + img tags like HSpace)
Y_pos=topStart
Pict (I). The Visible=True
Pict (I). Left=x_pos
Pict (I). The Top=y_pos
Pict (I). The Picture=LoadPicture (" XXX. JPG ")
TopStart=(I/numBox) * (HBox + VSpace) + oriTop
The Else
Pict (I). The Visible=True
X_pos=leftStart + ((I Mod numBox) - 1) * (WBox + img tags like HSpace)
Y_pos=topStart
Pict (I). Left=x_pos
Pict (I). The Top=y_pos
Pict (I). The Picture=LoadPicture (" c: \ XXX. JPG ")
End the If
Next I
End Sub
CodePudding user response:
You try this, drag the Pict try running time
Private mx As Single, my As Single
Private numBox As Integer 'per line box number
Private leftStart topStart, img tags like HSpace, VSpace, WBox, HBox As Integer 'x, y starting point; The horizontal and vertical spacing
Private Sub Form_Load ()
NumBox=8
LeftStart=200
TopStart=200
Img tags like HSpace=40
VSpace=40
WBox=800
HBox=800
CreatePictArray 400
ListBox
End Sub
Private Sub CreatePictArray (ByVal Count As an Integer)
Dim As Integer I
For I=0 To Count - 1
If I & gt; Pict. UBound Then Load Pict (I)
Pict (I). Move leftsrart topStart, WBox, HBox
Pict (I). The Visible=True
'===============
Pict (I). AutoRedraw=True
Pict (I). The Print I
'===============
Next
End Sub
Private Sub ListBox ()
Dim xPos As Single, yPos As Single
For I=0 To Pict. UBound
XPos=leftStart + (I Mod numBox) * (WBox + img tags like HSpace)
YPos=topStart + (I \ numBox) * (HBox + VSpace)
If (xPos + (WBox + img tags like HSpace) & gt; 0) And (yPos + + VSpace (HBox) & gt; 0) And (xPos + (WBox + img tags like HSpace) & lt; Me. ScaleWidth) And (yPos + + VSpace (HBox) & lt; Me. ScaleHeight) Then
Pict (I). Move xPos, yPos
Pict (I). The Visible=True
The Else
Pict (I). The Visible=False
End the If
Next
End Sub
Private Sub Form_Resize ()
If the Me. The WindowState=1 Then the Exit Sub
ListBox
End Sub
Private Sub pict_MouseDown (Index As an Integer, the Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=1 Then
Mx=X
My=Y
End the If
End Sub
Private Sub pict_MouseMove (Index As an Integer, the Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=1 Then
'leftStart=leftStart + (X - mx)' don't want a horizontal moving this article commented out
TopStart=topStart + (Y - my)
ListBox
End the If
End Sub
CodePudding user response:
Look at this post 15 floor, this is rolling a figure,Principle of multiple figure, too, are offset (Value) - HScroll1. Value, - VScroll1.,
CodePudding user response:
http://www.m5home.com/bak_blog2/article/125.htmlGood old code, for your reference
CodePudding user response: