?? aspicturebox.ctl
字號:
VERSION 5.00
Begin VB.UserControl ASPictureBox
AutoRedraw = -1 'True
BackStyle = 0 '透明
ClientHeight = 2535
ClientLeft = 0
ClientTop = 0
ClientWidth = 4215
DrawMode = 12 'Nop
PropertyPages = "ASPictureBox.ctx":0000
ScaleHeight = 169
ScaleMode = 3 'Pixel
ScaleWidth = 281
ToolboxBitmap = "ASPictureBox.ctx":0010
Begin VB.VScrollBar vsbScroll
Height = 2295
Left = 3960
TabIndex = 3
TabStop = 0 'False
Top = 0
Visible = 0 'False
Width = 200
End
Begin VB.HScrollBar hsbScroll
Height = 200
Left = 0
TabIndex = 2
TabStop = 0 'False
Top = 2280
Visible = 0 'False
Width = 3975
End
Begin VB.PictureBox picTwo
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
FillColor = &H0000FF00&
FillStyle = 5 'Downward Diagonal
Height = 2295
Left = 0
ScaleHeight = 149
ScaleMode = 3 'Pixel
ScaleWidth = 261
TabIndex = 1
Top = 0
Width = 3975
End
Begin VB.PictureBox picOne
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 495
Left = 0
ScaleHeight = 33
ScaleMode = 3 'Pixel
ScaleWidth = 81
TabIndex = 0
Top = 0
Visible = 0 'False
Width = 1215
End
End
Attribute VB_Name = "ASPictureBox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
'****************************************************************************
'人人為我,我為人人
'枕善居漢化收藏整理
'發布日期:2007/08/29
'描 述:VB6圖像比較分析控件源代碼
'網 站:http://www.Mndsoft.com/ (VB6源碼博客)
'網 站:http://www.VbDnet.com/ (VB.NET源碼博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代碼別忘記給枕善居哦!
'****************************************************************************
Option Explicit
Event Click()
Attribute Click.VB_MemberFlags = "200"
Event DblClick()
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event ReadProperties(PropBag As PropertyBag)
Event WriteProperties(PropBag As PropertyBag)
Private Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long
Private Sub hsbScroll_Change()
UpdatePicTwo
ShowMasks
End Sub
Public Sub hsbScroll_Scroll()
hsbScroll_Change
End Sub
Private Sub picOne_Change()
If picOne.ScaleWidth <= picTwo.ScaleWidth _
Or picOne.Picture = LoadPicture() _
Then hsbScroll.Visible = False
If picOne.ScaleHeight <= picTwo.ScaleHeight _
Or picOne.Picture = LoadPicture() _
Then vsbScroll.Visible = False
If picOne.Picture = LoadPicture() _
Then picTwo.Picture = LoadPicture()
Exit Sub
picTwo.Picture = picOne.Picture
If picOne.ScaleWidth > picTwo.ScaleWidth Then
hsbScroll.Visible = True
End If
If picOne.ScaleHeight > picTwo.ScaleHeight Then
vsbScroll.Visible = True
End If
Call hsbScrollSett_Refresh
Call vsbScrollSett_Refresh
End Sub
Private Sub picTwo_Click()
RaiseEvent Click
End Sub
Private Sub UserControl_Initialize()
UserControl.ScaleMode = vbPixels
picOne.ScaleMode = vbPixels
picTwo.ScaleMode = vbPixels
End Sub
Private Sub UserControl_Resize()
If UserControl.Height < 1500 Then
UserControl.Height = 1500
ElseIf UserControl.Width < 1500 Then
UserControl.Width = 1500
End If
'******************
picTwo.Height = UserControl.ScaleHeight - hsbScroll.Height
picTwo.Width = UserControl.ScaleWidth - vsbScroll.Width
'************************
vsbScroll.Left = picTwo.Width
vsbScroll.Height = picTwo.Height
hsbScroll.Top = picTwo.Height
hsbScroll.Width = picTwo.Width
Call picOne_Change
End Sub
Private Sub vsbScroll_Change()
UpdatePicTwo
ShowMasks
End Sub
Public Sub vsbScroll_Scroll()
vsbScroll_Change
End Sub
Private Sub UpdatePicTwo()
If hsbScroll.Visible = False _
And vsbScroll.Visible = False Then Exit Sub
picTwo.PaintPicture picOne.Picture, 0, 0, _
picTwo.ScaleWidth, picTwo.ScaleHeight, _
hsbScroll.Value, vsbScroll.Value, _
picTwo.ScaleWidth, picTwo.ScaleHeight, _
vbSrcCopy
End Sub
Public Property Get Picture() As Picture
Attribute Picture.VB_Description = "Returns/sets a graphic to be displayed in a control."
Attribute Picture.VB_UserMemId = 0
Attribute Picture.VB_MemberFlags = "200"
Set Picture = picOne.Picture
End Property
Public Property Let Picture(ByVal New_Picture As IPictureDisp)
Set Picture = New_Picture
End Property
Public Property Set Picture(ByVal New_Picture As Picture)
Set picOne.Picture = New_Picture
PropertyChanged "Picture"
End Property
Public Property Get BackColor() As OLE_COLOR
Attribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object."
BackColor = picTwo.BackColor
End Property
Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
picTwo.BackColor() = New_BackColor
Call UpdatePicTwo
PropertyChanged "BackColor"
End Property
Public Property Get BorderStyle() As Integer
Attribute BorderStyle.VB_Description = "Returns/sets the border style for an object."
BorderStyle = picTwo.BorderStyle
End Property
Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)
picTwo.BorderStyle() = New_BorderStyle
PropertyChanged "BorderStyle"
End Property
Private Sub picTwo_DblClick()
RaiseEvent DblClick
End Sub
Private Sub picTwo_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub
Private Sub picTwo_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub
Private Sub picTwo_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseUp(Button, Shift, X, Y)
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
RaiseEvent ReadProperties(PropBag)
Set Picture = PropBag.ReadProperty("Picture", Nothing)
picTwo.BackColor = PropBag.ReadProperty("BackColor", &H8000000F)
picTwo.BorderStyle = PropBag.ReadProperty("BorderStyle", 1)
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
RaiseEvent WriteProperties(PropBag)
Call PropBag.WriteProperty("Picture", Picture, Nothing)
Call PropBag.WriteProperty("BackColor", picTwo.BackColor, &H8000000F)
Call PropBag.WriteProperty("BorderStyle", picTwo.BorderStyle, 1)
End Sub
Private Sub hsbScrollSett_Refresh()
hsbScroll.Value = 0
If picOne.ScaleWidth <= picTwo.ScaleWidth Then Exit Sub
hsbScroll.Max = picOne.ScaleWidth - picTwo.ScaleWidth
'**************
If hsbScroll.Max < 25 Then
hsbScroll.LargeChange = 1
hsbScroll.SmallChange = 1
Else
hsbScroll.LargeChange = hsbScroll.Max \ 10
hsbScroll.SmallChange = hsbScroll.Max \ 25
End If
End Sub
Private Sub vsbScrollSett_Refresh()
vsbScroll.Value = 0
If picOne.ScaleHeight <= picTwo.ScaleHeight Then Exit Sub
vsbScroll.Max = picOne.ScaleHeight - picTwo.ScaleHeight
'****************
If vsbScroll.Max < 25 Then
vsbScroll.LargeChange = 1
vsbScroll.SmallChange = 1
Else
vsbScroll.LargeChange = vsbScroll.Max \ 10
vsbScroll.SmallChange = vsbScroll.Max \ 25
End If
End Sub
Public Function mPoint(X As Integer, Y As Integer) As Long
mPoint = picTwo.Point(X, Y)
End Function
Public Function ghdc() As Long
ghdc = picTwo.hdc
End Function
Public Function DoLine(ix As Single, iy As Single, X As Single, Y As Single)
picTwo.Line (ix, iy)-(ix, Y), vbGreen
picTwo.Line -(X, Y), vbGreen
picTwo.Line -(X, iy), vbGreen
picTwo.Line -(ix, iy), vbGreen
Dim sX As Long, sY As Long, isDone As Boolean
sX = ix
sY = iy
Do
If isDone = False Then
SetPixelV picTwo.hdc, sX, sY, vbGreen
isDone = True
Else
isDone = False
End If
If sX > X Then
sY = sY + 1
sX = ix
If sY > Y Then
Exit Do
End If
Else
sX = sX + 1
End If
Loop
End Function
Public Function VSVal() As Integer
VSVal = vsbScroll.Value
End Function
Public Function HSVal() As Integer
HSVal = hsbScroll.Value
End Function
Private Sub ShowMasks()
Dim tx As Single, ty As Single, tx1 As Single, ty1 As Single
Dim i As Integer, one$
If frmMain.lstMaster.ListCount > 0 Then
For i = 0 To frmMain.lstMaster.ListCount - 1
one$ = frmMain.lstMaster.List(i)
tx = Split(one$, ",")(0) - hsbScroll.Value
ty = Split(one$, ",")(1) - vsbScroll.Value
tx1 = Split(one$, ",")(2) - hsbScroll.Value
ty1 = Split(one$, ",")(3) - vsbScroll.Value
frmMain.aspbMaster.DoLine tx, ty, tx1, ty1
Next i
End If
End Sub
Public Function PicRefresh()
picTwo.Cls
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -