home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.UserControl TTLSlide
- AutoRedraw = -1 'True
- BackColor = &H00808080&
- ClientHeight = 2505
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 2505
- ClipControls = 0 'False
- EditAtDesignTime= -1 'True
- FillColor = &H00808080&
- FillStyle = 0 'Solid
- KeyPreview = -1 'True
- ScaleHeight = 2505
- ScaleWidth = 2505
- ToolboxBitmap = "TTLPHO~1.ctx":0000
- Begin VB.Frame FrameView
- BackColor = &H00808080&
- BorderStyle = 0 'None
- Height = 3855
- Left = 0
- TabIndex = 0
- ToolTipText = "TTL Slide Frame"
- Top = 0
- Visible = 0 'False
- Width = 3855
- Begin VB.Image Image2
- BorderStyle = 1 'Fixed Single
- Height = 255
- Left = 5280
- Top = 5880
- Width = 255
- End
- Begin VB.Image Image1
- BorderStyle = 1 'Fixed Single
- Height = 2775
- Left = -120
- Top = 5760
- Visible = 0 'False
- Width = 135
- End
- End
- Attribute VB_Name = "TTLSlide"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- Option Explicit
- 'Default Property Values:
- Const m_def_ToolTipText = ""
- 'Const m_def_ForeColor = 0
- Const m_def_Enabled = 0
- Const m_def_BackStyle = 0
- Const m_def_BorderStyle = 0
- 'Const m_def_ToolTipText = ""
- Const m_def_WhatsThisHelpID = 0
- 'Property Variables:
- Dim m_ToolTipText As String
- 'Dim m_ForeColor As Long
- Dim m_Enabled As Boolean
- Dim m_BackStyle As Integer
- Dim m_BorderStyle As Integer
- 'Dim m_ToolTipText As String
- Dim m_WhatsThisHelpID As Long
- Dim isSlide As Boolean
- 'Event Declarations:
- Event Click() 'MappingInfo=Image2,Image2,-1,Click
- Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
- Event DblClick() 'MappingInfo=Image2,Image2,-1,DblClick
- Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
- Event KeyDown(KeyCode As Integer, Shift As Integer)
- Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus."
- Event KeyPress(KeyAscii As Integer)
- Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key."
- Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyUp
- Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus."
- Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Image2,Image2,-1,MouseDown
- Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
- Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Image2,Image2,-1,MouseMove
- Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
- Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
- Event Show() 'MappingInfo=UserControl,UserControl,-1,Show
- Attribute Show.VB_Description = "Occurs when the control's Visible property changes to True."
- Private Sub TTLSlide_Resize()
- Dim iW As Double, iH As Double
- FrameView.Top = 0
- FrameView.Left = 0
- If Width > Height Then
- FrameView.Width = Height
- Else
- FrameView.Width = Width
- End If
-
- FrameView.Height = FrameView.Width
- Width = FrameView.Width
- Height = FrameView.Height
-
- End Sub '** TTLSlide_Resize
- Public Function LoadImage(strImg As String, bSlide As Boolean) As Boolean
- Dim iW As Double, iH As Double, iRespond As Integer
- LoadImage = True
- isSlide = bSlide
- '** User load nothing
- If strImg = "" Then
- Image1.Picture = Nothing
- Image2.Picture = Nothing
- Image1.Visible = False
- Image2.Visible = False
- Exit Function
- End If
- If Not FrameView.Visible Then
- FrameView.Visible = True
- End If
- On Error GoTo ImageChoiceErr
- If FrameView.Width <> Width Or FrameView.Height <> Height Then
- TTLSlide_Resize
- End If
- '** Check which image to be use
- If Image1.Visible Then
- Image2.Stretch = False
- Image2.Picture = LoadPicture(strImg)
- Image2.ToolTipText = strImg
- iW = Image2.Picture.Width
- iH = Image2.Picture.Height
- '** Resize Image to fit in frame View
- ImgResize 2, iW, iH
- Else
- Image1.Stretch = False
- Image1.Picture = LoadPicture(strImg)
- Image1.ToolTipText = strImg
- iW = Image1.Picture.Width
- iH = Image1.Picture.Height
- ImgResize 1, iW, iH
- End If
- Exit Function
- ImageChoiceErr:
- LoadImage = False
- MsgBox "Photo Slide can not display this type of image." & Chr(13) & _
- "Please check the image's format.", vbCritical, "Error Loading Image"
- Exit Function
- End Function '** LoadImage
- Private Sub ImgResize(imgNum, iW, iH)
- Dim iMove As Double, iLeft As Double
- If imgNum = 1 Then
- Image1.Visible = False '** Hide while resize
- Image1.Stretch = True
-
- '** Calculate Width and Height
- If iW > iH Then
- Image1.Width = FrameView.Width * 0.9
- Image1.Height = (Image1.Width * (iH / iW))
- Image1.Left = FrameView.Width * 0.05
- Image1.Top = (FrameView.Height - Image1.Height) / 2
- Else
- Image1.Height = FrameView.Width * 0.9
- Image1.Width = (Image1.Height * (iW / iH))
- Image1.Top = FrameView.Width * 0.05
- Image1.Left = (FrameView.Width - Image1.Width) / 2
- End If
-
- Image1.Visible = True
- '** If image view in normal size, then use slide in feature
- If isSlide Then
- If Width < 7400 Then
- iLeft = Image1.Left
- iMove = Width
- Do While iMove > 0
- iMove = iMove - 50
-
- Image1.Left = iMove
- If Image1.Left < iLeft Then
- Image1.Left = iLeft
- Exit Do
- End If
- Loop
- End If
- End If
- '***************************
- Image2.Visible = False
-
- Else
- Image2.Visible = False '** Hide while resize
- Image2.Stretch = True
-
- '** Calculate Width and Height
- If iW > iH Then
- Image2.Width = FrameView.Width * 0.9
- Image2.Height = (Image2.Width * (iH / iW))
- Image2.Left = FrameView.Width * 0.05
- Image2.Top = (FrameView.Height - Image2.Height) / 2
- Else
- Image2.Height = FrameView.Height * 0.9
- Image2.Width = (Image2.Height * (iW / iH))
- Image2.Top = FrameView.Width * 0.05
- Image2.Left = (FrameView.Width - Image2.Width) / 2
- End If
- Image2.Visible = True
-
- '** If image view in normal size, then use slide in feature
- If isSlide Then
- If Width < 7400 Then
- iLeft = Image2.Left
- iMove = -Image2.Left
-
- Do While iMove <= iLeft
- iMove = iMove + 50
- Image2.Left = iMove
-
- If Image2.Left > iLeft Then
-
- Image2.Left = iLeft
- Exit Do
-
- End If
- Loop
- End If
- End If
-
- Image1.Visible = False
-
- End If
- End Sub '** ImgResize
- ''WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- ''MappingInfo=FrameView,FrameView,-1,BackColor
- 'Public Property Get BackColor() As OLE_COLOR
- ' BackColor = FrameView.BackColor
- 'End Property
- 'Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
- ' FrameView.BackColor() = New_BackColor
- ' PropertyChanged "BackColor"
- 'End Property
- 'Public Property Get ForeColor() As Long
- ' ForeColor = m_ForeColor
- 'End Property
- 'Public Property Let ForeColor(ByVal New_ForeColor As Long)
- ' m_ForeColor = New_ForeColor
- ' PropertyChanged "ForeColor"
- 'End Property
- Public Property Get Enabled() As Boolean
- Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."
- Enabled = m_Enabled
- End Property
- Public Property Let Enabled(ByVal New_Enabled As Boolean)
- m_Enabled = New_Enabled
- PropertyChanged "Enabled"
- End Property
- Public Property Get BackStyle() As Integer
- Attribute BackStyle.VB_Description = "Indicates whether a Label or the background of a Shape is transparent or opaque."
- BackStyle = m_BackStyle
- End Property
- Public Property Let BackStyle(ByVal New_BackStyle As Integer)
- m_BackStyle = New_BackStyle
- PropertyChanged "BackStyle"
- End Property
- Public Property Get BorderStyle() As Integer
- Attribute BorderStyle.VB_Description = "Returns/sets the border style for an object."
- BorderStyle = m_BorderStyle
- End Property
- Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)
- m_BorderStyle = New_BorderStyle
- PropertyChanged "BorderStyle"
- End Property
- Public Sub Refresh()
- Attribute Refresh.VB_Description = "Forces a complete repaint of a object."
- Dim iW As Double, iH As Double
- TTLSlide_Resize
- If Image1.Visible Then
- If Not Image1.Picture = Empty Then
- With Image1
-
- .Visible = False '** Hide while resize
-
- iW = .Picture.Width
- iH = .Picture.Height
- '** Calculate Width and Height
- If iW > iH Then
- .Width = FrameView.Width * 0.9
- .Height = (.Width * (iH / iW))
- .Left = FrameView.Width * 0.05
- .Top = (FrameView.Height - .Height) / 2
- Else
- .Height = FrameView.Width * 0.9
- .Width = (.Height * (iW / iH))
- .Top = FrameView.Width * 0.05
- .Left = (FrameView.Width - .Width) / 2
- End If
-
- .Visible = True
-
- End With
- End If
- Else
- If Not Image2.Picture = Empty Then
- With Image2
-
- .Visible = False '** Hide while resize
-
- iW = .Picture.Width
- iH = .Picture.Height
- '** Calculate Width and Height
- If iW > iH Then
- .Width = FrameView.Width * 0.9
- .Height = (.Width * (iH / iW))
- .Left = FrameView.Width * 0.05
- .Top = (FrameView.Height - .Height) / 2
- Else
- .Height = FrameView.Height * 0.9
- .Width = (.Height * (iW / iH))
- .Top = FrameView.Width * 0.05
- .Left = (FrameView.Width - .Width) / 2
- End If
-
- .Visible = True
-
- End With
- End If
- End If
- End Sub
- 'Private Sub Image2_Click()
- ' RaiseEvent Click
- 'End Sub
- 'Private Sub Image2_DblClick()
- ' RaiseEvent DblClick
- 'End Sub
- Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
- RaiseEvent KeyUp(KeyCode, Shift)
- End Sub
- 'Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- ' RaiseEvent MouseDown(Button, Shift, X, Y)
- 'End Sub
- 'Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'End Sub
- Private Sub UserControl_Show()
- RaiseEvent Show
- End Sub
- 'Public Property Get ToolTipText() As String
- ' ToolTipText = m_ToolTipText
- 'End Property
- 'Public Property Let ToolTipText(ByVal New_ToolTipText As String)
- ' m_ToolTipText = New_ToolTipText
- ' PropertyChanged "ToolTipText"
- 'End Property
- Public Property Get WhatsThisHelpID() As Long
- Attribute WhatsThisHelpID.VB_Description = "Returns/sets an associated context number for an object."
- WhatsThisHelpID = m_WhatsThisHelpID
- End Property
- Public Property Let WhatsThisHelpID(ByVal New_WhatsThisHelpID As Long)
- m_WhatsThisHelpID = New_WhatsThisHelpID
- PropertyChanged "WhatsThisHelpID"
- End Property
- 'Initialize Properties for User Control
- Private Sub UserControl_InitProperties()
- ' m_ForeColor = m_def_ForeColor
- m_Enabled = m_def_Enabled
- m_BackStyle = m_def_BackStyle
- m_BorderStyle = m_def_BorderStyle
- ' m_ToolTipText = m_def_ToolTipText
- m_WhatsThisHelpID = m_def_WhatsThisHelpID
- m_ToolTipText = m_def_ToolTipText
- End Sub
- 'Load property values from storage
- Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
- FrameView.BackColor = PropBag.ReadProperty("BackColor", &H8000000C)
- ' m_ForeColor = PropBag.ReadProperty("ForeColor", m_def_ForeColor)
- m_Enabled = PropBag.ReadProperty("Enabled", m_def_Enabled)
- m_BackStyle = PropBag.ReadProperty("BackStyle", m_def_BackStyle)
- m_BorderStyle = PropBag.ReadProperty("BorderStyle", m_def_BorderStyle)
- ' m_ToolTipText = PropBag.ReadProperty("ToolTipText", m_def_ToolTipText)
- m_WhatsThisHelpID = PropBag.ReadProperty("WhatsThisHelpID", m_def_WhatsThisHelpID)
- UserControl.BackColor = PropBag.ReadProperty("BackColor", &H808080)
- m_ToolTipText = PropBag.ReadProperty("ToolTipText", m_def_ToolTipText)
- End Sub
- 'Write property values to storage
- Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
- Call PropBag.WriteProperty("BackColor", FrameView.BackColor, &H8000000C)
- ' Call PropBag.WriteProperty("ForeColor", m_ForeColor, m_def_ForeColor)
- Call PropBag.WriteProperty("Enabled", m_Enabled, m_def_Enabled)
- Call PropBag.WriteProperty("BackStyle", m_BackStyle, m_def_BackStyle)
- Call PropBag.WriteProperty("BorderStyle", m_BorderStyle, m_def_BorderStyle)
- ' Call PropBag.WriteProperty("ToolTipText", m_ToolTipText, m_def_ToolTipText)
- Call PropBag.WriteProperty("WhatsThisHelpID", m_WhatsThisHelpID, m_def_WhatsThisHelpID)
- Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &H808080)
- Call PropBag.WriteProperty("ToolTipText", m_ToolTipText, m_def_ToolTipText)
- End Sub
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MappingInfo=UserControl,UserControl,-1,BackColor
- 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 = UserControl.BackColor
- End Property
- Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
- UserControl.BackColor() = New_BackColor
- PropertyChanged "BackColor"
- End Property
- Public Property Get ToolTipText() As String
- Attribute ToolTipText.VB_Description = "Returns/sets the text displayed when the mouse is paused over the control."
- ToolTipText = m_ToolTipText
- End Property
- Public Property Let ToolTipText(ByVal New_ToolTipText As String)
- m_ToolTipText = New_ToolTipText
- PropertyChanged "ToolTipText"
- End Property
-