home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch06 / coords / coords.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-02-20  |  15.6 KB  |  468 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form Scale Properties"
  4.    ClientHeight    =   5430
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   7710
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   5430
  10.    ScaleWidth      =   7710
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton Command1 
  13.       Caption         =   "User Coordinates"
  14.       BeginProperty Font 
  15.          Name            =   "Tahoma"
  16.          Size            =   9.75
  17.          Charset         =   0
  18.          Weight          =   400
  19.          Underline       =   0   'False
  20.          Italic          =   0   'False
  21.          Strikethrough   =   0   'False
  22.       EndProperty
  23.       Height          =   405
  24.       Left            =   360
  25.       TabIndex        =   15
  26.       Top             =   4680
  27.       Width           =   2235
  28.    End
  29.    Begin VB.TextBox YMax 
  30.       BeginProperty Font 
  31.          Name            =   "Times New Roman"
  32.          Size            =   9.75
  33.          Charset         =   0
  34.          Weight          =   400
  35.          Underline       =   0   'False
  36.          Italic          =   0   'False
  37.          Strikethrough   =   0   'False
  38.       EndProperty
  39.       Height          =   315
  40.       Left            =   1800
  41.       TabIndex        =   14
  42.       Top             =   3990
  43.       Width           =   735
  44.    End
  45.    Begin VB.TextBox YMin 
  46.       BeginProperty Font 
  47.          Name            =   "Times New Roman"
  48.          Size            =   9.75
  49.          Charset         =   0
  50.          Weight          =   400
  51.          Underline       =   0   'False
  52.          Italic          =   0   'False
  53.          Strikethrough   =   0   'False
  54.       EndProperty
  55.       Height          =   315
  56.       Left            =   360
  57.       TabIndex        =   13
  58.       Top             =   3990
  59.       Width           =   735
  60.    End
  61.    Begin VB.TextBox XMax 
  62.       BeginProperty Font 
  63.          Name            =   "Times New Roman"
  64.          Size            =   9.75
  65.          Charset         =   0
  66.          Weight          =   400
  67.          Underline       =   0   'False
  68.          Italic          =   0   'False
  69.          Strikethrough   =   0   'False
  70.       EndProperty
  71.       Height          =   315
  72.       Left            =   1800
  73.       TabIndex        =   12
  74.       Top             =   3300
  75.       Width           =   735
  76.    End
  77.    Begin VB.TextBox XMin 
  78.       BeginProperty Font 
  79.          Name            =   "Times New Roman"
  80.          Size            =   9.75
  81.          Charset         =   0
  82.          Weight          =   400
  83.          Underline       =   0   'False
  84.          Italic          =   0   'False
  85.          Strikethrough   =   0   'False
  86.       EndProperty
  87.       Height          =   315
  88.       Left            =   360
  89.       TabIndex        =   11
  90.       Top             =   3315
  91.       Width           =   735
  92.    End
  93.    Begin VB.PictureBox Picture1 
  94.       BackColor       =   &H0000FFFF&
  95.       Height          =   4845
  96.       Left            =   3000
  97.       ScaleHeight     =   239.25
  98.       ScaleMode       =   2  'Point
  99.       ScaleWidth      =   225.75
  100.       TabIndex        =   8
  101.       Top             =   405
  102.       Width           =   4575
  103.       Begin VB.Label Label8 
  104.          Alignment       =   1  'Right Justify
  105.          BackStyle       =   0  'Transparent
  106.          BeginProperty Font 
  107.             Name            =   "Tahoma"
  108.             Size            =   11.25
  109.             Charset         =   0
  110.             Weight          =   400
  111.             Underline       =   0   'False
  112.             Italic          =   0   'False
  113.             Strikethrough   =   0   'False
  114.          EndProperty
  115.          Height          =   240
  116.          Left            =   705
  117.          TabIndex        =   22
  118.          Top             =   4515
  119.          Width           =   3795
  120.       End
  121.       Begin VB.Label Label7 
  122.          BackStyle       =   0  'Transparent
  123.          BeginProperty Font 
  124.             Name            =   "Tahoma"
  125.             Size            =   11.25
  126.             Charset         =   0
  127.             Weight          =   400
  128.             Underline       =   0   'False
  129.             Italic          =   0   'False
  130.             Strikethrough   =   0   'False
  131.          EndProperty
  132.          Height          =   240
  133.          Left            =   0
  134.          TabIndex        =   21
  135.          Top             =   0
  136.          Width           =   3795
  137.       End
  138.    End
  139.    Begin VB.OptionButton Option8 
  140.       Caption         =   "Centimeter"
  141.       BeginProperty Font 
  142.          Name            =   "Tahoma"
  143.          Size            =   9.75
  144.          Charset         =   0
  145.          Weight          =   400
  146.          Underline       =   0   'False
  147.          Italic          =   0   'False
  148.          Strikethrough   =   0   'False
  149.       EndProperty
  150.       Height          =   270
  151.       Left            =   1440
  152.       TabIndex        =   7
  153.       Top             =   2040
  154.       Width           =   1275
  155.    End
  156.    Begin VB.OptionButton Option7 
  157.       Caption         =   "Millimeter"
  158.       BeginProperty Font 
  159.          Name            =   "Tahoma"
  160.          Size            =   9.75
  161.          Charset         =   0
  162.          Weight          =   400
  163.          Underline       =   0   'False
  164.          Italic          =   0   'False
  165.          Strikethrough   =   0   'False
  166.       EndProperty
  167.       Height          =   270
  168.       Left            =   210
  169.       TabIndex        =   6
  170.       Top             =   2040
  171.       Width           =   1155
  172.    End
  173.    Begin VB.OptionButton Option6 
  174.       Caption         =   "Inch"
  175.       BeginProperty Font 
  176.          Name            =   "Tahoma"
  177.          Size            =   9.75
  178.          Charset         =   0
  179.          Weight          =   400
  180.          Underline       =   0   'False
  181.          Italic          =   0   'False
  182.          Strikethrough   =   0   'False
  183.       EndProperty
  184.       Height          =   270
  185.       Left            =   1440
  186.       TabIndex        =   5
  187.       Top             =   1560
  188.       Width           =   795
  189.    End
  190.    Begin VB.OptionButton Option5 
  191.       Caption         =   "Character"
  192.       BeginProperty Font 
  193.          Name            =   "Tahoma"
  194.          Size            =   9.75
  195.          Charset         =   0
  196.          Weight          =   400
  197.          Underline       =   0   'False
  198.          Italic          =   0   'False
  199.          Strikethrough   =   0   'False
  200.       EndProperty
  201.       Height          =   270
  202.       Left            =   210
  203.       TabIndex        =   4
  204.       Top             =   1560
  205.       Width           =   1155
  206.    End
  207.    Begin VB.OptionButton Option4 
  208.       Caption         =   "Pixel"
  209.       BeginProperty Font 
  210.          Name            =   "Tahoma"
  211.          Size            =   9.75
  212.          Charset         =   0
  213.          Weight          =   400
  214.          Underline       =   0   'False
  215.          Italic          =   0   'False
  216.          Strikethrough   =   0   'False
  217.       EndProperty
  218.       Height          =   270
  219.       Left            =   1440
  220.       TabIndex        =   3
  221.       Top             =   1080
  222.       Width           =   795
  223.    End
  224.    Begin VB.OptionButton Option3 
  225.       Caption         =   "Point"
  226.       BeginProperty Font 
  227.          Name            =   "Tahoma"
  228.          Size            =   9.75
  229.          Charset         =   0
  230.          Weight          =   400
  231.          Underline       =   0   'False
  232.          Italic          =   0   'False
  233.          Strikethrough   =   0   'False
  234.       EndProperty
  235.       Height          =   270
  236.       Left            =   210
  237.       TabIndex        =   2
  238.       Top             =   1080
  239.       Width           =   795
  240.    End
  241.    Begin VB.OptionButton Option2 
  242.       Caption         =   "Twip"
  243.       BeginProperty Font 
  244.          Name            =   "Tahoma"
  245.          Size            =   9.75
  246.          Charset         =   0
  247.          Weight          =   400
  248.          Underline       =   0   'False
  249.          Italic          =   0   'False
  250.          Strikethrough   =   0   'False
  251.       EndProperty
  252.       Height          =   270
  253.       Left            =   1440
  254.       TabIndex        =   1
  255.       Top             =   600
  256.       Width           =   795
  257.    End
  258.    Begin VB.OptionButton Option1 
  259.       Caption         =   "User"
  260.       BeginProperty Font 
  261.          Name            =   "Tahoma"
  262.          Size            =   9.75
  263.          Charset         =   0
  264.          Weight          =   400
  265.          Underline       =   0   'False
  266.          Italic          =   0   'False
  267.          Strikethrough   =   0   'False
  268.       EndProperty
  269.       Height          =   270
  270.       Left            =   210
  271.       TabIndex        =   0
  272.       Top             =   645
  273.       Width           =   795
  274.    End
  275.    Begin VB.Frame Frame1 
  276.       Height          =   2535
  277.       Left            =   120
  278.       TabIndex        =   16
  279.       Top             =   2760
  280.       Width           =   2655
  281.       Begin VB.Label Label3 
  282.          Caption         =   "XMin"
  283.          BeginProperty Font 
  284.             Name            =   "Tahoma"
  285.             Size            =   9.75
  286.             Charset         =   0
  287.             Weight          =   400
  288.             Underline       =   0   'False
  289.             Italic          =   0   'False
  290.             Strikethrough   =   0   'False
  291.          EndProperty
  292.          Height          =   285
  293.          Left            =   240
  294.          TabIndex        =   20
  295.          Top             =   240
  296.          Width           =   690
  297.       End
  298.       Begin VB.Label Label4 
  299.          Caption         =   "XMax"
  300.          BeginProperty Font 
  301.             Name            =   "Tahoma"
  302.             Size            =   9.75
  303.             Charset         =   0
  304.             Weight          =   400
  305.             Underline       =   0   'False
  306.             Italic          =   0   'False
  307.             Strikethrough   =   0   'False
  308.          EndProperty
  309.          Height          =   240
  310.          Left            =   1680
  311.          TabIndex        =   19
  312.          Top             =   240
  313.          Width           =   720
  314.       End
  315.       Begin VB.Label Label5 
  316.          Caption         =   "YMin"
  317.          BeginProperty Font 
  318.             Name            =   "Tahoma"
  319.             Size            =   9.75
  320.             Charset         =   0
  321.             Weight          =   400
  322.             Underline       =   0   'False
  323.             Italic          =   0   'False
  324.             Strikethrough   =   0   'False
  325.          EndProperty
  326.          Height          =   240
  327.          Left            =   240
  328.          TabIndex        =   18
  329.          Top             =   960
  330.          Width           =   690
  331.       End
  332.       Begin VB.Label Label6 
  333.          Caption         =   "YMax"
  334.          BeginProperty Font 
  335.             Name            =   "Tahoma"
  336.             Size            =   9.75
  337.             Charset         =   0
  338.             Weight          =   400
  339.             Underline       =   0   'False
  340.             Italic          =   0   'False
  341.             Strikethrough   =   0   'False
  342.          EndProperty
  343.          Height          =   225
  344.          Left            =   1680
  345.          TabIndex        =   17
  346.          Top             =   945
  347.          Width           =   720
  348.       End
  349.    End
  350.    Begin VB.Frame Frame2 
  351.       Height          =   2175
  352.       Left            =   120
  353.       TabIndex        =   23
  354.       Top             =   360
  355.       Width           =   2655
  356.    End
  357.    Begin VB.Label Label2 
  358.       Caption         =   "Y"
  359.       BeginProperty Font 
  360.          Name            =   "Times New Roman"
  361.          Size            =   11.25
  362.          Charset         =   0
  363.          Weight          =   700
  364.          Underline       =   0   'False
  365.          Italic          =   0   'False
  366.          Strikethrough   =   0   'False
  367.       EndProperty
  368.       Height          =   240
  369.       Left            =   4920
  370.       TabIndex        =   10
  371.       Top             =   120
  372.       Width           =   1650
  373.    End
  374.    Begin VB.Label Label1 
  375.       Caption         =   "X"
  376.       BeginProperty Font 
  377.          Name            =   "Times New Roman"
  378.          Size            =   11.25
  379.          Charset         =   0
  380.          Weight          =   700
  381.          Underline       =   0   'False
  382.          Italic          =   0   'False
  383.          Strikethrough   =   0   'False
  384.       EndProperty
  385.       Height          =   240
  386.       Left            =   3000
  387.       TabIndex        =   9
  388.       Top             =   105
  389.       Width           =   1635
  390.    End
  391. Attribute VB_Name = "Form1"
  392. Attribute VB_GlobalNameSpace = False
  393. Attribute VB_Creatable = False
  394. Attribute VB_PredeclaredId = True
  395. Attribute VB_Exposed = False
  396. Option Explicit
  397. Dim currX, currY As Single
  398. Sub ShowSize()
  399.     Label7.Caption = "(" & Picture1.ScaleLeft & ", " & Picture1.ScaleTop & ")"
  400.     Label8.Caption = "(" & Picture1.ScaleLeft + Picture1.ScaleWidth & ", " & Picture1.ScaleTop + Picture1.ScaleHeight & ")"
  401. End Sub
  402. Private Sub Command1_Click()
  403.     If (Val(XMin.Text) = Val(XMax.Text)) Or (Val(YMin.Text) = Val(YMax.Text)) Then
  404.         MsgBox "Invalid user coordinate values"
  405.         Exit Sub
  406.     End If
  407.         
  408.     Picture1.Scale (Val(XMin.Text), Val(YMin.Text))-(Val(XMax.Text), Val(YMax.Text))
  409.     Option1.Value = True
  410.     ShowSize
  411. End Sub
  412. Private Sub Option1_Click()
  413.     Picture1.ScaleMode = 0
  414.     ShowSize
  415. End Sub
  416. Private Sub Option2_Click()
  417.     Label1.Caption = "X " & Format$(Picture1.ScaleX(currX, Picture1.ScaleMode, 1), "#.000")
  418.     Label2.Caption = "Y " & Format$(Picture1.ScaleY(currY, Picture1.ScaleMode, 1), "#.000")
  419.     Picture1.ScaleMode = 1
  420.     ShowSize
  421. End Sub
  422. Private Sub Option3_Click()
  423.     Label1.Caption = "X " & Format$(Picture1.ScaleX(currX, Picture1.ScaleMode, 1), "#.000")
  424.     Label2.Caption = "Y " & Format$(Picture1.ScaleY(currY, Picture1.ScaleMode, 1), "#.000")
  425.     Picture1.ScaleMode = 2
  426.     ShowSize
  427. End Sub
  428. Private Sub Option4_Click()
  429.     Label1.Caption = "X " & Format$(Picture1.ScaleX(currX, Picture1.ScaleMode, 1), "#.000")
  430.     Label2.Caption = "Y " & Format$(Picture1.ScaleY(currY, Picture1.ScaleMode, 1), "#.000")
  431.     Picture1.ScaleMode = 3
  432.     ShowSize
  433. End Sub
  434. Private Sub Option5_Click()
  435.     Label1.Caption = "X " & Format$(Picture1.ScaleX(currX, Picture1.ScaleMode, 1), "#.000")
  436.     Label2.Caption = "Y " & Format$(Picture1.ScaleY(currY, Picture1.ScaleMode, 1), "#.000")
  437.     Picture1.ScaleMode = 4
  438.     ShowSize
  439. End Sub
  440. Private Sub Option6_Click()
  441.     Label1.Caption = "X " & Format$(Picture1.ScaleX(currX, Picture1.ScaleMode, 1), "#.000")
  442.     Label2.Caption = "Y " & Format$(Picture1.ScaleY(currY, Picture1.ScaleMode, 1), "#.000")
  443.     Picture1.ScaleMode = 5
  444.     ShowSize
  445. End Sub
  446. Private Sub Option7_Click()
  447.     Label1.Caption = "X " & Format$(Picture1.ScaleX(currX, Picture1.ScaleMode, 1), "#.000")
  448.     Label2.Caption = "Y " & Format$(Picture1.ScaleY(currY, Picture1.ScaleMode, 1), "#.000")
  449.     Picture1.ScaleMode = 6
  450.     ShowSize
  451. End Sub
  452. Private Sub Option8_Click()
  453.     Label1.Caption = "X " & Format$(Picture1.ScaleX(currX, Picture1.ScaleMode, 1), "#.000")
  454.     Label2.Caption = "Y " & Format$(Picture1.ScaleY(currY, Picture1.ScaleMode, 1), "#.000")
  455.     Picture1.ScaleMode = 7
  456.     ShowSize
  457. End Sub
  458. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  459.     If Button <> 1 Then Exit Sub
  460.     Picture1.Refresh
  461.     Picture1.Line (X, Picture1.ScaleTop)-(X, Picture1.ScaleTop + Picture1.ScaleHeight)
  462.     Picture1.Line (Picture1.ScaleLeft, Y)-(Picture1.ScaleLeft + Picture1.ScaleWidth, Y)
  463.     Label1.Caption = "X " & Format$(X, "#.000")
  464.     Label2.Caption = "Y " & Format$(Y, "#.000")
  465.     currX = X
  466.     currY = Y
  467. End Sub
  468.