home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / fg / fgdraw.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-11-03  |  88.3 KB  |  2,656 lines

  1. VERSION 2.00
  2. Begin Form frmFGDrawDemo 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "FG Draw Demo"
  5.    ClientHeight    =   6000
  6.    ClientLeft      =   630
  7.    ClientTop       =   1425
  8.    ClientWidth     =   8445
  9.    Height          =   6690
  10.    HelpContextID   =   1
  11.    Icon            =   FGDRAW.FRX:0000
  12.    Left            =   570
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   400
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   563
  17.    Top             =   795
  18.    Width           =   8565
  19.    Begin SSPanel pnlAttribBar 
  20.       BackColor       =   &H00C0C0C0&
  21.       BevelInner      =   1  'Inset
  22.       BorderWidth     =   2
  23.       Font3D          =   0  'None
  24.       Height          =   1050
  25.       HelpContextID   =   14
  26.       Left            =   -15
  27.       TabIndex        =   8
  28.       Top             =   4830
  29.       Width           =   8415
  30.       Begin CommonDialog CMDialog1 
  31.          Prop12          =   ""
  32.          Prop27          =   ""
  33.          Prop28          =   FGDRAW.FRX:0302
  34.          Action          =   0  'Nothing
  35.          CancelError     =   0   'False
  36.          Color           =   &H00000000&
  37.          Copies          =   0
  38.          DefaultExt      =   ""
  39.          DialogTitle     =   ""
  40.          Filename        =   ""
  41.          Filetitle       =   ""
  42.          Filter          =   ""
  43.          FilterIndex     =   0
  44.          Flags           =   0
  45.          FontBold        =   0   'False
  46.          FontItalic      =   0   'False
  47.          FontName        =   ""
  48.          FontSize        =   8
  49.          FontStrikeThru  =   0   'False
  50.          FontUnderLine   =   0   'False
  51.          FromPage        =   0
  52.          HelpCommand     =   0
  53.          HelpContext     =   0
  54.          HelpFile        =   ""
  55.          HelpKey         =   ""
  56.          InitDir         =   ""
  57.          Max             =   0
  58.          MaxFileSize     =   256
  59.          Min             =   0
  60.          PrinterDefault  =   -1  'True
  61.          ToPage          =   0
  62.       End
  63.       Begin PictureBox picColorBtns 
  64.          BackColor       =   &H00C0C0C0&
  65.          BorderStyle     =   0  'None
  66.          ClipControls    =   0   'False
  67.          Height          =   930
  68.          HelpContextID   =   15
  69.          Left            =   4290
  70.          ScaleHeight     =   62
  71.          ScaleMode       =   3  'Pixel
  72.          ScaleWidth      =   186
  73.          TabIndex        =   18
  74.          Tag             =   "TT:[Select a Color (DblClick to Edit)]"
  75.          Top             =   60
  76.          Width           =   2790
  77.          Begin FG FG2 
  78.             Height          =   420
  79.             Left            =   30
  80.             Top             =   315
  81.             Width           =   420
  82.          End
  83.       End
  84.       Begin CommandButton cmdSelectFont 
  85.          BackColor       =   &H00C0C0C0&
  86.          Caption         =   "Font"
  87.          FontBold        =   -1  'True
  88.          FontItalic      =   0   'False
  89.          FontName        =   "System"
  90.          FontSize        =   9.75
  91.          FontStrikethru  =   0   'False
  92.          FontUnderline   =   0   'False
  93.          Height          =   315
  94.          HelpContextID   =   17
  95.          Left            =   2655
  96.          TabIndex        =   17
  97.          Tag             =   "TT:[Set Font Attributes]"
  98.          Top             =   600
  99.          Width           =   975
  100.       End
  101.       Begin SSPanel Panel3D4 
  102.          BackColor       =   &H00C0C0C0&
  103.          BevelInner      =   1  'Inset
  104.          BorderWidth     =   1
  105.          Font3D          =   0  'None
  106.          Height          =   480
  107.          HelpContextID   =   18
  108.          Left            =   2655
  109.          TabIndex        =   16
  110.          Top             =   75
  111.          Width           =   1005
  112.          Begin SSRibbon grbTransparent 
  113.             BackColor       =   &H00C0C0C0&
  114.             GroupAllowAllUp =   0   'False
  115.             GroupNumber     =   7
  116.             Height          =   390
  117.             HelpContextID   =   19
  118.             Left            =   495
  119.             PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  120.             PictureUp       =   FGDRAW.FRX:030A
  121.             RoundedCorners  =   0   'False
  122.             Tag             =   "TT:[Transparent]"
  123.             Top             =   45
  124.             Value           =   -1  'True
  125.             Width           =   465
  126.          End
  127.          Begin SSRibbon grbOpaque 
  128.             BackColor       =   &H00C0C0C0&
  129.             GroupAllowAllUp =   0   'False
  130.             GroupNumber     =   7
  131.             Height          =   390
  132.             HelpContextID   =   20
  133.             Left            =   45
  134.             PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  135.             PictureUp       =   FGDRAW.FRX:04C4
  136.             RoundedCorners  =   0   'False
  137.             Tag             =   "TT:[Opaque]"
  138.             Top             =   45
  139.             Width           =   465
  140.          End
  141.       End
  142.       Begin SSPanel Panel3D3 
  143.          BackColor       =   &H00C0C0C0&
  144.          BevelInner      =   1  'Inset
  145.          BorderWidth     =   1
  146.          Font3D          =   0  'None
  147.          Height          =   900
  148.          HelpContextID   =   21
  149.          Left            =   1755
  150.          MousePointer    =   10  'Up Arrow
  151.          TabIndex        =   15
  152.          Tag             =   "TT:[Select a Fill Style]"
  153.          Top             =   75
  154.          Width           =   885
  155.          Begin Shape Shape4 
  156.             BorderColor     =   &H00000000&
  157.             BorderStyle     =   0  'Transparent
  158.             DrawMode        =   10  'Not Xor Pen
  159.             FillStyle       =   0  'Solid
  160.             Height          =   255
  161.             Left            =   60
  162.             Top             =   315
  163.             Width           =   255
  164.          End
  165.          Begin Shape Shape3 
  166.             FillStyle       =   7  'Diagonal Cross
  167.             Height          =   225
  168.             Index           =   7
  169.             Left            =   585
  170.             Top             =   330
  171.             Width           =   225
  172.          End
  173.          Begin Shape Shape3 
  174.             FillStyle       =   6  'Cross
  175.             Height          =   225
  176.             Index           =   6
  177.             Left            =   585
  178.             Top             =   75
  179.             Width           =   225
  180.          End
  181.          Begin Shape Shape3 
  182.             FillStyle       =   5  'Downward Diagonal
  183.             Height          =   225
  184.             Index           =   5
  185.             Left            =   330
  186.             Top             =   585
  187.             Width           =   225
  188.          End
  189.          Begin Shape Shape3 
  190.             FillStyle       =   4  'Upward Diagonal
  191.             Height          =   225
  192.             Index           =   4
  193.             Left            =   330
  194.             Top             =   330
  195.             Width           =   225
  196.          End
  197.          Begin Shape Shape3 
  198.             FillStyle       =   3  'Vertical Line
  199.             Height          =   225
  200.             Index           =   3
  201.             Left            =   330
  202.             Top             =   75
  203.             Width           =   225
  204.          End
  205.          Begin Shape Shape3 
  206.             FillStyle       =   2  'Horizontal Line
  207.             Height          =   225
  208.             Index           =   2
  209.             Left            =   75
  210.             Top             =   585
  211.             Width           =   225
  212.          End
  213.          Begin Shape Shape3 
  214.             Height          =   225
  215.             Index           =   1
  216.             Left            =   75
  217.             Top             =   330
  218.             Width           =   225
  219.          End
  220.          Begin Shape Shape3 
  221.             FillStyle       =   0  'Solid
  222.             Height          =   225
  223.             Index           =   0
  224.             Left            =   75
  225.             Top             =   75
  226.             Width           =   225
  227.          End
  228.       End
  229.       Begin SSPanel Panel3D2 
  230.          BackColor       =   &H00C0C0C0&
  231.          BevelInner      =   1  'Inset
  232.          BorderWidth     =   1
  233.          Font3D          =   0  'None
  234.          Height          =   900
  235.          HelpContextID   =   22
  236.          Left            =   1005
  237.          MousePointer    =   10  'Up Arrow
  238.          TabIndex        =   14
  239.          Tag             =   "TT:[Select a Border Width]"
  240.          Top             =   75
  241.          Width           =   735
  242.          Begin TextBox txtBorderWidth 
  243.             Height          =   285
  244.             HelpContextID   =   23
  245.             Left            =   195
  246.             MousePointer    =   3  'I-Beam
  247.             TabIndex        =   19
  248.             Text            =   "32"
  249.             Top             =   555
  250.             Width           =   465
  251.          End
  252.          Begin Line Line2 
  253.             BorderWidth     =   8
  254.             Index           =   5
  255.             X1              =   270
  256.             X2              =   600
  257.             Y1              =   660
  258.             Y2              =   660
  259.          End
  260.          Begin Shape Shape2 
  261.             FillStyle       =   0  'Solid
  262.             Height          =   60
  263.             Left            =   60
  264.             Shape           =   3  'Circle
  265.             Top             =   90
  266.             Width           =   60
  267.          End
  268.          Begin Line Line2 
  269.             Index           =   1
  270.             X1              =   270
  271.             X2              =   600
  272.             Y1              =   165
  273.             Y2              =   165
  274.          End
  275.          Begin Line Line2 
  276.             BorderWidth     =   2
  277.             Index           =   2
  278.             X1              =   270
  279.             X2              =   600
  280.             Y1              =   240
  281.             Y2              =   240
  282.          End
  283.          Begin Line Line2 
  284.             BorderWidth     =   4
  285.             Index           =   3
  286.             X1              =   270
  287.             X2              =   600
  288.             Y1              =   330
  289.             Y2              =   330
  290.          End
  291.          Begin Line Line2 
  292.             BorderWidth     =   8
  293.             Index           =   4
  294.             X1              =   270
  295.             X2              =   600
  296.             Y1              =   450
  297.             Y2              =   450
  298.          End
  299.          Begin Line Line2 
  300.             BorderColor     =   &H00000000&
  301.             Index           =   0
  302.             X1              =   270
  303.             X2              =   600
  304.             Y1              =   90
  305.             Y2              =   90
  306.          End
  307.       End
  308.       Begin SSPanel Panel3D1 
  309.          BackColor       =   &H00C0C0C0&
  310.          BevelInner      =   1  'Inset
  311.          BorderWidth     =   1
  312.          Font3D          =   0  'None
  313.          Height          =   900
  314.          HelpContextID   =   24
  315.          Left            =   75
  316.          MousePointer    =   10  'Up Arrow
  317.          TabIndex        =   13
  318.          Tag             =   "TT:[Select Bordere Style]"
  319.          Top             =   75
  320.          Width           =   915
  321.          Begin Line Line1 
  322.             BorderColor     =   &H00000000&
  323.             Index           =   0
  324.             Tag             =   "TT:[Solid Line]"
  325.             X1              =   240
  326.             X2              =   840
  327.             Y1              =   120
  328.             Y2              =   120
  329.          End
  330.          Begin Line Line1 
  331.             BorderStyle     =   6  'Inside Solid
  332.             Index           =   6
  333.             X1              =   240
  334.             X2              =   840
  335.             Y1              =   750
  336.             Y2              =   750
  337.          End
  338.          Begin Line Line1 
  339.             BorderColor     =   &H00808080&
  340.             Index           =   5
  341.             X1              =   240
  342.             X2              =   840
  343.             Y1              =   645
  344.             Y2              =   645
  345.          End
  346.          Begin Line Line1 
  347.             BorderStyle     =   5  'Dash-Dot-Dot
  348.             Index           =   4
  349.             X1              =   240
  350.             X2              =   840
  351.             Y1              =   540
  352.             Y2              =   540
  353.          End
  354.          Begin Line Line1 
  355.             BorderStyle     =   4  'Dash-Dot
  356.             Index           =   3
  357.             X1              =   240
  358.             X2              =   840
  359.             Y1              =   435
  360.             Y2              =   435
  361.          End
  362.          Begin Line Line1 
  363.             BorderStyle     =   3  'Dot
  364.             Index           =   2
  365.             X1              =   240
  366.             X2              =   840
  367.             Y1              =   330
  368.             Y2              =   330
  369.          End
  370.          Begin Line Line1 
  371.             BorderStyle     =   2  'Dash
  372.             Index           =   1
  373.             X1              =   240
  374.             X2              =   840
  375.             Y1              =   225
  376.             Y2              =   225
  377.          End
  378.          Begin Shape Shape1 
  379.             FillStyle       =   0  'Solid
  380.             Height          =   60
  381.             Left            =   105
  382.             Shape           =   3  'Circle
  383.             Top             =   105
  384.             Width           =   60
  385.          End
  386.       End
  387.       Begin Label Label2 
  388.          Alignment       =   1  'Right Justify
  389.          BackStyle       =   0  'Transparent
  390.          Caption         =   "Back"
  391.          Height          =   180
  392.          Index           =   3
  393.          Left            =   3630
  394.          TabIndex        =   12
  395.          Top             =   765
  396.          Width           =   660
  397.       End
  398.       Begin Label Label2 
  399.          Alignment       =   1  'Right Justify
  400.          BackStyle       =   0  'Transparent
  401.          Caption         =   "Font"
  402.          Height          =   180
  403.          Index           =   2
  404.          Left            =   3630
  405.          TabIndex        =   11
  406.          Top             =   555
  407.          Width           =   660
  408.       End
  409.       Begin Label Label2 
  410.          Alignment       =   1  'Right Justify
  411.          BackStyle       =   0  'Transparent
  412.          Caption         =   "Fill"
  413.          Height          =   180
  414.          Index           =   1
  415.          Left            =   3645
  416.          TabIndex        =   10
  417.          Top             =   300
  418.          Width           =   630
  419.       End
  420.       Begin Label Label2 
  421.          Alignment       =   1  'Right Justify
  422.          BackStyle       =   0  'Transparent
  423.          Caption         =   "Border"
  424.          Height          =   180
  425.          Index           =   0
  426.          Left            =   3645
  427.          TabIndex        =   9
  428.          Top             =   75
  429.          Width           =   645
  430.       End
  431.    End
  432.    Begin PictureBox picDrawSpace 
  433.       BackColor       =   &H00FFFFFF&
  434.       ClipControls    =   0   'False
  435.       FillColor       =   &H000000FF&
  436.       FillStyle       =   0  'Solid
  437.       FontBold        =   -1  'True
  438.       FontItalic      =   0   'False
  439.       FontName        =   "System"
  440.       FontSize        =   78
  441.       FontStrikethru  =   -1  'True
  442.       FontUnderline   =   0   'False
  443.       ForeColor       =   &H00FF0000&
  444.       Height          =   4665
  445.       HelpContextID   =   25
  446.       Left            =   1605
  447.       ScaleHeight     =   309
  448.       ScaleMode       =   3  'Pixel
  449.       ScaleWidth      =   439
  450.       TabIndex        =   2
  451.       Top             =   60
  452.       Width           =   6615
  453.       Begin FG FG1 
  454.          Height          =   420
  455.          Left            =   120
  456.          Top             =   120
  457.          Width           =   420
  458.       End
  459.    End
  460.    Begin PictureBox picButtonBarBorder 
  461.       Align           =   2  'Align Bottom
  462.       Height          =   15
  463.       HelpContextID   =   27
  464.       Left            =   0
  465.       ScaleHeight     =   0
  466.       ScaleWidth      =   8415
  467.       TabIndex        =   1
  468.       Top             =   5985
  469.       Width           =   8445
  470.    End
  471.    Begin SSPanel pnlButtonBar 
  472.       BackColor       =   &H00C0C0C0&
  473.       BevelInner      =   1  'Inset
  474.       BorderWidth     =   2
  475.       Font3D          =   0  'None
  476.       Height          =   4770
  477.       HelpContextID   =   28
  478.       Left            =   0
  479.       TabIndex        =   0
  480.       Top             =   15
  481.       Width           =   1395
  482.       Begin SSCommand cmdDeleteGraphic 
  483.          Caption         =   "-"
  484.          Font3D          =   0  'None
  485.          FontBold        =   -1  'True
  486.          FontItalic      =   0   'False
  487.          FontName        =   "System"
  488.          FontSize        =   19.5
  489.          FontStrikethru  =   0   'False
  490.          FontUnderline   =   0   'False
  491.          Height          =   330
  492.          HelpContextID   =   29
  493.          Left            =   1005
  494.          Picture         =   FGDRAW.FRX:067E
  495.          RoundedCorners  =   0   'False
  496.          TabIndex        =   28
  497.          Tag             =   "TT:[Zoom OUt]"
  498.          Top             =   60
  499.          Width           =   330
  500.       End
  501.       Begin SSCommand cmdPageDown 
  502.          Font3D          =   0  'None
  503.          Height          =   330
  504.          HelpContextID   =   30
  505.          Left            =   540
  506.          Picture         =   FGDRAW.FRX:0778
  507.          RoundedCorners  =   0   'False
  508.          TabIndex        =   27
  509.          Top             =   4110
  510.          Width           =   330
  511.       End
  512.       Begin SSCommand cmdStepDown 
  513.          Font3D          =   0  'None
  514.          Height          =   330
  515.          HelpContextID   =   31
  516.          Left            =   540
  517.          Picture         =   FGDRAW.FRX:0872
  518.          RoundedCorners  =   0   'False
  519.          TabIndex        =   26
  520.          Top             =   3795
  521.          Width           =   330
  522.       End
  523.       Begin SSCommand cmdPageRight 
  524.          Font3D          =   0  'None
  525.          Height          =   330
  526.          HelpContextID   =   32
  527.          Left            =   1005
  528.          Picture         =   FGDRAW.FRX:096C
  529.          RoundedCorners  =   0   'False
  530.          TabIndex        =   25
  531.          Top             =   3480
  532.          Width           =   330
  533.       End
  534.       Begin SSCommand cmdStepRight 
  535.          Font3D          =   0  'None
  536.          Height          =   330
  537.          HelpContextID   =   33
  538.          Left            =   690
  539.          Picture         =   FGDRAW.FRX:0A66
  540.          RoundedCorners  =   0   'False
  541.          TabIndex        =   24
  542.          Top             =   3480
  543.          Width           =   330
  544.       End
  545.       Begin SSCommand cmdStepLeft 
  546.          Font3D          =   0  'None
  547.          Height          =   330
  548.          HelpContextID   =   34
  549.          Left            =   375
  550.          Picture         =   FGDRAW.FRX:0B60
  551.          RoundedCorners  =   0   'False
  552.          TabIndex        =   23
  553.          Top             =   3480
  554.          Width           =   330
  555.       End
  556.       Begin SSCommand cmdStepUp 
  557.          Font3D          =   0  'None
  558.          Height          =   330
  559.          HelpContextID   =   35
  560.          Left            =   540
  561.          Picture         =   FGDRAW.FRX:0C5A
  562.          RoundedCorners  =   0   'False
  563.          TabIndex        =   22
  564.          Top             =   3165
  565.          Width           =   330
  566.       End
  567.       Begin SSCommand cmdPageUp 
  568.          Font3D          =   0  'None
  569.          Height          =   330
  570.          HelpContextID   =   36
  571.          Left            =   540
  572.          Picture         =   FGDRAW.FRX:0D54
  573.          RoundedCorners  =   0   'False
  574.          TabIndex        =   21
  575.          Top             =   2850
  576.          Width           =   330
  577.       End
  578.       Begin SSCommand cmdPageLeft 
  579.          Font3D          =   0  'None
  580.          Height          =   330
  581.          HelpContextID   =   37
  582.          Left            =   60
  583.          Picture         =   FGDRAW.FRX:0E4E
  584.          RoundedCorners  =   0   'False
  585.          TabIndex        =   20
  586.          Top             =   3480
  587.          Width           =   330
  588.       End
  589.       Begin SSRibbon grbDrawTool 
  590.          BackColor       =   &H00C0C0C0&
  591.          GroupAllowAllUp =   0   'False
  592.          Height          =   330
  593.          HelpContextID   =   38
  594.          Index           =   8
  595.          Left            =   1005
  596.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  597.          PictureUp       =   FGDRAW.FRX:0F48
  598.          RoundedCorners  =   0   'False
  599.          Tag             =   "TT:[Polyline]"
  600.          Top             =   795
  601.          Width           =   330
  602.       End
  603.       Begin SSCheck chkKeepAspectRatio 
  604.          Font3D          =   0  'None
  605.          Height          =   255
  606.          HelpContextID   =   39
  607.          Left            =   105
  608.          TabIndex        =   7
  609.          Top             =   1935
  610.          Value           =   -1  'True
  611.          Width           =   240
  612.       End
  613.       Begin SSRibbon grbDrawTool 
  614.          BackColor       =   &H00C0C0C0&
  615.          GroupAllowAllUp =   0   'False
  616.          Height          =   330
  617.          HelpContextID   =   38
  618.          Index           =   15
  619.          Left            =   690
  620.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  621.          PictureUp       =   FGDRAW.FRX:1042
  622.          RoundedCorners  =   0   'False
  623.          Tag             =   "TT:[Zoom In]"
  624.          Top             =   1425
  625.          Width           =   330
  626.       End
  627.       Begin SSCommand cdmZoomOut 
  628.          Caption         =   "-"
  629.          Font3D          =   0  'None
  630.          FontBold        =   -1  'True
  631.          FontItalic      =   0   'False
  632.          FontName        =   "System"
  633.          FontSize        =   19.5
  634.          FontStrikethru  =   0   'False
  635.          FontUnderline   =   0   'False
  636.          Height          =   330
  637.          HelpContextID   =   40
  638.          Left            =   1005
  639.          RoundedCorners  =   0   'False
  640.          TabIndex        =   5
  641.          Tag             =   "TT:[Zoom OUt]"
  642.          Top             =   1425
  643.          Width           =   330
  644.       End
  645.       Begin SSRibbon grbDrawTool 
  646.          BackColor       =   &H00C0C0C0&
  647.          GroupAllowAllUp =   0   'False
  648.          Height          =   330
  649.          HelpContextID   =   38
  650.          Index           =   14
  651.          Left            =   375
  652.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  653.          PictureUp       =   FGDRAW.FRX:113C
  654.          RoundedCorners  =   0   'False
  655.          Tag             =   "TT:[Free Hand Draw]"
  656.          Top             =   1425
  657.          Width           =   330
  658.       End
  659.       Begin SSRibbon grbDrawTool 
  660.          BackColor       =   &H00C0C0C0&
  661.          GroupAllowAllUp =   0   'False
  662.          Height          =   330
  663.          HelpContextID   =   38
  664.          Index           =   13
  665.          Left            =   60
  666.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  667.          PictureUp       =   FGDRAW.FRX:1236
  668.          RoundedCorners  =   0   'False
  669.          Tag             =   "TT:[TextOut"
  670.          Top             =   1425
  671.          Width           =   330
  672.       End
  673.       Begin SSRibbon grbDrawTool 
  674.          BackColor       =   &H00C0C0C0&
  675.          GroupAllowAllUp =   0   'False
  676.          Height          =   330
  677.          HelpContextID   =   38
  678.          Index           =   12
  679.          Left            =   1005
  680.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  681.          PictureUp       =   FGDRAW.FRX:1330
  682.          RoundedCorners  =   0   'False
  683.          Tag             =   "TT:[RoundRect]"
  684.          Top             =   1110
  685.          Width           =   330
  686.       End
  687.       Begin SSRibbon grbDrawTool 
  688.          BackColor       =   &H00C0C0C0&
  689.          GroupAllowAllUp =   0   'False
  690.          Height          =   330
  691.          HelpContextID   =   38
  692.          Index           =   11
  693.          Left            =   690
  694.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  695.          PictureUp       =   FGDRAW.FRX:142A
  696.          RoundedCorners  =   0   'False
  697.          Tag             =   "TT:[Rectangle]"
  698.          Top             =   1110
  699.          Width           =   330
  700.       End
  701.       Begin SSRibbon grbDrawTool 
  702.          BackColor       =   &H00C0C0C0&
  703.          GroupAllowAllUp =   0   'False
  704.          Height          =   330
  705.          HelpContextID   =   38
  706.          Index           =   10
  707.          Left            =   375
  708.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  709.          PictureUp       =   FGDRAW.FRX:1524
  710.          RoundedCorners  =   0   'False
  711.          Tag             =   "TT:[PolyTextOut]"
  712.          Top             =   1110
  713.          Width           =   330
  714.       End
  715.       Begin SSRibbon grbDrawTool 
  716.          BackColor       =   &H00C0C0C0&
  717.          GroupAllowAllUp =   0   'False
  718.          Height          =   330
  719.          HelpContextID   =   38
  720.          Index           =   9
  721.          Left            =   60
  722.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  723.          PictureUp       =   FGDRAW.FRX:161E
  724.          RoundedCorners  =   0   'False
  725.          Tag             =   "TT:[PolyPolygon]"
  726.          Top             =   1110
  727.          Width           =   330
  728.       End
  729.       Begin SSRibbon grbDrawTool 
  730.          BackColor       =   &H00C0C0C0&
  731.          GroupAllowAllUp =   0   'False
  732.          Height          =   330
  733.          HelpContextID   =   38
  734.          Index           =   7
  735.          Left            =   690
  736.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  737.          PictureUp       =   FGDRAW.FRX:1718
  738.          RoundedCorners  =   0   'False
  739.          Tag             =   "TT:[Pie]"
  740.          Top             =   795
  741.          Width           =   330
  742.       End
  743.       Begin SSRibbon grbDrawTool 
  744.          BackColor       =   &H00C0C0C0&
  745.          GroupAllowAllUp =   0   'False
  746.          Height          =   330
  747.          HelpContextID   =   38
  748.          Index           =   6
  749.          Left            =   375
  750.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  751.          PictureUp       =   FGDRAW.FRX:1812
  752.          RoundedCorners  =   0   'False
  753.          Tag             =   "TT:[Polygon]"
  754.          Top             =   795
  755.          Width           =   330
  756.       End
  757.       Begin SSRibbon grbDrawTool 
  758.          BackColor       =   &H00C0C0C0&
  759.          GroupAllowAllUp =   0   'False
  760.          Height          =   330
  761.          HelpContextID   =   38
  762.          Index           =   5
  763.          Left            =   60
  764.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  765.          PictureUp       =   FGDRAW.FRX:190C
  766.          RoundedCorners  =   0   'False
  767.          Tag             =   "TT:[Line]"
  768.          Top             =   795
  769.          Width           =   330
  770.       End
  771.       Begin SSRibbon grbDrawTool 
  772.          BackColor       =   &H00C0C0C0&
  773.          GroupAllowAllUp =   0   'False
  774.          Height          =   330
  775.          HelpContextID   =   38
  776.          Index           =   4
  777.          Left            =   1005
  778.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  779.          PictureUp       =   FGDRAW.FRX:1A06
  780.          RoundedCorners  =   0   'False
  781.          Tag             =   "TT:[Ellipse]"
  782.          Top             =   480
  783.          Width           =   330
  784.       End
  785.       Begin SSRibbon grbDrawTool 
  786.          BackColor       =   &H00C0C0C0&
  787.          GroupAllowAllUp =   0   'False
  788.          Height          =   330
  789.          HelpContextID   =   38
  790.          Index           =   3
  791.          Left            =   690
  792.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  793.          PictureUp       =   FGDRAW.FRX:1B00
  794.          RoundedCorners  =   0   'False
  795.          Tag             =   "TT:[Draw Text]"
  796.          Top             =   480
  797.          Width           =   330
  798.       End
  799.       Begin SSRibbon grbDrawTool 
  800.          BackColor       =   &H00C0C0C0&
  801.          GroupAllowAllUp =   0   'False
  802.          Height          =   330
  803.          HelpContextID   =   38
  804.          Index           =   0
  805.          Left            =   60
  806.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  807.          PictureUp       =   FGDRAW.FRX:1BFA
  808.          RoundedCorners  =   0   'False
  809.          Tag             =   "TT:[Selection]"
  810.          Top             =   60
  811.          Value           =   -1  'True
  812.          Width           =   330
  813.       End
  814.       Begin SSRibbon grbDrawTool 
  815.          BackColor       =   &H00C0C0C0&
  816.          GroupAllowAllUp =   0   'False
  817.          Height          =   330
  818.          HelpContextID   =   38
  819.          Index           =   2
  820.          Left            =   375
  821.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  822.          PictureUp       =   FGDRAW.FRX:1CF4
  823.          RoundedCorners  =   0   'False
  824.          Tag             =   "TT:[Chord]"
  825.          Top             =   480
  826.          Width           =   330
  827.       End
  828.       Begin SSRibbon grbDrawTool 
  829.          BackColor       =   &H00C0C0C0&
  830.          GroupAllowAllUp =   0   'False
  831.          Height          =   330
  832.          HelpContextID   =   38
  833.          Index           =   1
  834.          Left            =   60
  835.          PictureDnChange =   1  'Dither 'PictureUp' Bitmap
  836.          PictureUp       =   FGDRAW.FRX:1DEE
  837.          RoundedCorners  =   0   'False
  838.          Tag             =   "TT:[Arc"
  839.          Top             =   480
  840.          Width           =   330
  841.       End
  842.       Begin Label Label1 
  843.          BackStyle       =   0  'Transparent
  844.          Caption         =   "Keep Zoom Aspect Ratio"
  845.          Height          =   615
  846.          Left            =   345
  847.          TabIndex        =   6
  848.          Top             =   1800
  849.          Width           =   975
  850.       End
  851.       Begin Label lblYPos 
  852.          BackStyle       =   0  'Transparent
  853.          Height          =   270
  854.          Left            =   90
  855.          TabIndex        =   4
  856.          Top             =   2565
  857.          Width           =   1215
  858.       End
  859.       Begin Label lblXPos 
  860.          BackStyle       =   0  'Transparent
  861.          Height          =   240
  862.          Left            =   75
  863.          TabIndex        =   3
  864.          Top             =   2370
  865.          Width           =   1245
  866.       End
  867.    End
  868.    Begin Menu mu_File 
  869.       Caption         =   "&File"
  870.       HelpContextID   =   41
  871.       Begin Menu mu_ClearAll 
  872.          Caption         =   "&New"
  873.          HelpContextID   =   42
  874.       End
  875.       Begin Menu mu_Print 
  876.          Caption         =   "&Print"
  877.       End
  878.       Begin Menu mu_Sep 
  879.          Caption         =   "-"
  880.       End
  881.       Begin Menu mu_Exit 
  882.          Caption         =   "E&xit"
  883.          HelpContextID   =   43
  884.       End
  885.    End
  886.    Begin Menu mu_DrawingTool 
  887.       Caption         =   "&Drawing Tool"
  888.       HelpContextID   =   44
  889.       Begin Menu mu_Tool 
  890.          Caption         =   "&Arrow"
  891.          Checked         =   -1  'True
  892.          HelpContextID   =   45
  893.          Index           =   0
  894.       End
  895.       Begin Menu mu_Tool 
  896.          Caption         =   "&Arc"
  897.          HelpContextID   =   45
  898.          Index           =   1
  899.       End
  900.       Begin Menu mu_Tool 
  901.          Caption         =   "&Chord"
  902.          HelpContextID   =   45
  903.          Index           =   2
  904.       End
  905.       Begin Menu mu_Tool 
  906.          Caption         =   "&Draw Text"
  907.          HelpContextID   =   45
  908.          Index           =   3
  909.       End
  910.       Begin Menu mu_Tool 
  911.          Caption         =   "&Ellipse"
  912.          HelpContextID   =   45
  913.          Index           =   4
  914.       End
  915.       Begin Menu mu_Tool 
  916.          Caption         =   "&Line"
  917.          HelpContextID   =   45
  918.          Index           =   5
  919.       End
  920.       Begin Menu mu_Tool 
  921.          Caption         =   "&Polygon"
  922.          HelpContextID   =   45
  923.          Index           =   6
  924.       End
  925.       Begin Menu mu_Tool 
  926.          Caption         =   "&Pie"
  927.          HelpContextID   =   45
  928.          Index           =   7
  929.       End
  930.       Begin Menu mu_Tool 
  931.          Caption         =   "&Polyline"
  932.          HelpContextID   =   45
  933.          Index           =   8
  934.       End
  935.       Begin Menu mu_Tool 
  936.          Caption         =   "&PolyPolygon"
  937.          HelpContextID   =   45
  938.          Index           =   9
  939.       End
  940.       Begin Menu mu_Tool 
  941.          Caption         =   "&PolyTextOut"
  942.          HelpContextID   =   45
  943.          Index           =   10
  944.       End
  945.       Begin Menu mu_Tool 
  946.          Caption         =   "&Rectangle"
  947.          HelpContextID   =   45
  948.          Index           =   11
  949.       End
  950.       Begin Menu mu_Tool 
  951.          Caption         =   "&Round Rectangle"
  952.          HelpContextID   =   45
  953.          Index           =   12
  954.       End
  955.       Begin Menu mu_Tool 
  956.          Caption         =   "&Text out"
  957.          HelpContextID   =   45
  958.          Index           =   13
  959.       End
  960.       Begin Menu mu_Tool 
  961.          Caption         =   "&Free Hand Draw"
  962.          HelpContextID   =   45
  963.          Index           =   14
  964.       End
  965.       Begin Menu mu_Tool 
  966.          Caption         =   "&Zoom in"
  967.          HelpContextID   =   45
  968.          Index           =   15
  969.       End
  970.       Begin Menu mu_ZoomOut 
  971.          Caption         =   "&Zoom out"
  972.          HelpContextID   =   46
  973.       End
  974.       Begin Menu mu_Delete 
  975.          Caption         =   "&Delete"
  976.          Index           =   16
  977.       End
  978.    End
  979.    Begin Menu mu_View 
  980.       Caption         =   "&View"
  981.       HelpContextID   =   47
  982.       Begin Menu mu_ButtonBar 
  983.          Caption         =   "&ButtonBar"
  984.          Checked         =   -1  'True
  985.          HelpContextID   =   48
  986.       End
  987.       Begin Menu mu_AttribBar 
  988.          Caption         =   "&Attrib Bar"
  989.          Checked         =   -1  'True
  990.          HelpContextID   =   49
  991.       End
  992.       Begin Menu mu_ViewTips 
  993.          Caption         =   "View &Tips"
  994.          Checked         =   -1  'True
  995.          Enabled         =   0   'False
  996.          HelpContextID   =   50
  997.          Visible         =   0   'False
  998.       End
  999.       Begin Menu mu_ViewPicture 
  1000.          Caption         =   "&View Picture"
  1001.          HelpContextID   =   51
  1002.          Visible         =   0   'False
  1003.       End
  1004.    End
  1005.    Begin Menu mu_Help 
  1006.       Caption         =   "&Help"
  1007.       HelpContextID   =   52
  1008.       Begin Menu mu_Contents 
  1009.          Caption         =   "&Contents"
  1010.          HelpContextID   =   53
  1011.          Shortcut        =   {F1}
  1012.          Visible         =   0   'False
  1013.       End
  1014.       Begin Menu mu_HelpHelp 
  1015.          Caption         =   "&How to use Help"
  1016.          HelpContextID   =   54
  1017.          Visible         =   0   'False
  1018.       End
  1019.       Begin Menu mu_Sep1 
  1020.          Caption         =   "-"
  1021.          HelpContextID   =   55
  1022.          Visible         =   0   'False
  1023.       End
  1024.       Begin Menu mu_About 
  1025.          Caption         =   "&About"
  1026.          HelpContextID   =   56
  1027.       End
  1028.    End
  1029. Option Explicit
  1030. Dim CurrTool As Integer
  1031. Dim CurrGraphic As Long
  1032. Const MAX_GRAPHICS = 10000
  1033. Const NUM_COLORS = 24
  1034. Dim AllColors(NUM_COLORS, 3) As Long
  1035. Dim ColorSelect(3) As Long
  1036. Dim ColorSelectIdx(3) As Integer
  1037. Dim ColorRow As Integer
  1038. Dim GraphicHandles(MAX_GRAPHICS) As Long
  1039. Dim GraphicTypes(MAX_GRAPHICS) As Integer
  1040. Dim MaxHandle As Integer
  1041. Dim NumPoints As Integer
  1042. Dim CurrPoint As Integer
  1043. Dim initx As Double
  1044. Dim inity As Double
  1045. Dim CurrBorderWidth As Integer
  1046. Dim CurrBorderStyle As Integer
  1047. Dim CurrBorderColor
  1048. Dim CurrFIllStyle As Integer
  1049. Dim CurrFillColor
  1050. Dim CurrFontHeight As Integer
  1051. Dim CurrFontWidth  As Integer
  1052. Dim CurrFontEscapement As Integer
  1053. Dim CurrFontOrientation  As Integer
  1054. Dim CurrFontBold As Integer
  1055. Dim CurrFontItalic As Integer
  1056. Dim CurrFontUnderline As Integer
  1057. Dim CurrFontStrikeOut As Integer
  1058. Dim CurrFontFaceName As String
  1059. Dim CurrFontColor
  1060. Dim CurrBackColor
  1061. Dim CurrBackStyle As Integer
  1062. Dim CurrVisible As Integer
  1063. Dim MarkPicture As Long
  1064. Dim MarkObjectIdx As Integer
  1065. Dim MarkPolyPolygon As Long
  1066. Dim MarkStartIdx As Long
  1067. Dim MarkEndIdx As Long
  1068. Dim MarkPoints() As PointAPI
  1069. Dim MarkCount() As Integer
  1070. Dim MarkPointIdx As Integer
  1071. Dim EditDrag As Integer
  1072. Dim CanSetAttribs As Integer
  1073. Dim CanScroll As Integer
  1074. Dim PolyPolygonCountIdx As Integer
  1075. Dim PolyCountStartIdx As Integer
  1076. Sub AddPrinterPage ()
  1077.     Dim dummy As Long
  1078.     Dim X1 As Double
  1079.     Dim Y1 As Double
  1080.     Dim X2 As Double
  1081.     Dim Y2 As Double
  1082.     Dim S1 As Double
  1083.     Dim S2 As Double
  1084.     'picDrawSpace.BackColor = QBColor(8)
  1085.     Printer.ScaleMode = 3
  1086.     X1 = Printer.ScaleLeft
  1087.     Y1 = Printer.ScaleTop
  1088.     X2 = X1 + Printer.ScaleWidth
  1089.     Y2 = Y1 + Printer.ScaleHeight
  1090.     dummy = SCReateRectangle(FG1, X1, Y1, X2, Y2)
  1091.     SetFillStyle dummy, FS_SOLID
  1092.     SetFillColor dummy, QBColor(15)
  1093.     SetBorderStyle dummy, BS_SOLID
  1094.     SetBorderColor dummy, QBColor(7)
  1095.     S1 = (X2 - X1) / picDrawSpace.ScaleWidth
  1096.     S2 = (Y2 - Y1) / picDrawSpace.ScaleHeight
  1097.     If S2 > S1 Then S1 = S2
  1098.     SetPlacement FG1, 0, 0, (X2 - X1) / S1, (Y2 - Y1) / S1
  1099.     SetScale FG1, X1, Y1, X2, Y2
  1100. End Sub
  1101. Sub CancelMark ()
  1102.     If MarkPicture = -1 Then
  1103.         Exit Sub
  1104.     End If
  1105.     If GetVisible(MarkPicture) Then
  1106.         DoPaint MarkPicture
  1107.         SetVisible MarkPicture, False
  1108.         MarkObjectIdx = -1
  1109.         RemoveObject MarkPicture, picDrawSpace.hDC, 0, True, QBColor(0)
  1110.         MarkPicture = -1
  1111.     End If
  1112. End Sub
  1113. Sub cdmZoomOut_Click ()
  1114.     Dim TD1 As Double
  1115.     Dim TD2 As Double
  1116.     Dim ThePicHandle As Long
  1117.     ThePicHandle = FG1
  1118.     CancelMark
  1119.     TD1 = SGetX(ThePicHandle, 3)
  1120.     TD2 = SGetX(ThePicHandle, 4)
  1121.     SSetX FG1, 3, TD1 - TD2 / 2#
  1122.     SSetX FG1, 4, TD2 * 2#
  1123.     TD1 = SGetY(ThePicHandle, 3)
  1124.     TD2 = SGetY(ThePicHandle, 4)
  1125.     SSetY FG1, 3, TD1 - TD2 / 2#
  1126.     SSetY FG1, 4, TD2 * 2#
  1127.     picDrawSpace.Refresh
  1128. End Sub
  1129. Sub cmdDeleteGraphic_Click ()
  1130.     Dim i As Integer
  1131.     Dim DeleteHandle As Long
  1132.     If (MarkObjectIdx >= 0) And CanSetAttribs Then
  1133.         ' Remeber the object handle
  1134.         DeleteHandle = GraphicHandles(MarkObjectIdx)
  1135.         ' Move all of the objets down one
  1136.         For i = MarkObjectIdx To MaxHandle - 2
  1137.             GraphicHandles(i) = GraphicHandles(i + 1)
  1138.             GraphicTypes(i) = GraphicTypes(i + 1)
  1139.         Next i
  1140.         CancelMark
  1141.         MaxHandle = MaxHandle - 1
  1142.         RemoveObject DeleteHandle, picDrawSpace.hDC, 1, True, picDrawSpace.BackColor
  1143.     End If
  1144. End Sub
  1145. Sub cmdPageDown_Click ()
  1146.     Dim SHeight As Double
  1147.     Dim NewY As Double
  1148.     Dim ThePicHandle As Long
  1149.     ThePicHandle = FG1
  1150.     NewY = SGetY(ThePicHandle, 3)
  1151.     SHeight = SGetY(ThePicHandle, 4)
  1152.     SSetY FG1, 3, NewY + SHeight / 3
  1153.     picDrawSpace.Refresh
  1154. End Sub
  1155. Sub cmdPageDown_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1156.     Dim T
  1157.     CanScroll = True
  1158.     CancelMark
  1159.     T = Timer
  1160.     ' Wait 1 second before starting to scroll
  1161.     While (T + 1#) > Timer
  1162.         DoEvents
  1163.         If Not CanScroll Then Exit Sub
  1164.     Wend
  1165.     T = Timer
  1166.     ' Scroll until mouse up event
  1167.     While CanScroll
  1168.         ' wait 1/5 th second between each scroll
  1169.         While (T + .2) > Timer
  1170.             DoEvents
  1171.             If Not CanScroll Then Exit Sub
  1172.         Wend
  1173.         T = Timer
  1174.         cmdPageDown = True
  1175.     Wend
  1176. End Sub
  1177. Sub cmdPageDown_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1178.     CanScroll = False
  1179. End Sub
  1180. Sub cmdPageLeft_Click ()
  1181.     Dim SWidth As Double
  1182.     Dim NewX As Double
  1183.     Dim ThePicHandle As Long
  1184.     ThePicHandle = FG1
  1185.     NewX = SGetX(ThePicHandle, 3)
  1186.     SWidth = SGetX(ThePicHandle, 4)
  1187.     SSetX FG1, 3, NewX - SWidth / 3
  1188.     picDrawSpace.Refresh
  1189. End Sub
  1190. Sub cmdPageLeft_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1191.     Dim T
  1192.     CanScroll = True
  1193.     CancelMark
  1194.     T = Timer
  1195.     ' Wait 1 second before starting to scroll
  1196.     While (T + 1#) > Timer
  1197.         DoEvents
  1198.         If Not CanScroll Then Exit Sub
  1199.     Wend
  1200.     T = Timer
  1201.     ' Scroll until mouse up event
  1202.     While CanScroll
  1203.         ' wait 1/5 th second between each scroll
  1204.         While (T + .2) > Timer
  1205.             DoEvents
  1206.             If Not CanScroll Then Exit Sub
  1207.         Wend
  1208.         T = Timer
  1209.         cmdPageLeft = True
  1210.     Wend
  1211. End Sub
  1212. Sub cmdPageLeft_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1213.     CanScroll = False
  1214. End Sub
  1215. Sub cmdPageRight_Click ()
  1216.     Dim SWidth As Double
  1217.     Dim NewX As Double
  1218.     Dim ThePicHandle As Long
  1219.     ThePicHandle = FG1
  1220.     NewX = SGetX(ThePicHandle, 3)
  1221.     SWidth = SGetX(ThePicHandle, 4)
  1222.     SSetX FG1, 3, NewX + SWidth / 3
  1223.     picDrawSpace.Refresh
  1224. End Sub
  1225. Sub cmdPageRight_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1226.     Dim T
  1227.     CanScroll = True
  1228.     CancelMark
  1229.     T = Timer
  1230.     ' Wait 1 second before starting to scroll
  1231.     While (T + 1#) > Timer
  1232.         DoEvents
  1233.         If Not CanScroll Then Exit Sub
  1234.     Wend
  1235.     T = Timer
  1236.     ' Scroll until mouse up event
  1237.     While CanScroll
  1238.         ' wait 1/5 th second between each scroll
  1239.         While (T + .2) > Timer
  1240.             DoEvents
  1241.             If Not CanScroll Then Exit Sub
  1242.         Wend
  1243.         T = Timer
  1244.         cmdPageRight = True
  1245.     Wend
  1246. End Sub
  1247. Sub cmdPageRight_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1248.     CanScroll = False
  1249. End Sub
  1250. Sub cmdPageUp_Click ()
  1251.     Dim SHeight As Double
  1252.     Dim NewY As Double
  1253.     Dim ThePicHandle As Long
  1254.     ThePicHandle = FG1
  1255.     NewY = SGetY(ThePicHandle, 3)
  1256.     SHeight = SGetY(ThePicHandle, 4)
  1257.     SSetY FG1, 3, NewY - SHeight / 3
  1258.     picDrawSpace.Refresh
  1259. End Sub
  1260. Sub cmdPageUp_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1261.     Dim T
  1262.     CanScroll = True
  1263.     CancelMark
  1264.     T = Timer
  1265.     ' Wait 1 second before starting to scroll
  1266.     While (T + 1#) > Timer
  1267.         DoEvents
  1268.         If Not CanScroll Then Exit Sub
  1269.     Wend
  1270.     T = Timer
  1271.     ' Scroll until mouse up event
  1272.     While CanScroll
  1273.         ' wait 1/5 th second between each scroll
  1274.         While (T + .2) > Timer
  1275.             DoEvents
  1276.             If Not CanScroll Then Exit Sub
  1277.         Wend
  1278.         T = Timer
  1279.         cmdPageUp = True
  1280.     Wend
  1281. End Sub
  1282. Sub cmdPageUp_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1283.     CanScroll = False
  1284. End Sub
  1285. Sub cmdSelectFont_Click ()
  1286.     CMDialog1.FontName = CurrFontFaceName
  1287.     CMDialog1.FontBold = CurrFontBold
  1288.     CMDialog1.FontItalic = CurrFontItalic
  1289.     CMDialog1.FontSize = -CurrFontHeight
  1290.     CMDialog1.FontStrikeThru = CurrFontStrikeOut
  1291.     CMDialog1.FontUnderLine = CurrFontUnderline
  1292.     CMDialog1.Flags = CF_BOTH Or CF_EFFECTS Or CF_APPLY
  1293.     'CMDialog1.Color = TheFontColor
  1294.     CMDialog1.Action = 4
  1295.     CurrFontFaceName = CMDialog1.FontName
  1296.     CurrFontBold = CMDialog1.FontBold
  1297.     CurrFontItalic = CMDialog1.FontItalic
  1298.     CurrFontHeight = -CMDialog1.FontSize
  1299.     CurrFontStrikeOut = CMDialog1.FontStrikeThru
  1300.     CurrFontUnderline = CMDialog1.FontUnderLine
  1301.     SetMarkAttribs
  1302. End Sub
  1303. Sub cmdStepDown_Click ()
  1304.     Dim SHeight As Double
  1305.     Dim NewY As Double
  1306.     Dim PHeight As Double
  1307.     Dim ThePicHandle As Long
  1308.     ThePicHandle = FG1
  1309.     NewY = SGetY(ThePicHandle, 3)
  1310.     SHeight = SGetY(ThePicHandle, 4)
  1311.     PHeight = SGetY(ThePicHandle, 2)
  1312.     SSetY FG1, 3, NewY + SHeight / PHeight
  1313.     picDrawSpace.Refresh
  1314. End Sub
  1315. Sub cmdStepDown_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1316.     Dim T
  1317.     CanScroll = True
  1318.     CancelMark
  1319.     T = Timer
  1320.     ' Wait 1 second before starting to scroll
  1321.     While (T + 1#) > Timer
  1322.         DoEvents
  1323.         If Not CanScroll Then Exit Sub
  1324.     Wend
  1325.     T = Timer
  1326.     ' Scroll until mouse up event
  1327.     While CanScroll
  1328.         ' wait 1/5 th second between each scroll
  1329.         While (T + .2) > Timer
  1330.             DoEvents
  1331.             If Not CanScroll Then Exit Sub
  1332.         Wend
  1333.         T = Timer
  1334.         cmdStepDown = True
  1335.     Wend
  1336. End Sub
  1337. Sub cmdStepDown_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1338.     CanScroll = False
  1339. End Sub
  1340. Sub cmdStepLeft_Click ()
  1341.     Dim SWidth As Double
  1342.     Dim NewX As Double
  1343.     Dim PWidth As Double
  1344.     Dim ThePicHandle As Long
  1345.     ThePicHandle = FG1
  1346.     NewX = SGetX(ThePicHandle, 3)
  1347.     SWidth = SGetX(ThePicHandle, 4)
  1348.     PWidth = SGetX(ThePicHandle, 2)
  1349.     SSetX FG1, 3, NewX - SWidth / PWidth
  1350.     picDrawSpace.Refresh
  1351. End Sub
  1352. Sub cmdStepLeft_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1353.     Dim T
  1354.     CanScroll = True
  1355.     CancelMark
  1356.     T = Timer
  1357.     ' Wait 1 second before starting to scroll
  1358.     While (T + 1#) > Timer
  1359.         DoEvents
  1360.         If Not CanScroll Then Exit Sub
  1361.     Wend
  1362.     T = Timer
  1363.     ' Scroll until mouse up event
  1364.     While CanScroll
  1365.         ' wait 1/5 th second between each scroll
  1366.         While (T + .2) > Timer
  1367.             DoEvents
  1368.             If Not CanScroll Then Exit Sub
  1369.         Wend
  1370.         T = Timer
  1371.         cmdStepLeft = True
  1372.     Wend
  1373. End Sub
  1374. Sub cmdStepLeft_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1375.     CanScroll = False
  1376. End Sub
  1377. Sub cmdStepRight_Click ()
  1378.     Dim SWidth As Double
  1379.     Dim NewX As Double
  1380.     Dim PWidth As Double
  1381.     Dim ThePicHandle As Long
  1382.     ThePicHandle = FG1
  1383.     NewX = SGetX(ThePicHandle, 3)
  1384.     SWidth = SGetX(ThePicHandle, 4)
  1385.     PWidth = SGetX(ThePicHandle, 2)
  1386.     SSetX FG1, 3, NewX + SWidth / PWidth
  1387.     picDrawSpace.Refresh
  1388. End Sub
  1389. Sub cmdStepRight_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1390.     Dim T
  1391.     CanScroll = True
  1392.     CancelMark
  1393.     T = Timer
  1394.     ' Wait 1 second before starting to scroll
  1395.     While (T + 1#) > Timer
  1396.         DoEvents
  1397.         If Not CanScroll Then Exit Sub
  1398.     Wend
  1399.     T = Timer
  1400.     ' Scroll until mouse up event
  1401.     While CanScroll
  1402.         ' wait 1/5 th second between each scroll
  1403.         While (T + .2) > Timer
  1404.             DoEvents
  1405.             If Not CanScroll Then Exit Sub
  1406.         Wend
  1407.         T = Timer
  1408.         cmdStepRight = True
  1409.     Wend
  1410. End Sub
  1411. Sub cmdStepRight_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1412.     CanScroll = False
  1413. End Sub
  1414. Sub cmdStepUp_Click ()
  1415.     Dim SHeight As Double
  1416.     Dim NewY As Double
  1417.     Dim PHeight As Double
  1418.     Dim ThePicHandle As Long
  1419.     ThePicHandle = FG1
  1420.     NewY = SGetY(ThePicHandle, 3)
  1421.     SHeight = SGetY(ThePicHandle, 4)
  1422.     PHeight = SGetY(ThePicHandle, 2)
  1423.     SSetY FG1, 3, NewY - SHeight / PHeight
  1424.     picDrawSpace.Refresh
  1425. End Sub
  1426. Sub cmdStepUp_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1427.     Dim T
  1428.     CanScroll = True
  1429.     CancelMark
  1430.     T = Timer
  1431.     ' Wait 1 second before starting to scroll
  1432.     While (T + 1#) > Timer
  1433.         DoEvents
  1434.         If Not CanScroll Then Exit Sub
  1435.     Wend
  1436.     T = Timer
  1437.     ' Scroll until mouse up event
  1438.     While CanScroll
  1439.         ' wait 1/5 th second between each scroll
  1440.         While (T + .2) > Timer
  1441.             DoEvents
  1442.             If Not CanScroll Then Exit Sub
  1443.         Wend
  1444.         T = Timer
  1445.         cmdStepUp = True
  1446.     Wend
  1447. End Sub
  1448. Sub cmdStepUp_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1449.     CanScroll = False
  1450. End Sub
  1451. Sub DoHitTesting (Shift As Integer, X As Double, Y As Double)
  1452.     Dim i As Integer
  1453.     CanSetAttribs = False
  1454.     ' Iterate through all of the objects and check if the point is in the bounding rectangle
  1455.     If (Shift And 4) <> 4 Then
  1456.         MarkObjectIdx = -1
  1457.     End If
  1458.     For i = 0 To MaxHandle - 1
  1459.         If GraphicContainsPoint(GraphicHandles(i), GraphicTypes(i), X, Y) Then
  1460.             If i > MarkObjectIdx Then
  1461.                 MarkObjectIdx = i
  1462.                 MarkGraphic GraphicHandles(i), GraphicTypes(i)
  1463.                 GetGraphicAttribs GraphicHandles(i)
  1464.                 'DoEvents
  1465.                 CanSetAttribs = True
  1466.                 Exit Sub
  1467.             End If
  1468.         End If
  1469.     Next i
  1470.     ' We only get here if no object found yet
  1471.     ' If the ALT key is down reset the markidx and try again
  1472.     If ((Shift And 4) = 4) And (MarkObjectIdx <> -1) Then
  1473.         MarkObjectIdx = -1
  1474.         DoHitTesting Shift, X, Y
  1475.         Exit Sub
  1476.     End If
  1477.     ' We only get here if no object found at all
  1478.     ' so cancel any marks
  1479.     CancelMark
  1480. End Sub
  1481. Sub DoMarkPosCheck (X As Single, Y As Single)
  1482.     Dim i As Integer
  1483.     Dim X1 As Double
  1484.     Dim Y1 As Double
  1485.     If MarkPicture = -1 Then
  1486.         ' The mark picture has not been initialised so exit
  1487.         Exit Sub
  1488.     End If
  1489.     If MarkObjectIdx = -1 Then
  1490.         ' There is no object that is currently marked
  1491.         Exit Sub
  1492.     End If
  1493.     For i = MarkStartIdx To MarkEndIdx
  1494.         ' Iterate through all of the point
  1495.         X1 = MarkPoints((i - MarkStartIdx) * 5).X
  1496.         Y1 = MarkPoints((i - MarkStartIdx) * 5).Y
  1497.         If (X >= X1) And (X < (X1 + 10)) Then
  1498.             If (Y >= Y1) And (Y < (Y1 + 10)) Then
  1499.                 ' If the cursor is over a point then change the mouse pointer
  1500.                 MarkPointIdx = i
  1501.                 If (picDrawSpace.MousePointer <> 5) Then
  1502.                     picDrawSpace.MousePointer = 5
  1503.                 End If
  1504.                 Exit Sub
  1505.             End If
  1506.         End If
  1507.     Next i
  1508.     ' No point was found so set the mouse pointer back
  1509.     MarkPointIdx = -1
  1510.     If (picDrawSpace.MousePointer = 5) Then
  1511.         picDrawSpace.MousePointer = 0
  1512.         Exit Sub
  1513.     End If
  1514. End Sub
  1515. Sub Form_Activate ()
  1516.     ' Set the initial Placement and Scale settings to the form's
  1517.     'SetScale FG1, 0, 0, picDrawSpace.ScaleWidth, picDrawSpace.ScaleHeight
  1518.     'SetPlacement FG1, 0, 0, picDrawSpace.ScaleWidth, picDrawSpace.ScaleHeight
  1519.     ' The following code is used for debugging only
  1520.     'Refresh
  1521.     'picDrawSpace.Refresh
  1522.     'picColorBtns_Paint
  1523.     'DoEvents
  1524.     'DoEvents
  1525.     'DoEvents
  1526.     'DoEvents
  1527.     'DoEvents
  1528.     'DoEvents
  1529.     'DoEvents
  1530.     'DoEvents
  1531.     'Unload Me
  1532. End Sub
  1533. Sub Form_Load ()
  1534.     CurrTool = 0    ' Arrow tool
  1535.     GraphicHandles(0) = 1
  1536.     GraphicTypes(0) = G_GLOBALPIC
  1537.     MaxHandle = 1
  1538.     NumPoints = 0
  1539.     CurrPoint = 0
  1540.     CurrGraphic = -1
  1541.     InitAttributes
  1542.     InitColors
  1543.     MarkPicture = -1
  1544.     MarkObjectIdx = -1
  1545.     MarkPolyPolygon = -1
  1546.     CanSetAttribs = False
  1547.     MarkPointIdx = -1
  1548.     EditDrag = False
  1549.     CanScroll = False
  1550.     SetFontPointHeight FG1, 20
  1551.     AddPrinterPage
  1552. End Sub
  1553. Sub Form_Resize ()
  1554.     If WindowState = 1 Then
  1555.         Exit Sub
  1556.     End If
  1557.     pnlAttribBar.Left = 0
  1558.     pnlAttribBar.Top = ScaleHeight - pnlAttribBar.Height
  1559.     pnlAttribBar.Width = ScaleWidth
  1560.     pnlButtonBar.Left = 0
  1561.     pnlButtonBar.Top = 0
  1562.     pnlButtonBar.Height = ScaleHeight - pnlAttribBar.Height * (-pnlAttribBar.Visible)
  1563.     picDrawSpace.Left = pnlButtonBar.Width * (-pnlButtonBar.Visible)
  1564.     picDrawSpace.Top = 0
  1565.     picDrawSpace.Width = ScaleWidth - pnlButtonBar.Width * (-pnlButtonBar.Visible)
  1566.     picDrawSpace.Height = ScaleHeight - pnlAttribBar.Height * (-pnlAttribBar.Visible)
  1567.     picColorBtns.Width = pnlAttribBar.Width * Screen.TwipsPerPixelX - picColorBtns.Left - (pnlAttribBar.BevelWidth * 2 + pnlAttribBar.BorderWidth) * Screen.TwipsPerPixelX
  1568.     ResizeColorButtons
  1569.     picDrawSpace.Refresh
  1570.     pnlAttribBar.Refresh
  1571. End Sub
  1572. Sub Form_Unload (Cancel As Integer)
  1573.     End
  1574. End Sub
  1575. Sub GetGraphicAttribs (TheGRaphicHandle As Long)
  1576.     Dim TempColor
  1577.     Dim TempBorderStyle As Integer
  1578.     Dim TempBorderWidth As Integer
  1579.     Dim TempFillStyle As Integer
  1580.     Dim TempBackStyle As Integer
  1581.     TempColor = GetBorderColor(TheGRaphicHandle)
  1582.     SetSelectedColor TempColor, 0
  1583.     TempColor = GetFillColor(TheGRaphicHandle)
  1584.     SetSelectedColor TempColor, 1
  1585.     TempColor = GetFontColor(TheGRaphicHandle)
  1586.     SetSelectedColor TempColor, 2
  1587.     TempColor = GetBackColor(TheGRaphicHandle)
  1588.     SetSelectedColor TempColor, 3
  1589.     TempBorderStyle = GetBorderStyle(TheGRaphicHandle)
  1590.     SetSelectedBorderStyle TempBorderStyle
  1591.     TempBorderWidth = -GetBorderWidth(TheGRaphicHandle)
  1592.     SetSelectBorderWidth TempBorderWidth
  1593.     TempFillStyle = GetFillStyle(TheGRaphicHandle)
  1594.     SetSelectFillStyle TempFillStyle
  1595.     TempBackStyle = GetBackStyle(TheGRaphicHandle)
  1596.     If (TempBackStyle = 1) Then
  1597.         grbTransparent = True
  1598.     Else
  1599.         grbOpaque = True
  1600.     End If
  1601.     CurrFontHeight = GetFontPointHeight(TheGRaphicHandle)
  1602.     If GetFontWeight(TheGRaphicHandle) > 400 Then
  1603.         CurrFontBold = True
  1604.     Else
  1605.         CurrFontBold = False
  1606.     End If
  1607.     CurrFontItalic = GetFontItalic(TheGRaphicHandle)
  1608.     CurrFontUnderline = GetFontUnderline(TheGRaphicHandle)
  1609.     CurrFontStrikeOut = GetFontStrikeOut(TheGRaphicHandle)
  1610.     CurrFontFaceName = GetFontFaceName(TheGRaphicHandle)
  1611. End Sub
  1612. Function GraphicContainsPoint (GraphicHandle As Long, GraphicType As Integer, X As Double, Y As Double) As Integer
  1613.     Dim ContainsPoint As Integer
  1614.     Dim X1 As Double
  1615.     Dim X2 As Double
  1616.     Dim Y1 As Double
  1617.     Dim Y2 As Double
  1618.     Dim dummy As Double
  1619.     Dim i As Integer
  1620.     Dim tx As Double
  1621.     Dim ty As Double
  1622.     Dim NumPoints As Integer
  1623.     Dim ThehDC As Integer
  1624.     Dim TheHandle As Long
  1625.     Dim TheText As String
  1626.     X1 = -1
  1627.     Y1 = -1
  1628.     X2 = -1
  1629.     Y2 = -1
  1630.     If GraphicHandle < 0 Then
  1631.         GraphicContainsPoint = False
  1632.         Exit Function
  1633.     End If
  1634.     ContainsPoint = False
  1635.     Select Case GraphicType
  1636.         Case G_ARC, G_CHORD, G_ELLIPSE, G_LINE, G_PIE, G_RECTANGLE, G_ROUNDRECT:
  1637.             X1 = SGetX(GraphicHandle, 1)
  1638.             X2 = SGetX(GraphicHandle, 2)
  1639.             Y1 = SGetY(GraphicHandle, 1)
  1640.             Y2 = SGetY(GraphicHandle, 2)
  1641.         Case G_DRAWTEXT
  1642.             X1 = SGetX(GraphicHandle, 1)
  1643.             X2 = SGetX(GraphicHandle, 2)
  1644.             Y1 = SGetY(GraphicHandle, 1)
  1645.             Y2 = SGetY(GraphicHandle, 2)
  1646.             X2 = X1 + X2
  1647.             Y2 = Y1 + Y2
  1648.         Case G_TEXTOut
  1649.             X1 = SGetX(GraphicHandle, 1)
  1650.             Y1 = SGetY(GraphicHandle, 1)
  1651.             TheText = GetString(GraphicHandle)
  1652.             TheHandle = FG1
  1653.             ThehDC = picDrawSpace.hDC
  1654.             SetFontPointHeight FG1, GetFontPointHeight(GraphicHandle)
  1655.             X2 = X1 + Abs(GetScaleTextWidth(TheHandle, ThehDC, TheText))
  1656.             Y2 = Y1 + Abs(GetScaleTextHeight(TheHandle, ThehDC, TheText))
  1657.         Case G_POLYTEXTOut:
  1658.             NumPoints = GetNumPoints(GraphicHandle)
  1659.             For i = 1 To NumPoints - 1
  1660.                 X1 = SGetX(GraphicHandle, i)
  1661.                 Y1 = SGetY(GraphicHandle, i)
  1662.                 TheText = GetPTextAt(GraphicHandle, i)
  1663.                 TheHandle = FG1
  1664.                 ThehDC = picDrawSpace.hDC
  1665.                 SetFontPointHeight FG1, GetFontPointHeight(GraphicHandle)
  1666.                 X2 = X1 + Abs(GetScaleTextWidth(TheHandle, ThehDC, TheText))
  1667.                 Y2 = Y1 + Abs(GetScaleTextHeight(TheHandle, ThehDC, TheText))
  1668.                 If (X >= X1) And (X <= X2) And (Y >= Y1) And (Y <= Y2) Then
  1669.                     i = NumPoints
  1670.                 End If
  1671.             Next i
  1672.         Case G_POLYGON, G_POLYLINE, G_POLYPOLYGON, G_FREEHAND:
  1673.             NumPoints = GetNumPoints(GraphicHandle)
  1674.             If NumPoints > 1 Then
  1675.                 X1 = SGetX(GraphicHandle, 0)
  1676.                 X2 = SGetX(GraphicHandle, 1)
  1677.                 Y1 = SGetY(GraphicHandle, 0)
  1678.                 Y2 = SGetY(GraphicHandle, 1)
  1679.                 For i = 2 To NumPoints - 1
  1680.                     tx = SGetX(GraphicHandle, i)
  1681.                     ty = SGetY(GraphicHandle, i)
  1682.                     If tx < X1 Then X1 = tx
  1683.                     If tx > X2 Then X2 = tx
  1684.                     If ty < Y1 Then Y1 = ty
  1685.                     If ty > Y2 Then Y2 = ty
  1686.                 Next i
  1687.             End If
  1688.     End Select
  1689.     If (X1 > X2) Then
  1690.         dummy = X1
  1691.         X1 = X2
  1692.         X2 = dummy
  1693.     End If
  1694.     If (Y1 > Y2) Then
  1695.         dummy = Y1
  1696.         Y1 = Y2
  1697.         Y2 = dummy
  1698.     End If
  1699.     If (X >= X1) And (X <= X2) And (Y >= Y1) And (Y <= Y2) Then
  1700.         ContainsPoint = True
  1701.     End If
  1702.     GraphicContainsPoint = ContainsPoint
  1703. End Function
  1704. Sub grbDrawTool_Click (Index As Integer, Value As Integer)
  1705.     Dim i As Integer
  1706.     CurrTool = Index
  1707.     NumPoints = 0
  1708.     CurrPoint = 0
  1709.     CurrGraphic = -1
  1710.     CancelMark
  1711.     ' Clear all of the tools checks
  1712.     For i = 0 To 15
  1713.         mu_Tool(i).Checked = False
  1714.     Next i
  1715.     ' Check the new tool
  1716.     mu_Tool(Index).Checked = True
  1717.     If (Index = 0) Or (Index = 15) Then
  1718.         picDrawSpace.MousePointer = 0
  1719.     Else
  1720.         picDrawSpace.MousePointer = 2
  1721.     End If
  1722. End Sub
  1723. Sub grbOpaque_Click (Value As Integer)
  1724.     If Value Then
  1725.         CurrBackStyle = BKS_OPAQUE
  1726.         SetMarkAttribs
  1727.     End If
  1728. End Sub
  1729. Sub grbTransparent_Click (Value As Integer)
  1730.     If Value Then
  1731.         CurrBackStyle = BKS_TRANSPARENT
  1732.         SetMarkAttribs
  1733.     End If
  1734. End Sub
  1735. Sub InitAttributes ()
  1736.     CurrBorderColor = QBColor(0)
  1737.     CurrBorderStyle = BS_SOLID
  1738.     CurrBorderWidth = 0
  1739.     CurrFillColor = QBColor(0)
  1740.     CurrFIllStyle = FS_HOLLOW
  1741.     CurrBackColor = QBColor(0)
  1742.     CurrBackStyle = BKS_TRANSPARENT
  1743.     CurrFontColor = QBColor(0)
  1744.     CurrFontFaceName = "System"
  1745.     CurrFontHeight = 0
  1746.     CurrFontItalic = False
  1747.     CurrFontStrikeOut = False
  1748.     CurrFontUnderline = False
  1749.     CurrFontBold = False
  1750. End Sub
  1751. Sub InitColors ()
  1752.     Dim i As Integer
  1753.     Dim j As Integer
  1754.     Dim CurrBtn As Long
  1755.     Dim BtnWidth As Integer
  1756.     Dim RGBVal As Integer
  1757.     Dim BtnHeight As Integer
  1758.     BtnWidth = picColorBtns.ScaleWidth / NUM_COLORS
  1759.     BtnHeight = picColorBtns.ScaleHeight / 4
  1760.     ' Create rectangles for all of the colors
  1761.     For j = 0 To 3
  1762.         For i = 0 To (NUM_COLORS - 1)
  1763.             CurrBtn = CReateRectangle(FG2, i * BtnWidth, j * BtnHeight, (i + 1) * BtnWidth, (j + 1) * BtnHeight - 2)
  1764.             SetFillStyle CurrBtn, 0
  1765.             'SetDrawMode CurrBtn, 13
  1766.             If (i > 15) Then
  1767.                 ' Generate a Custom color
  1768.                 RGBVal = (NUM_COLORS - i) * 256 / (NUM_COLORS - 14)
  1769.                 SetFillColor CurrBtn, RGB(RGBVal, RGBVal, RGBVal)
  1770.                 SetBorderColor CurrBtn, RGB(RGBVal, RGBVal, RGBVal)
  1771.             Else
  1772.                 ' Generate a VB Color
  1773.                 SetFillColor CurrBtn, QBColor(i)
  1774.                 SetBorderColor CurrBtn, QBColor(i)
  1775.             End If
  1776.             AllColors(i, j) = CurrBtn
  1777.         Next i
  1778.     Next j
  1779.     ' Create the color selection indicator rectangles
  1780.     For j = 0 To 3
  1781.         ColorSelect(j) = CReateRectangle(FG2, 0, j * BtnHeight, BtnWidth, (j + 1) * BtnHeight - 2)
  1782.         SetFillStyle ColorSelect(j), 1
  1783.         SetBorderColor ColorSelect(j), QBColor(0)
  1784.         SetBorderWidth ColorSelect(j), BtnWidth / 4
  1785.         SetDrawMode ColorSelect(j), 10
  1786.         ColorSelectIdx(j) = 0
  1787.     Next j
  1788. End Sub
  1789. Sub MarkGraphic (GraphicHandle As Long, GraphicType As Integer)
  1790.     Dim X1 As Double
  1791.     Dim Y1 As Double
  1792.     Dim X2 As Double
  1793.     Dim Y2 As Double
  1794.     Dim dummy As Long
  1795.     Dim NumIdxs As Integer
  1796.     Dim i As Integer
  1797.     If MarkPicture = -1 Then
  1798.         MarkPicture = CreatePicture(FG1)
  1799.         ReDim MarkPoints(2)
  1800.         ReDim MarkCount(0)
  1801.         MarkCount(0) = 2
  1802.         MarkPolyPolygon = BCreatePolyPolygon(MarkPicture, MarkPoints(), MarkCount())
  1803.         SetDrawMode MarkPolyPolygon, 10
  1804.         SetFillStyle MarkPolyPolygon, FS_SOLID
  1805.         SetFillColor MarkPolyPolygon, QBColor(0)
  1806.         SetPreserveAttribs MarkPolyPolygon, 1
  1807.         SetBorderStyle MarkPolyPolygon, BS_TRANSPARENT
  1808.         SetBorderWidth MarkPolyPolygon, 0
  1809.         SetBackStyle MarkPolyPolygon, BKS_TRANSPARENT
  1810.     End If
  1811.     ' Undraw any marks in the picture
  1812.     If GetVisible(MarkPicture) Then
  1813.         DoPaint MarkPicture
  1814.     End If
  1815.     SetVisible MarkPicture, True
  1816.     Select Case GraphicType
  1817.         Case G_ARC, G_CHORD, G_PIE
  1818.             MarkStartIdx = 1
  1819.             MarkEndIdx = 4
  1820.         Case G_ELLIPSE, G_LINE, G_RECTANGLE
  1821.             MarkStartIdx = 1
  1822.             MarkEndIdx = 2
  1823.         Case G_ROUNDRECT:
  1824.             MarkStartIdx = 1
  1825.             MarkEndIdx = 3
  1826.         Case G_TEXTOut:
  1827.             MarkStartIdx = 1
  1828.             MarkEndIdx = 1
  1829.         Case G_DRAWTEXT:
  1830.             MarkStartIdx = 1
  1831.             MarkEndIdx = 2
  1832.         Case G_POLYGON, G_POLYLINE, G_POLYPOLYGON, G_FREEHAND:
  1833.             MarkStartIdx = 0
  1834.             MarkEndIdx = GetNumPoints(GraphicHandle) - 1
  1835.         Case G_POLYTEXTOut:
  1836.             MarkStartIdx = 1
  1837.             MarkEndIdx = GetNumPoints(GraphicHandle) - 1
  1838.     End Select
  1839.     ' Caclulate the number of points
  1840.     NumIdxs = MarkEndIdx - MarkStartIdx
  1841.     ' There are five physical points per logical point
  1842.     ReDim MarkPoints((NumIdxs + 3) * 5)
  1843.     ReDim MarkCount(NumIdxs + 2)
  1844.     ' Initialise the poly count array
  1845.     For i = 0 To NumIdxs + 2
  1846.         MarkCount(i) = 5
  1847.     Next i
  1848.     ' initialise the points of the polypolygon
  1849.     For i = MarkStartIdx + 0 To MarkEndIdx
  1850.         X1 = SGetX(GraphicHandle, i)
  1851.         Y1 = SGetY(GraphicHandle, i)
  1852.         ToPhysicalXY FG1, X1, Y1
  1853.         If (GraphicType = G_DRAWTEXT) Then
  1854.             If i = 1 Then
  1855.                 X2 = X1
  1856.                 Y2 = Y1
  1857.             Else
  1858.                 X1 = X1 + X2
  1859.                 Y1 = Y1 + Y2
  1860.             End If
  1861.         End If
  1862.         MarkPoints((i - MarkStartIdx) * 5 + 0).X = X1 - 5
  1863.         MarkPoints((i - MarkStartIdx) * 5 + 0).Y = Y1 - 5
  1864.         MarkPoints((i - MarkStartIdx) * 5 + 1).X = X1 + 5
  1865.         MarkPoints((i - MarkStartIdx) * 5 + 1).Y = Y1 - 5
  1866.         MarkPoints((i - MarkStartIdx) * 5 + 2).X = X1 + 5
  1867.         MarkPoints((i - MarkStartIdx) * 5 + 2).Y = Y1 + 5
  1868.         MarkPoints((i - MarkStartIdx) * 5 + 3).X = X1 - 5
  1869.         MarkPoints((i - MarkStartIdx) * 5 + 3).Y = Y1 + 5
  1870.         MarkPoints((i - MarkStartIdx) * 5 + 4).X = X1 - 5
  1871.         MarkPoints((i - MarkStartIdx) * 5 + 4).Y = Y1 - 5
  1872.     Next i
  1873.     DoScale MarkPicture
  1874.     DoPaint MarkPicture
  1875. End Sub
  1876. Sub mu_About_Click ()
  1877.     AboutBox.Show 1
  1878. End Sub
  1879. Sub mu_AttribBar_Click ()
  1880.     mu_AttribBar.Checked = Not mu_AttribBar.Checked
  1881.     pnlAttribBar.Visible = mu_AttribBar.Checked
  1882.     Form_Resize
  1883. End Sub
  1884. Sub mu_ButtonBar_Click ()
  1885.     mu_ButtonBar.Checked = Not mu_ButtonBar.Checked
  1886.     pnlButtonBar.Visible = mu_ButtonBar.Checked
  1887.     Form_Resize
  1888. End Sub
  1889. Sub mu_ClearAll_Click ()
  1890.     CancelMark
  1891.     ClearAll FG1
  1892.     CurrTool = 0    ' Arrow tool
  1893.     GraphicHandles(0) = 1
  1894.     GraphicTypes(0) = G_GLOBALPIC
  1895.     MaxHandle = 1
  1896.     NumPoints = 0
  1897.     CurrPoint = 0
  1898.     CurrGraphic = -1
  1899.     InitAttributes
  1900.     'InitColors
  1901.     MarkPicture = -1
  1902.     MarkObjectIdx = -1
  1903.     MarkPolyPolygon = -1
  1904.     CanSetAttribs = False
  1905.     MarkPointIdx = -1
  1906.     EditDrag = False
  1907.     CanScroll = False
  1908.     AddPrinterPage
  1909.     picDrawSpace.Refresh
  1910.     grbDrawTool(0) = True
  1911. End Sub
  1912. Sub mu_Delete_Click (Index As Integer)
  1913.     cmdDeleteGraphic = True
  1914. End Sub
  1915. Sub mu_Exit_Click ()
  1916.     Unload Me
  1917. End Sub
  1918. Sub mu_Print_Click ()
  1919.     SetPlacement FG1, Printer.ScaleLeft, Printer.ScaleTop, Printer.ScaleWidth + Printer.ScaleLeft, Printer.ScaleHeight + Printer.ScaleTop
  1920.     DoScale FG1
  1921.     Printer.Print ""
  1922.     DoDraw FG1, Printer.hDC
  1923.     Printer.EndDoc
  1924.     SetPlacement FG1, 0, 0, picDrawSpace.ScaleWidth, picDrawSpace.ScaleHeight
  1925.     DoScale FG1
  1926. End Sub
  1927. Sub mu_Tool_Click (Index As Integer)
  1928.     Dim i As Integer
  1929.     For i = 0 To 15
  1930.         mu_Tool(i).Checked = False
  1931.     Next i
  1932.     mu_Tool(Index).Checked = True
  1933.     grbDrawTool(Index) = True
  1934. End Sub
  1935. Sub mu_ViewTips_Click ()
  1936.     mu_ViewTips.Checked = Not mu_ViewTips.Checked
  1937.     'frmToolTips.Timer1.Enabled = mu_ViewTips.Checked
  1938. End Sub
  1939. Sub mu_ZoomOut_Click ()
  1940.     cdmZoomOut = True
  1941. End Sub
  1942. Sub Panel3D1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1943.     Dim i As Integer
  1944.     If (Button And 1) <> 1 Then
  1945.         Exit Sub
  1946.     End If
  1947.     For i = 0 To 6
  1948.         If Y < (Line1(i).Y1 + 53) Then
  1949.             Shape1.Top = Line1(i).Y1 - Shape1.Height / 2
  1950.             CurrBorderStyle = i
  1951.             SetMarkAttribs
  1952.             Exit Sub
  1953.         End If
  1954.     Next i
  1955.     ' We only get here if no match found yet
  1956.     ' therefore use last option
  1957.     Shape1.Top = Line1(6).Y1 - Shape1.Height / 2
  1958.     CurrBorderStyle = 6
  1959.     SetMarkAttribs
  1960. End Sub
  1961. Sub Panel3D2_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1962.     Dim i As Integer
  1963.     If (Button And 1) <> 1 Then
  1964.         Exit Sub
  1965.     End If
  1966.     For i = 0 To 4
  1967.         If Y < (Line2(i).Y1 + (Line2(i + 1).Y1 - Line2(i).Y1) / 2) Then
  1968.             Shape2.Top = Line2(i).Y1 - Shape2.Height / 2
  1969.             If i = 0 Then
  1970.                 CurrBorderWidth = 0
  1971.             Else
  1972.                 CurrBorderWidth = Line2(i).BorderWidth
  1973.             End If
  1974.             SetMarkAttribs
  1975.             Exit Sub
  1976.         End If
  1977.     Next i
  1978.     ' We only get here if no match found yet
  1979.     ' therefore use last option
  1980.     Shape2.Top = txtBorderWidth.Top + txtBorderWidth.Height / 2 - Shape2.Height / 2
  1981.     CurrBorderWidth = Val(txtBorderWidth)
  1982.     SetMarkAttribs
  1983. End Sub
  1984. Sub Panel3D3_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1985.     Dim NewStyle As Integer
  1986.     If (Button And 1) <> 1 Then
  1987.         Exit Sub
  1988.     End If
  1989.     NewStyle = 0
  1990.     Select Case Y
  1991.         Case 0 To 300:
  1992.             NewStyle = 0
  1993.             Shape4.Top = 60
  1994.         Case 301 To 555:
  1995.             NewStyle = 1
  1996.             Shape4.Top = 315
  1997.         Case Else
  1998.             NewStyle = 2
  1999.             Shape4.Top = 570
  2000.     End Select
  2001.     Select Case X
  2002.         Case 0 To 300:
  2003.             NewStyle = NewStyle + 0
  2004.             Shape4.Left = 60
  2005.         Case 301 To 555:
  2006.             NewStyle = NewStyle + 3
  2007.             Shape4.Left = 315
  2008.         Case Else
  2009.             NewStyle = NewStyle + 6
  2010.             Shape4.Left = 570
  2011.     End Select
  2012.     If NewStyle > 7 Then
  2013.         NewStyle = 7
  2014.         Shape4.Top = 315
  2015.     End If
  2016.     CurrFIllStyle = NewStyle
  2017.     SetMarkAttribs
  2018. End Sub
  2019. Sub picColorBtns_DblClick ()
  2020.     On Error Resume Next
  2021.     CMDialog1.Color = GetBorderColor(AllColors(ColorSelectIdx(ColorRow), ColorRow))
  2022.     CMDialog1.Flags = 1 'CC_RGBINIT
  2023.     CMDialog1.Action = 3
  2024.     If (Err <> 0) Then
  2025.         Err = 0
  2026.         Exit Sub
  2027.     End If
  2028.     DoPaint ColorSelect(0)
  2029.     DoPaint ColorSelect(1)
  2030.     DoPaint ColorSelect(2)
  2031.     DoPaint ColorSelect(3)
  2032.     SetBorderColor AllColors(ColorSelectIdx(ColorRow), ColorRow), CMDialog1.Color
  2033.     SetFillColor AllColors(ColorSelectIdx(ColorRow), ColorRow), CMDialog1.Color
  2034.     DoPaint AllColors(ColorSelectIdx(ColorRow), ColorRow)
  2035.     DoPaint ColorSelect(0)
  2036.     DoPaint ColorSelect(1)
  2037.     DoPaint ColorSelect(2)
  2038.     DoPaint ColorSelect(3)
  2039.     UpdateCurrentColors
  2040.     SetMarkAttribs
  2041. End Sub
  2042. Sub picColorBtns_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  2043.     Dim Idx As Integer
  2044.     Dim BtnWidth As Double
  2045.     Dim BtnHeight As Integer
  2046.     BtnWidth = picColorBtns.ScaleWidth / NUM_COLORS
  2047.     BtnHeight = picColorBtns.ScaleHeight / 4
  2048.     ColorRow = Y / BtnHeight - .5
  2049.     Idx = (X / BtnWidth - .5)
  2050.     DoPaint ColorSelect(ColorRow)
  2051.     SetX ColorSelect(ColorRow), 1, BtnWidth * Idx
  2052.     SetX ColorSelect(ColorRow), 2, BtnWidth * (Idx + 1)
  2053.     DoPaint ColorSelect(ColorRow)
  2054.     ColorSelectIdx(ColorRow) = Idx
  2055.     UpdateCurrentColors
  2056.     SetMarkAttribs
  2057. End Sub
  2058. Sub picColorBtns_Paint ()
  2059.     'picColorBtns.Cls
  2060.     DoDraw FG2, picColorBtns.hDC
  2061. End Sub
  2062. Sub picDrawSpace_DblClick ()
  2063.     ' If a polypolygon is been drawn then end it
  2064.     If (CurrTool = G_POLYPOLYGON) And (CurrGraphic <> -1) Then
  2065.         DoPaint CurrGraphic
  2066.         SSetX CurrGraphic, CurrPoint, initx
  2067.         SSetY CurrGraphic, CurrPoint, inity
  2068.         SetPolyCount CurrGraphic, PolyPolygonCountIdx, CurrPoint - PolyCountStartIdx + 1
  2069.         SetDrawMode CurrGraphic, 13
  2070.         DoScale CurrGraphic
  2071.         DoPaint CurrGraphic
  2072.         CurrPoint = 0
  2073.         NumPoints = 0
  2074.         CurrGraphic = -1
  2075.     End If
  2076. End Sub
  2077. Sub picDrawSpace_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  2078.     Dim tx As Double
  2079.     Dim ty As Double
  2080.     tx = X
  2081.     ty = Y
  2082.     ToScaleXY FG1, tx, ty
  2083.     If (Button And 2) = 2 Then
  2084.         If (CurrTool = 6) Or (CurrTool = 8) Or (CurrTool = 14) Or (CurrTool = G_POLYTEXTOut) Then
  2085.             NumPoints = CurrPoint
  2086.         Else
  2087.             If (CurrTool = G_POLYPOLYGON) And (CurrGraphic <> -1) Then
  2088.                 DoPaint CurrGraphic
  2089.                 SSetX CurrGraphic, CurrPoint, initx
  2090.                 SSetY CurrGraphic, CurrPoint, inity
  2091.                 initx = tx
  2092.                 inity = ty
  2093.                 SetPolyCount CurrGraphic, PolyPolygonCountIdx, CurrPoint - PolyCountStartIdx + 1
  2094.                 SAddPoint CurrGraphic, tx, ty
  2095.                 SAddPoint CurrGraphic, tx, ty
  2096.                 AddPolyCount CurrGraphic, 2
  2097.                 PolyCountStartIdx = CurrPoint + 1
  2098.                 CurrPoint = CurrPoint + 2
  2099.                 PolyPolygonCountIdx = PolyPolygonCountIdx + 1
  2100.                 DoScale CurrGraphic
  2101.                 DoPaint CurrGraphic
  2102.                 Exit Sub
  2103.             End If
  2104.         End If
  2105.     End If
  2106.     If NumPoints <> 0 Then
  2107.         Exit Sub
  2108.     End If
  2109.     Select Case CurrTool
  2110.         Case 0:
  2111.             If (MarkPointIdx >= 0) And (MarkObjectIdx <> -1) Then
  2112.                 NumPoints = MarkPointIdx
  2113.                 CurrPoint = MarkPointIdx
  2114.                 CurrGraphic = GraphicHandles(MarkObjectIdx)
  2115.                 EditDrag = True
  2116.                 SetDrawMode CurrGraphic, 10
  2117.                 SetFillStyle CurrGraphic, FS_HOLLOW
  2118.                 SetBackStyle CurrGraphic, BKS_TRANSPARENT
  2119.                 SetBorderWidth CurrGraphic, 0
  2120.                 DoScale CurrGraphic
  2121.                 DoPaint CurrGraphic
  2122.                 If (GraphicTypes(MarkObjectIdx) = G_DRAWTEXT) Then
  2123.                     initx = SGetX(CurrGraphic, 1)
  2124.                     inity = SGetY(CurrGraphic, 1)
  2125.                 End If
  2126.                 Exit Sub
  2127.             Else
  2128.                 EditDrag = False
  2129.                 Exit Sub
  2130.             End If
  2131.         Case G_ARC:
  2132.             NumPoints = 4
  2133.             CurrPoint = 2
  2134.             CurrGraphic = SCreateArc(FG1, tx, ty, tx + 1, ty + 1, 1, 1, 1, 1)
  2135.         Case G_CHORD:
  2136.             NumPoints = 4
  2137.             CurrPoint = 2
  2138.             CurrGraphic = SCreateChord(FG1, tx, ty, tx + 1, ty + 1, 1, 1, 1, 1)
  2139.         Case G_DRAWTEXT:
  2140.             NumPoints = 2
  2141.             CurrPoint = 2
  2142.             CurrGraphic = SCreateDrawText(FG1, "Draw Text", tx, ty, 20, 20, DT_LEFT Or DT_WORDBREAK)
  2143.             initx = tx
  2144.             inity = ty
  2145.         Case G_ELLIPSE:
  2146.             NumPoints = 2
  2147.             CurrPoint = 2
  2148.             CurrGraphic = SCreateEllipse(FG1, tx, ty, tx, ty)
  2149.         Case G_LINE:
  2150.             NumPoints = 2
  2151.             CurrPoint = 2
  2152.             CurrGraphic = SCreateLine(FG1, tx, ty, tx, ty)
  2153.         Case G_POLYGON:
  2154.             NumPoints = 10000
  2155.             CurrPoint = 2
  2156.             CurrGraphic = SCreatePolygon(FG1)
  2157.             SAddPoint CurrGraphic, tx, ty
  2158.             SAddPoint CurrGraphic, tx, ty
  2159.             SAddPoint CurrGraphic, tx, ty
  2160.         Case G_PIE:
  2161.             NumPoints = 4
  2162.             CurrPoint = 2
  2163.             CurrGraphic = SCreatePie(FG1, tx, ty, tx + 1, ty + 1, 1, 1, 1, 1)
  2164.         Case G_POLYLINE:
  2165.             NumPoints = 10000
  2166.             CurrPoint = 2
  2167.             CurrGraphic = SCreatePolyline(FG1)
  2168.             SAddPoint CurrGraphic, tx, ty
  2169.             SAddPoint CurrGraphic, tx, ty
  2170.             SAddPoint CurrGraphic, tx, ty
  2171.         Case G_POLYPOLYGON:
  2172.             NumPoints = 10000
  2173.             CurrPoint = 1
  2174.             PolyCountStartIdx = 0
  2175.             CurrGraphic = SCreatePolyPolygon(FG1)
  2176.             SAddPoint CurrGraphic, tx, ty
  2177.             SAddPoint CurrGraphic, tx, ty
  2178.             initx = tx
  2179.             inity = ty
  2180.             AddPolyCount CurrGraphic, 2
  2181.             PolyPolygonCountIdx = 0
  2182.         Case G_POLYTEXTOut:
  2183.             NumPoints = 10000
  2184.             CurrPoint = 1
  2185.             CurrGraphic = SCreatePolyTextOut(FG1)
  2186.             SAddPText CurrGraphic, tx, ty, ""
  2187.             SAddPText CurrGraphic, tx, ty, "PolyTextOut"
  2188.         Case G_RECTANGLE:
  2189.             NumPoints = 2
  2190.             CurrPoint = 2
  2191.             CurrGraphic = SCReateRectangle(FG1, tx, ty, tx, ty)
  2192.         Case G_ROUNDRECT:
  2193.             NumPoints = 3
  2194.             CurrPoint = 2
  2195.             CurrGraphic = SCreateRoundRect(FG1, tx, ty, tx, ty, tx, ty)
  2196.         Case G_TEXTOut:
  2197.             NumPoints = 1
  2198.             CurrPoint = 1
  2199.             initx = tx
  2200.             inity = ty
  2201.             CurrGraphic = SCreateTextOut(FG1, tx, ty, "Text Out")
  2202.         Case G_FREEHAND:
  2203.             CurrGraphic = SCreatePolyline(FG1)
  2204.             NumPoints = 10000
  2205.             CurrPoint = 2
  2206.             SAddPoint CurrGraphic, tx, ty
  2207.             SAddPoint CurrGraphic, tx, ty
  2208.         Case 15:
  2209.             NumPoints = 2
  2210.             CurrPoint = 2
  2211.             initx = tx
  2212.             inity = ty
  2213.             CurrGraphic = SCReateRectangle(FG1, tx, ty, tx, ty)
  2214.         Case Else
  2215.             Exit Sub
  2216.     End Select
  2217.     SetDrawMode CurrGraphic, 10
  2218.     If MaxHandle > MAX_GRAPHICS Then
  2219.         MsgBox "Out of graphic handles"
  2220.     Else
  2221.         GraphicHandles(MaxHandle) = CurrGraphic
  2222.         GraphicTypes(MaxHandle) = CurrTool
  2223.         MaxHandle = MaxHandle + 1
  2224.     End If
  2225.     If (CurrTool <> 15) And 1 Then
  2226.         SetBorderColor CurrGraphic, CurrBorderColor
  2227.         SetBorderStyle CurrGraphic, CurrBorderStyle
  2228.         SetBorderWidth CurrGraphic, -CurrBorderWidth
  2229.         SetBackColor CurrGraphic, CurrBackColor
  2230.         SetBackStyle CurrGraphic, CurrBackStyle
  2231.         SetFillColor CurrGraphic, CurrFillColor
  2232.         SetFillStyle CurrGraphic, CurrFIllStyle
  2233.         SetFontColor CurrGraphic, CurrFontColor
  2234.         SetFontFaceName CurrGraphic, CurrFontFaceName
  2235.         If CurrFontBold Then
  2236.             SetFontWeight CurrGraphic, 700
  2237.         Else
  2238.             SetFontWeight CurrGraphic, 300
  2239.         End If
  2240.         SetFontItalic CurrGraphic, CurrFontItalic
  2241.         SetFontPointHeight CurrGraphic, CurrFontHeight
  2242.         SetFontStrikeOut CurrGraphic, CurrFontStrikeOut
  2243.         SetFontUnderline CurrGraphic, CurrFontUnderline
  2244.     End If
  2245.     DoScale CurrGraphic
  2246.     DoPaint CurrGraphic
  2247. End Sub
  2248. Sub picDrawSpace_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  2249.     Dim tx As Double
  2250.     Dim ty As Double
  2251.     tx = X
  2252.     ty = Y
  2253.     ToScaleXY FG1, tx, ty
  2254.     If (tx > 10000) Or (tx < -10000) Or (Abs(tx) < .1) Then
  2255.         lblXPos = Format$(tx, "0.00000E+00")
  2256.     Else
  2257.         lblXPos = Format$(tx)
  2258.     End If
  2259.     If (ty > 10000) Or (ty < -10000) Or (Abs(ty) < .1) Then
  2260.         lblYPos = Format$(ty, "0.00000E+00")
  2261.     Else
  2262.         lblYPos = Format$(ty)
  2263.     End If
  2264.     If CurrTool = 0 And (Not EditDrag) Then
  2265.         DoMarkPosCheck X, Y
  2266.     End If
  2267.     If CurrPoint > NumPoints Then
  2268.         Exit Sub
  2269.     End If
  2270.     If CurrGraphic = -1 Then
  2271.         Exit Sub
  2272.     End If
  2273.     Select Case CurrTool
  2274.         Case 0:
  2275.             If (GraphicTypes(MarkObjectIdx) = G_DRAWTEXT) Or (GraphicTypes(MarkObjectIdx) = G_TEXTOut) Or (GraphicTypes(MarkObjectIdx) = G_POLYTEXTOut) Then
  2276.                 SetDrawMode CurrGraphic, 13
  2277.                 SetFontColor CurrGraphic, QBColor(15)
  2278.                 SetBackColor CurrGraphic, QBColor(15)
  2279.             End If
  2280.             DoScale CurrGraphic
  2281.             DoPaint CurrGraphic
  2282.             If (GraphicTypes(MarkObjectIdx) = G_DRAWTEXT) Then
  2283.                 If (CurrPoint = 2) Then
  2284.                     SSetX CurrGraphic, CurrPoint, Abs(tx - initx)
  2285.                     SSetY CurrGraphic, CurrPoint, Abs(ty - inity)
  2286.                 Else
  2287.                     SSetX CurrGraphic, CurrPoint, tx
  2288.                     SSetY CurrGraphic, CurrPoint, ty
  2289.                 End If
  2290.             Else
  2291.                 SSetX CurrGraphic, CurrPoint, tx
  2292.                 SSetY CurrGraphic, CurrPoint, ty
  2293.             End If
  2294.             SetMarkPos X, Y, MarkPointIdx
  2295.             If (GraphicTypes(MarkObjectIdx) = G_DRAWTEXT) Or (GraphicTypes(MarkObjectIdx) = G_TEXTOut) Or (GraphicTypes(MarkObjectIdx) = G_POLYTEXTOut) Then
  2296.                 SetFontColor CurrGraphic, CurrFontColor
  2297.                 SetBackColor CurrGraphic, CurrBackColor
  2298.             End If
  2299.             DoScale CurrGraphic
  2300.             DoPaint CurrGraphic
  2301.         Case 3, 13:
  2302.             SetDrawMode CurrGraphic, 13
  2303.             SetFontColor CurrGraphic, QBColor(15)
  2304.             SetBackColor CurrGraphic, QBColor(15)
  2305.             DoScale CurrGraphic
  2306.             DoPaint CurrGraphic
  2307.             If CurrTool = 3 Then
  2308.                 SSetX CurrGraphic, CurrPoint, tx - initx
  2309.                 SSetY CurrGraphic, CurrPoint, ty - inity
  2310.             Else
  2311.                 SSetX CurrGraphic, CurrPoint, tx
  2312.                 SSetY CurrGraphic, CurrPoint, ty
  2313.             End If
  2314.             SetFontColor CurrGraphic, CurrFontColor
  2315.             SetBackColor CurrGraphic, CurrBackColor
  2316.             DoScale CurrGraphic
  2317.             DoPaint CurrGraphic
  2318.         Case 1, 2, 4, 5, 6, 7, 8, 11, 12, 10, G_POLYPOLYGON:
  2319.             DoScale CurrGraphic
  2320.             DoPaint CurrGraphic
  2321.             SSetX CurrGraphic, CurrPoint, tx
  2322.             SSetY CurrGraphic, CurrPoint, ty
  2323.             DoScale CurrGraphic
  2324.             DoPaint CurrGraphic
  2325.         Case 15:
  2326.             DoPaint CurrGraphic
  2327.             If chkKeepAspectRatio.Value Then
  2328.                 If Abs(tx - initx) > Abs(ty - inity) Then
  2329.                     'Adjust TX
  2330.                     tx = initx + Abs(inity - ty) * Sgn(-initx + tx)
  2331.                 Else
  2332.                     ' Adjust TY
  2333.                     ty = inity + Abs(initx - tx) * Sgn(-inity + ty)
  2334.                 End If
  2335.             End If
  2336.             SSetX CurrGraphic, CurrPoint, tx
  2337.             SSetY CurrGraphic, CurrPoint, ty
  2338.             DoScale CurrGraphic
  2339.             DoPaint CurrGraphic
  2340.         Case 14
  2341.             If CurrPoint < NumPoints Then
  2342.                 SetDrawMode CurrGraphic, 13
  2343.                 SAddPoint CurrGraphic, tx, ty
  2344.                 DoScale CurrGraphic
  2345.                 DoPaint CurrGraphic
  2346.                 CurrPoint = CurrPoint + 1
  2347.             End If
  2348.     End Select
  2349. End Sub
  2350. Sub picDrawSpace_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  2351.     Dim tx As Double
  2352.     Dim ty As Double
  2353.     Dim TheText As String
  2354.     Dim NewLeft As Double
  2355.     Dim NewTop As Double
  2356.     Dim NewWidth As Double
  2357.     Dim NewHeight As Double
  2358.     Dim dummy As Double
  2359.     tx = X
  2360.     ty = Y
  2361.     ToScaleXY FG1, tx, ty
  2362.     If (CurrTool = 0) And ((Button And 1) = 1) And (Not EditDrag) Then
  2363.         DoHitTesting Shift, tx, ty
  2364.         Exit Sub
  2365.     End If
  2366.     If CurrGraphic = -1 Then
  2367.         Exit Sub
  2368.     End If
  2369.     Select Case CurrTool
  2370.         Case 0:
  2371.             'DoPaint CurrGraphic
  2372.             If (GraphicTypes(MarkObjectIdx) = G_DRAWTEXT) And (CurrPoint = 2) Then
  2373.                 SSetX CurrGraphic, CurrPoint, Abs(tx - initx)
  2374.                 SSetY CurrGraphic, CurrPoint, Abs(ty - inity)
  2375.             Else
  2376.                 SSetX CurrGraphic, CurrPoint, tx
  2377.                 SSetY CurrGraphic, CurrPoint, ty
  2378.             End If
  2379.             SetDrawMode CurrGraphic, 13
  2380.             SetMarkAttribs
  2381.             'DoScale CurrGraphic
  2382.             'DoPaint CurrGraphic
  2383.             CurrPoint = 0
  2384.             NumPoints = 0
  2385.             CurrGraphic = -1
  2386.             EditDrag = False
  2387.             'picDrawSpace.Refresh
  2388.         Case 3, 13:
  2389.             SetFontColor CurrGraphic, QBColor(15)
  2390.             SetBackColor CurrGraphic, QBColor(15)
  2391.             DoPaint CurrGraphic
  2392.             If CurrTool = 3 Then
  2393.                 SSetX CurrGraphic, CurrPoint, tx - initx
  2394.                 SSetY CurrGraphic, CurrPoint, ty - inity
  2395.             Else
  2396.                 SSetX CurrGraphic, CurrPoint, tx
  2397.                 SSetY CurrGraphic, CurrPoint, ty
  2398.             End If
  2399.             SetFontColor CurrGraphic, CurrFontColor
  2400.             DoScale CurrGraphic
  2401.             DoPaint CurrGraphic
  2402.             CurrPoint = CurrPoint + 1
  2403.             SetFontColor CurrGraphic, CurrFontColor
  2404.             SetBackColor CurrGraphic, CurrBackColor
  2405.             TheText = InputBox$("Enter your text.")
  2406.             SetString CurrGraphic, TheText
  2407.             picDrawSpace.Refresh
  2408.         Case 1, 2, 4, 5, 7, 11, 12:
  2409.             DoPaint CurrGraphic
  2410.             SSetX CurrGraphic, CurrPoint, tx
  2411.             SSetY CurrGraphic, CurrPoint, ty
  2412.             DoScale CurrGraphic
  2413.             DoPaint CurrGraphic
  2414.             CurrPoint = CurrPoint + 1
  2415.         Case 14:
  2416.             NumPoints = CurrPoint
  2417.             CurrPoint = CurrPoint + 1
  2418.         Case 6, 8:
  2419.             DoPaint CurrGraphic
  2420.             SSetX CurrGraphic, CurrPoint, tx
  2421.             SSetY CurrGraphic, CurrPoint, ty
  2422.             SAddPoint CurrGraphic, tx, ty
  2423.             DoScale CurrGraphic
  2424.             DoPaint CurrGraphic
  2425.             CurrPoint = CurrPoint + 1
  2426.         Case G_POLYPOLYGON:
  2427.             DoPaint CurrGraphic
  2428.             SSetX CurrGraphic, CurrPoint, tx
  2429.             SSetY CurrGraphic, CurrPoint, ty
  2430.             If CurrPoint <> NumPoints Then
  2431.                 SAddPoint CurrGraphic, tx, ty
  2432.                 SetPolyCount CurrGraphic, PolyPolygonCountIdx, CurrPoint - PolyCountStartIdx + 2
  2433.             End If
  2434.             DoScale CurrGraphic
  2435.             DoPaint CurrGraphic
  2436.             CurrPoint = CurrPoint + 1
  2437.         Case G_POLYTEXTOut:
  2438.             DoPaint CurrGraphic
  2439.             SSetX CurrGraphic, CurrPoint, tx
  2440.             SSetY CurrGraphic, CurrPoint, ty
  2441.             If CurrPoint <> NumPoints Then
  2442.                 SAddPText CurrGraphic, tx, ty, "PolyTextOut"
  2443.             End If
  2444.             TheText = InputBox$("Enter your text.")
  2445.             SetPTextAt CurrGraphic, CurrPoint, TheText
  2446.             picDrawSpace.Refresh
  2447.             CurrPoint = CurrPoint + 1
  2448.         Case 15:
  2449.             DoPaint CurrGraphic
  2450.             SSetX CurrGraphic, CurrPoint, tx
  2451.             SSetY CurrGraphic, CurrPoint, ty
  2452.             If tx < initx Then
  2453.                 dummy = tx
  2454.                 tx = initx
  2455.                 initx = dummy
  2456.             End If
  2457.             If ty < inity Then
  2458.                 dummy = ty
  2459.                 ty = inity
  2460.                 inity = dummy
  2461.             End If
  2462.             If chkKeepAspectRatio.Value Then
  2463.                 If Abs(tx - initx) > Abs(ty - inity) Then
  2464.                     'Adjust TX
  2465.                     tx = initx + Abs(inity - ty) * Sgn(-initx + tx)
  2466.                 Else
  2467.                     ' Adjust TY
  2468.                     ty = inity + Abs(initx - tx) * Sgn(-inity + ty)
  2469.                 End If
  2470.             End If
  2471.             
  2472.             SetScale FG1, initx, inity, tx - initx, ty - inity
  2473.             If chkKeepAspectRatio.Value Then
  2474.                 If picDrawSpace.ScaleWidth > picDrawSpace.ScaleHeight Then
  2475.                     SetPlacement FG1, 0, 0, picDrawSpace.ScaleHeight, picDrawSpace.ScaleHeight
  2476.                 Else
  2477.                     SetPlacement FG1, 0, 0, picDrawSpace.ScaleWidth, picDrawSpace.ScaleWidth
  2478.                 End If
  2479.             Else
  2480.                 SetPlacement FG1, 0, 0, picDrawSpace.ScaleWidth, picDrawSpace.ScaleHeight
  2481.             End If
  2482.             CurrPoint = 0
  2483.             NumPoints = 0
  2484.             RemoveObject CurrGraphic, picDrawSpace.hDC, 0, True, 0
  2485.             CurrGraphic = -1
  2486.             picDrawSpace.Refresh
  2487.     End Select
  2488.     If CurrPoint > NumPoints Then
  2489.         If CurrGraphic <> -1 Then
  2490.             SetDrawMode CurrGraphic, 13
  2491.             DoScale CurrGraphic
  2492.             DoPaint CurrGraphic
  2493.         End If
  2494.         CurrPoint = 0
  2495.         NumPoints = 0
  2496.         CurrGraphic = -1
  2497.     End If
  2498. End Sub
  2499. Sub picDrawSpace_Paint ()
  2500.     'picDRawSpace.Cls
  2501.     DoScale FG1
  2502.     'DoDraw 1, picDRawSpace.hDC
  2503.     DoPaint FG1
  2504. End Sub
  2505. Sub ResizeColorButtons ()
  2506.     Dim i As Integer
  2507.     Dim j As Integer
  2508.     Dim ButtonWidth As Double
  2509.     ButtonWidth = (picColorBtns.ScaleWidth / NUM_COLORS - 0#)
  2510.     For i = 0 To NUM_COLORS - 1
  2511.         For j = 0 To 3
  2512.             SetX AllColors(i, j), 1, i * ButtonWidth
  2513.             SetX AllColors(i, j), 2, (i + 1) * ButtonWidth
  2514.         Next j
  2515.     Next i
  2516.     For j = 0 To 3
  2517.         SetX ColorSelect(j), 1, ColorSelectIdx(j) * ButtonWidth
  2518.         SetX ColorSelect(j), 2, (ColorSelectIdx(j) + 1) * ButtonWidth
  2519.         SetBorderWidth ColorSelect(j), ButtonWidth / 4
  2520.     Next j
  2521. End Sub
  2522. Sub SetMarkAttribs ()
  2523.     If (MarkObjectIdx >= 0) And CanSetAttribs Then
  2524.         SetBorderColor GraphicHandles(MarkObjectIdx), CurrBorderColor
  2525.         SetBorderStyle GraphicHandles(MarkObjectIdx), CurrBorderStyle
  2526.         SetBorderWidth GraphicHandles(MarkObjectIdx), -CurrBorderWidth
  2527.         SetBackColor GraphicHandles(MarkObjectIdx), CurrBackColor
  2528.         SetBackStyle GraphicHandles(MarkObjectIdx), CurrBackStyle
  2529.         SetFillColor GraphicHandles(MarkObjectIdx), CurrFillColor
  2530.         SetFillStyle GraphicHandles(MarkObjectIdx), CurrFIllStyle
  2531.         SetFontColor GraphicHandles(MarkObjectIdx), CurrFontColor
  2532.         SetFontFaceName GraphicHandles(MarkObjectIdx), CurrFontFaceName
  2533.         If CurrFontBold Then
  2534.             SetFontWeight GraphicHandles(MarkObjectIdx), 700
  2535.         Else
  2536.             SetFontWeight GraphicHandles(MarkObjectIdx), 300
  2537.         End If
  2538.         SetFontItalic GraphicHandles(MarkObjectIdx), CurrFontItalic
  2539.         SetFontPointHeight GraphicHandles(MarkObjectIdx), CurrFontHeight
  2540.         SetFontStrikeOut GraphicHandles(MarkObjectIdx), CurrFontStrikeOut
  2541.         SetFontUnderline GraphicHandles(MarkObjectIdx), CurrFontUnderline
  2542.         picDrawSpace.Refresh
  2543.     End If
  2544. End Sub
  2545. Sub SetMarkPos (X As Single, Y As Single, ThePointIdx As Integer)
  2546.     DoPaint MarkPicture
  2547.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 0).X = X - 5
  2548.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 0).Y = Y - 5
  2549.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 1).X = X + 5
  2550.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 1).Y = Y - 5
  2551.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 2).X = X + 5
  2552.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 2).Y = Y + 5
  2553.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 3).X = X - 5
  2554.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 3).Y = Y + 5
  2555.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 4).X = X - 5
  2556.     MarkPoints((ThePointIdx - MarkStartIdx) * 5 + 4).Y = Y - 5
  2557.     DoPaint MarkPicture
  2558. End Sub
  2559. Sub SetSelectBorderWidth (BorderWidth As Integer)
  2560.     Dim i As Integer
  2561.     If BorderWidth = 0 Then
  2562.         Shape2.Top = Line2(0).Y1 - Shape2.Height / 2
  2563.         CurrBorderWidth = BorderWidth
  2564.         Exit Sub
  2565.     End If
  2566.     For i = 1 To 5
  2567.         If BorderWidth = Line2(i).BorderWidth Then
  2568.             Shape2.Top = Line2(i).Y1 - Shape2.Height / 2
  2569.             CurrBorderWidth = BorderWidth
  2570.             Exit Sub
  2571.         End If
  2572.     Next i
  2573.     ' We only get here if no match found so use last one
  2574.     Shape2.Top = txtBorderWidth.Top + txtBorderWidth.Height / 2 - Shape2.Height / 2
  2575.     txtBorderWidth = Str$(BorderWidth)
  2576. End Sub
  2577. Sub SetSelectedBorderStyle (NewBorderStyle As Integer)
  2578.     Dim TempY As Single
  2579.     TempY = Line1(NewBorderStyle).Y1
  2580.     Panel3D1_MouseUp 1, 0, 0, TempY
  2581. End Sub
  2582. Sub SetSelectedColor (TheColor, TheRow As Integer)
  2583.     Dim BtnWidth As Double
  2584.     Dim BtnHeight As Double
  2585.     Dim X As Single
  2586.     Dim Y As Single
  2587.     Dim i As Integer
  2588.     BtnWidth = picColorBtns.ScaleWidth / NUM_COLORS
  2589.     BtnHeight = picColorBtns.ScaleHeight / 4
  2590.     ColorRow = Y / BtnHeight - .5
  2591.     Y = (TheRow + .5) * BtnHeight
  2592.     X = -1
  2593.     For i = 0 To NUM_COLORS - 1
  2594.         If GetBorderColor(AllColors(i, TheRow)) = TheColor Then
  2595.             X = (i + .5) * BtnWidth
  2596.             i = NUM_COLORS
  2597.         End If
  2598.     Next i
  2599.     If X = -1 Then
  2600.         ' No matching color was found so make a new one
  2601.         DoPaint ColorSelect(0)
  2602.         DoPaint ColorSelect(1)
  2603.         DoPaint ColorSelect(2)
  2604.         DoPaint ColorSelect(3)
  2605.         SetBorderColor AllColors(NUM_COLORS - 1, TheRow), TheColor
  2606.         SetFillColor AllColors(NUM_COLORS - 1, TheRow), TheColor
  2607.         DoPaint AllColors(NUM_COLORS - 1, TheRow)
  2608.         DoPaint ColorSelect(0)
  2609.         DoPaint ColorSelect(1)
  2610.         DoPaint ColorSelect(2)
  2611.         DoPaint ColorSelect(3)
  2612.         X = (NUM_COLORS - .5) * BtnWidth
  2613.     End If
  2614.     picColorBtns_MouseUp 1, 0, X, Y
  2615. End Sub
  2616. Sub SetSelectFillStyle (FillStyle As Integer)
  2617.     Dim X As Single
  2618.     Dim Y As Single
  2619.     Select Case FillStyle
  2620.         Case 0:
  2621.             X = 150
  2622.             Y = 150
  2623.         Case 1:
  2624.             X = 150
  2625.             Y = 420
  2626.         Case 2:
  2627.             X = 150
  2628.             Y = 600
  2629.         Case 3:
  2630.             X = 420
  2631.             Y = 150
  2632.         Case 4:
  2633.             X = 420
  2634.             Y = 420
  2635.         Case 5:
  2636.             X = 420
  2637.             Y = 600
  2638.         Case 6:
  2639.             X = 600
  2640.             Y = 150
  2641.         Case 7:
  2642.             X = 600
  2643.             Y = 420
  2644.     End Select
  2645.     Panel3D3_MouseUp 1, 0, X, Y
  2646. End Sub
  2647. Sub txtBorderWidth_Change ()
  2648.     CurrBorderWidth = Val(txtBorderWidth)
  2649. End Sub
  2650. Sub UpdateCurrentColors ()
  2651.     CurrBorderColor = GetBorderColor(AllColors(ColorSelectIdx(0), 0))
  2652.     CurrFillColor = GetBorderColor(AllColors(ColorSelectIdx(1), 1))
  2653.     CurrFontColor = GetBorderColor(AllColors(ColorSelectIdx(2), 2))
  2654.     CurrBackColor = GetBorderColor(AllColors(ColorSelectIdx(3), 3))
  2655. End Sub
  2656.