home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
- Object = "{52DE3A21-0A3F-11D4-B9D2-008048FD54E6}#2.0#0"; "POLARDraw20.ocx"
- Begin VB.Form Form1
- AutoRedraw = -1 'True
- BorderStyle = 1 'Fixed Single
- Caption = "Picture Viewer"
- ClientHeight = 4785
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 7575
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4785
- ScaleWidth = 7575
- StartUpPosition = 3 'Windows Default
- Begin POLARDRAW20Lib.POLARDraw POLARDraw1
- Height = 4260
- Left = 75
- TabIndex = 6
- Top = 75
- Width = 5340
- _Version = 131072
- _ExtentX = 9419
- _ExtentY = 7514
- _StockProps = 224
- BorderStyle = 1
- Appearance = 1
- PaperShadowColor= 0
- PaperOutlinecolor= 22910804
- DrawPaper = 0 'False
- DrawPaperOutline= -1 'True
- DrawPaperShadow = -1 'True
- PaperShadowOffset= 0
- ViewportOriginX = 22910804
- ViewportOriginY = 22881044
- PageOriginX = 1
- PageOriginY = 103421157
- HorizontalGrid = 567
- VerticalGrid = 567
- ShowVerticalRuler= 0 'False
- ShowHorizontalRuler= 0 'False
- SelectionCount = 22740992
- ShapeCount = 22742704
- CanvasWidth = 536873485
- CanvasHeight = 0
- End
- Begin ComctlLib.Slider Slider1
- Height = 225
- Left = 6480
- TabIndex = 4
- Top = 4425
- Width = 990
- _ExtentX = 1746
- _ExtentY = 397
- _Version = 327682
- Min = 10
- Max = 400
- SelStart = 50
- TickFrequency = 50
- Value = 50
- End
- Begin VB.FileListBox File1
- Height = 2430
- Left = 5505
- Pattern = "*.bmp;*.gif;*.jpg;*.wmf;*.emf"
- TabIndex = 2
- Top = 1920
- Width = 1965
- End
- Begin VB.DirListBox Dir1
- Height = 1440
- Left = 5520
- TabIndex = 1
- Top = 450
- Width = 1965
- End
- Begin VB.DriveListBox Drive1
- Height = 315
- Left = 5520
- TabIndex = 0
- Top = 105
- Width = 1965
- End
- Begin VB.Label lblZoom
- Caption = "Zoom:"
- Height = 255
- Left = 5505
- TabIndex = 5
- Top = 4425
- Width = 1035
- End
- Begin VB.Label Label1
- Caption = "Label1"
- Height = 255
- Left = 120
- TabIndex = 3
- Top = 4425
- Width = 5280
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim Shape As POLARDRAW20Lib.Shape
- Dim lID As Long
- Private Sub Drive1_Change()
- Dir1.Path = Drive1.Drive
- End Sub
- Private Sub File1_Click()
- 'Selection of picture in File1 FileListBox causes viewing that picture
- 'in POLARDraw window.
- Dim string1 As String
- Let string1 = Dir1.Path
- If Len(string1) > 3 Then
- Let string1 = string1 & "\"
- End If
- Label1.Caption = "Picture: " & string1 & File1.FileName
- On Error GoTo res
- Set Pic = LoadPicture(string1 & File1.FileName)
- POLARDraw1.EnableRendering = False
- 'Positions of Shape borders are set to dimensions of selected picure.
- 'Top and Left borders of shape are fixed.
- Shape.Right = Shape.Left + Pic.Width
- Shape.Bottom = Shape.Top + Pic.Height
- Shape.Select
- 'Active window is set to fit to selection. Zoom is also updated by FitTo method.
- POLARDraw1.ActiveWindow.FitTo polFitToSelection
- 'Shape object will still exists after Clear method.
- POLARDraw1.ActivePage.Selection.Clear
- UpdateZoom
- Shape.IsFilled = True
- Shape.Fill.SetPictureFromObject Pic
- POLARDraw1.EnableRendering = True
- POLARDraw1.Render
- Exit Sub
- POLARDraw1.EnableRendering = True
- Shape.IsFilled = False
- End Sub
- Private Sub File1_PathChange()
- ' Shows path in Label1.
- Label1.Caption = "Picture: " & Dir1.Path
- End Sub
- Private Sub Dir1_Change()
- ' Sets file path.
- File1.Path = Dir1.Path
- End Sub
- Private Sub Form_Load()
- Label1.Caption = "Please select a picture"
- POLARDraw1.EnableRendering = False
- POLARDraw1.MeasurementUnits = polUnitsTwips
- POLARDraw1.ActiveWindow.Environment.RulerMeasurementUnits = polUnitsPixel
- 'Object Shape is set to rectangular shape whose up left vertex has
- 'coordinates (0,0) and down right vertex has coordinates (100,100).
- Set Shape = POLARDraw1.ActivePage.Shapes.Add(1, 0, 0, 100, 100)
- Shape.HasLine = False
- Shape.IsFilled = False
- 'That shape is selected.
- Shape.Select
- 'Active window is set to fit to selection (in this case Shape's area).
- 'Zoom is also updated by FitTo method.
- POLARDraw1.ActiveWindow.FitTo polFitToSelection
- 'Selection is cleared (Shape is removed from selection).Shape object will still exists after Clear method.
- POLARDraw1.ActivePage.Selection.Clear
- UpdateZoom
- Slider1.Value = POLARDraw1.Zoom
- POLARDraw1.EnableRendering = True
- POLARDraw1.Render
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Set Shape = Nothing
- End Sub
- Private Sub Slider1_Scroll()
- 'Zoom is set to value specified by Slider.
- POLARDraw1.ActiveWindow.Environment.Zoom = Slider1.Value
- lblZoom.Caption = "Zoom: " & Slider1.Value & "%"
- End Sub
- Private Sub UpdateZoom()
- 'Zoom has to be between 10 and 400,
- 'because Slider min and max values are set to 10 and 400.
- If POLARDraw1.ActiveWindow.Environment.Zoom < 10 Then
- POLARDraw1.ActiveWindow.Environment.Zoom = 10
- End If
- If POLARDraw1.ActiveWindow.Environment.Zoom > 400 Then
- POLARDraw1.ActiveWindow.Environment.Zoom = 400
- End If
- 'Slider value is updated to be equal to right zoom for chosen picture.
- Slider1.Value = POLARDraw1.ActiveWindow.Environment.Zoom
- lblZoom.Caption = "Zoom: " & Slider1.Value & "%"
- End Sub
-