home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / PicText268149222001.psc / pictext0.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-09-22  |  78.1 KB  |  2,380 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form frmPicText0 
  5.    Caption         =   "Image Texter"
  6.    ClientHeight    =   6405
  7.    ClientLeft      =   60
  8.    ClientTop       =   630
  9.    ClientWidth     =   11640
  10.    Icon            =   "pictext0.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    ScaleHeight     =   427
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   776
  16.    Begin VB.Frame fraTextPanel 
  17.       Height          =   1395
  18.       Left            =   1650
  19.       TabIndex        =   8
  20.       Top             =   60
  21.       Width           =   9015
  22.       Begin VB.TextBox txbWriteText 
  23.          Height          =   360
  24.          Left            =   120
  25.          TabIndex        =   17
  26.          TabStop         =   0   'False
  27.          Text            =   "Type text here"
  28.          Top             =   930
  29.          Width           =   7185
  30.       End
  31.       Begin VB.Frame fraMainColor 
  32.          Height          =   615
  33.          Left            =   2820
  34.          TabIndex        =   13
  35.          Top             =   0
  36.          Width           =   4485
  37.          Begin VB.PictureBox picTextColor 
  38.             Appearance      =   0  'Flat
  39.             BackColor       =   &H80000005&
  40.             ForeColor       =   &H80000008&
  41.             Height          =   270
  42.             Left            =   900
  43.             ScaleHeight     =   240
  44.             ScaleWidth      =   240
  45.             TabIndex        =   15
  46.             TabStop         =   0   'False
  47.             Top             =   210
  48.             Width           =   270
  49.          End
  50.          Begin VB.CommandButton cmdTextColor 
  51.             Height          =   270
  52.             Left            =   90
  53.             Picture         =   "pictext0.frx":030A
  54.             Style           =   1  'Graphical
  55.             TabIndex        =   14
  56.             TabStop         =   0   'False
  57.             ToolTipText     =   "Color dialog"
  58.             Top             =   210
  59.             Width           =   270
  60.          End
  61.          Begin VB.Image imgColorPicker 
  62.             Appearance      =   0  'Flat
  63.             BorderStyle     =   1  'Fixed Single
  64.             Height          =   270
  65.             Left            =   480
  66.             Picture         =   "pictext0.frx":064C
  67.             ToolTipText     =   "Color picker (from image)"
  68.             Top             =   210
  69.             Width           =   270
  70.          End
  71.          Begin VB.Label lblTextColor 
  72.             Caption         =   "lblTextColor"
  73.             Height          =   255
  74.             Left            =   1590
  75.             TabIndex        =   16
  76.             Top             =   240
  77.             Width           =   2715
  78.          End
  79.       End
  80.       Begin VB.Frame frafont 
  81.          Height          =   915
  82.          Index           =   0
  83.          Left            =   120
  84.          TabIndex        =   9
  85.          Top             =   0
  86.          Width           =   2565
  87.          Begin VB.ComboBox cboFontName 
  88.             Appearance      =   0  'Flat
  89.             Height          =   315
  90.             Left            =   90
  91.             Sorted          =   -1  'True
  92.             Style           =   2  'Dropdown List
  93.             TabIndex        =   11
  94.             TabStop         =   0   'False
  95.             Top             =   180
  96.             Width           =   2385
  97.          End
  98.          Begin VB.TextBox txtFontSize 
  99.             Height          =   300
  100.             Left            =   630
  101.             TabIndex        =   10
  102.             TabStop         =   0   'False
  103.             Text            =   "24"
  104.             Top             =   540
  105.             Width           =   375
  106.          End
  107.          Begin VB.Label lblFontSize1 
  108.             Caption         =   "Size"
  109.             Height          =   225
  110.             Left            =   240
  111.             TabIndex        =   12
  112.             Top             =   600
  113.             Width           =   375
  114.          End
  115.          Begin VB.Image imgBold 
  116.             Appearance      =   0  'Flat
  117.             BorderStyle     =   1  'Fixed Single
  118.             Height          =   270
  119.             Left            =   1380
  120.             Picture         =   "pictext0.frx":0796
  121.             ToolTipText     =   "Bold"
  122.             Top             =   570
  123.             Width           =   270
  124.          End
  125.          Begin VB.Image imgItalic 
  126.             Appearance      =   0  'Flat
  127.             BorderStyle     =   1  'Fixed Single
  128.             Height          =   270
  129.             Left            =   1890
  130.             Picture         =   "pictext0.frx":08E0
  131.             ToolTipText     =   "Italic"
  132.             Top             =   570
  133.             Width           =   270
  134.          End
  135.       End
  136.       Begin VB.Shape shpTextSample 
  137.          Height          =   1245
  138.          Left            =   7560
  139.          Top             =   120
  140.          Width           =   1335
  141.       End
  142.       Begin VB.Label lblTextSample 
  143.          Appearance      =   0  'Flat
  144.          BackColor       =   &H80000005&
  145.          Caption         =   "Aa"
  146.          ForeColor       =   &H80000008&
  147.          Height          =   1185
  148.          Left            =   7620
  149.          TabIndex        =   18
  150.          Top             =   150
  151.          Width           =   1215
  152.       End
  153.    End
  154.    Begin VB.PictureBox picZ 
  155.       BackColor       =   &H00C0C0C0&
  156.       Height          =   4305
  157.       Left            =   1650
  158.       ScaleHeight     =   283
  159.       ScaleMode       =   3  'Pixel
  160.       ScaleWidth      =   579
  161.       TabIndex        =   2
  162.       Top             =   1530
  163.       Width           =   8745
  164.       Begin VB.PictureBox picDisp 
  165.          Appearance      =   0  'Flat
  166.          AutoRedraw      =   -1  'True
  167.          AutoSize        =   -1  'True
  168.          BackColor       =   &H80000005&
  169.          ForeColor       =   &H80000008&
  170.          Height          =   4335
  171.          Left            =   0
  172.          MouseIcon       =   "pictext0.frx":0A2A
  173.          Picture         =   "pictext0.frx":0D34
  174.          ScaleHeight     =   287
  175.          ScaleMode       =   3  'Pixel
  176.          ScaleWidth      =   369
  177.          TabIndex        =   7
  178.          Top             =   0
  179.          Width           =   5565
  180.       End
  181.       Begin VB.PictureBox picAuto 
  182.          Appearance      =   0  'Flat
  183.          AutoRedraw      =   -1  'True
  184.          AutoSize        =   -1  'True
  185.          BackColor       =   &H00FFFFFF&
  186.          ForeColor       =   &H80000008&
  187.          Height          =   675
  188.          Left            =   870
  189.          ScaleHeight     =   43
  190.          ScaleMode       =   3  'Pixel
  191.          ScaleWidth      =   45
  192.          TabIndex        =   22
  193.          Top             =   1920
  194.          Visible         =   0   'False
  195.          Width           =   705
  196.       End
  197.       Begin VB.PictureBox picTemp 
  198.          Appearance      =   0  'Flat
  199.          AutoRedraw      =   -1  'True
  200.          BackColor       =   &H80000005&
  201.          ForeColor       =   &H80000008&
  202.          Height          =   645
  203.          Left            =   810
  204.          MouseIcon       =   "pictext0.frx":4E7A2
  205.          ScaleHeight     =   41
  206.          ScaleMode       =   3  'Pixel
  207.          ScaleWidth      =   47
  208.          TabIndex        =   21
  209.          Top             =   1200
  210.          Visible         =   0   'False
  211.          Width           =   735
  212.       End
  213.       Begin VB.PictureBox picRegion 
  214.          Appearance      =   0  'Flat
  215.          AutoRedraw      =   -1  'True
  216.          BackColor       =   &H80000005&
  217.          ForeColor       =   &H80000008&
  218.          Height          =   615
  219.          Left            =   3750
  220.          MouseIcon       =   "pictext0.frx":4EAAC
  221.          ScaleHeight     =   39
  222.          ScaleMode       =   3  'Pixel
  223.          ScaleWidth      =   39
  224.          TabIndex        =   4
  225.          Top             =   1830
  226.          Visible         =   0   'False
  227.          Width           =   615
  228.       End
  229.       Begin VB.PictureBox picSnap 
  230.          Appearance      =   0  'Flat
  231.          AutoRedraw      =   -1  'True
  232.          BackColor       =   &H00FFFFFF&
  233.          ForeColor       =   &H80000008&
  234.          Height          =   1005
  235.          Left            =   2700
  236.          MouseIcon       =   "pictext0.frx":4EDB6
  237.          ScaleHeight     =   65
  238.          ScaleMode       =   3  'Pixel
  239.          ScaleWidth      =   65
  240.          TabIndex        =   6
  241.          Top             =   480
  242.          Visible         =   0   'False
  243.          Width           =   1005
  244.       End
  245.       Begin VB.PictureBox picUndo 
  246.          Appearance      =   0  'Flat
  247.          AutoRedraw      =   -1  'True
  248.          BackColor       =   &H00FFFFFF&
  249.          ForeColor       =   &H80000008&
  250.          Height          =   615
  251.          Left            =   660
  252.          MouseIcon       =   "pictext0.frx":4F0C0
  253.          ScaleHeight     =   39
  254.          ScaleMode       =   3  'Pixel
  255.          ScaleWidth      =   47
  256.          TabIndex        =   5
  257.          Top             =   570
  258.          Visible         =   0   'False
  259.          Width           =   735
  260.       End
  261.       Begin VB.PictureBox picMask 
  262.          Appearance      =   0  'Flat
  263.          AutoRedraw      =   -1  'True
  264.          BackColor       =   &H00FFFFFF&
  265.          ForeColor       =   &H00404040&
  266.          Height          =   615
  267.          Left            =   2790
  268.          MouseIcon       =   "pictext0.frx":4F3CA
  269.          ScaleHeight     =   39
  270.          ScaleMode       =   3  'Pixel
  271.          ScaleWidth      =   37
  272.          TabIndex        =   3
  273.          Top             =   1650
  274.          Visible         =   0   'False
  275.          Width           =   585
  276.       End
  277.    End
  278.    Begin VB.VScrollBar VScroll1 
  279.       Height          =   4275
  280.       Left            =   10410
  281.       TabIndex        =   1
  282.       TabStop         =   0   'False
  283.       Top             =   1530
  284.       Width           =   255
  285.    End
  286.    Begin VB.HScrollBar HScroll1 
  287.       Height          =   240
  288.       Left            =   1650
  289.       TabIndex        =   0
  290.       TabStop         =   0   'False
  291.       Top             =   5850
  292.       Width           =   8745
  293.    End
  294.    Begin MSComDlg.CommonDialog CommonDialog1 
  295.       Left            =   360
  296.       Top             =   5640
  297.       _ExtentX        =   847
  298.       _ExtentY        =   847
  299.       _Version        =   393216
  300.    End
  301.    Begin MSComctlLib.ImageList ImageList1 
  302.       Left            =   900
  303.       Top             =   5580
  304.       _ExtentX        =   1005
  305.       _ExtentY        =   1005
  306.       BackColor       =   -2147483643
  307.       ImageWidth      =   16
  308.       ImageHeight     =   10
  309.       MaskColor       =   12632256
  310.       _Version        =   393216
  311.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  312.          NumListImages   =   4
  313.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  314.             Picture         =   "pictext0.frx":4F6D4
  315.             Key             =   "UpperLeft"
  316.          EndProperty
  317.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  318.             Picture         =   "pictext0.frx":4F8B0
  319.             Key             =   "UpperRight"
  320.          EndProperty
  321.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  322.             Picture         =   "pictext0.frx":4FA8C
  323.             Key             =   "LowerLeft"
  324.          EndProperty
  325.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  326.             Picture         =   "pictext0.frx":4FC68
  327.             Key             =   "LowerRight"
  328.          EndProperty
  329.       EndProperty
  330.    End
  331.    Begin VB.Frame fraRotateAngle 
  332.       Height          =   2295
  333.       Left            =   30
  334.       TabIndex        =   30
  335.       Top             =   60
  336.       Width           =   1575
  337.       Begin VB.ComboBox cboRotateAngle 
  338.          Height          =   315
  339.          Left            =   480
  340.          Style           =   2  'Dropdown List
  341.          TabIndex        =   33
  342.          Top             =   1530
  343.          Width           =   735
  344.       End
  345.       Begin VB.PictureBox picRotateAngleSampleBgd 
  346.          Appearance      =   0  'Flat
  347.          AutoRedraw      =   -1  'True
  348.          BackColor       =   &H00FFFFFF&
  349.          ForeColor       =   &H80000008&
  350.          Height          =   1245
  351.          Left            =   180
  352.          ScaleHeight     =   81
  353.          ScaleMode       =   3  'Pixel
  354.          ScaleWidth      =   81
  355.          TabIndex        =   32
  356.          Top             =   150
  357.          Width           =   1245
  358.          Begin VB.PictureBox picRotateAngleSample 
  359.             Appearance      =   0  'Flat
  360.             AutoRedraw      =   -1  'True
  361.             BackColor       =   &H00C0C0C0&
  362.             BorderStyle     =   0  'None
  363.             ForeColor       =   &H80000008&
  364.             Height          =   240
  365.             Left            =   240
  366.             Picture         =   "pictext0.frx":4FE44
  367.             ScaleHeight     =   16
  368.             ScaleMode       =   3  'Pixel
  369.             ScaleWidth      =   52
  370.             TabIndex        =   35
  371.             Top             =   480
  372.             Visible         =   0   'False
  373.             Width           =   780
  374.          End
  375.       End
  376.       Begin VB.HScrollBar HsbRotateAngle 
  377.          Height          =   285
  378.          Left            =   150
  379.          Max             =   360
  380.          Min             =   -360
  381.          TabIndex        =   31
  382.          Top             =   1920
  383.          Width           =   1335
  384.       End
  385.       Begin VB.Label lblAnglePreset 
  386.          Caption         =   "At                    
  387.          BeginProperty Font 
  388.             Name            =   "Arial"
  389.             Size            =   8.25
  390.             Charset         =   0
  391.             Weight          =   400
  392.             Underline       =   0   'False
  393.             Italic          =   0   'False
  394.             Strikethrough   =   0   'False
  395.          EndProperty
  396.          Height          =   255
  397.          Left            =   210
  398.          TabIndex        =   34
  399.          Top             =   1560
  400.          Width           =   1155
  401.       End
  402.    End
  403.    Begin VB.Frame fra1Color3D 
  404.       Caption         =   "1 Color 3D"
  405.       BeginProperty Font 
  406.          Name            =   "Arial"
  407.          Size            =   8.25
  408.          Charset         =   0
  409.          Weight          =   700
  410.          Underline       =   0   'False
  411.          Italic          =   0   'False
  412.          Strikethrough   =   0   'False
  413.       EndProperty
  414.       Height          =   3165
  415.       Left            =   30
  416.       TabIndex        =   24
  417.       Top             =   2430
  418.       Width           =   1575
  419.       Begin VB.ComboBox cboShadeThickness 
  420.          Height          =   315
  421.          Left            =   780
  422.          Style           =   2  'Dropdown List
  423.          TabIndex        =   27
  424.          Top             =   420
  425.          Width           =   585
  426.       End
  427.       Begin VB.CommandButton cmdCancel 
  428.          Caption         =   "Cancel"
  429.          BeginProperty Font 
  430.             Name            =   "Arial"
  431.             Size            =   8.25
  432.             Charset         =   0
  433.             Weight          =   700
  434.             Underline       =   0   'False
  435.             Italic          =   0   'False
  436.             Strikethrough   =   0   'False
  437.          EndProperty
  438.          Height          =   495
  439.          Index           =   3
  440.          Left            =   30
  441.          Style           =   1  'Graphical
  442.          TabIndex        =   26
  443.          TabStop         =   0   'False
  444.          Top             =   2640
  445.          Width           =   1485
  446.       End
  447.       Begin VB.CommandButton cmd1Color3DProceed 
  448.          Caption         =   "Proceed"
  449.          BeginProperty Font 
  450.             Name            =   "Arial"
  451.             Size            =   8.25
  452.             Charset         =   0
  453.             Weight          =   700
  454.             Underline       =   0   'False
  455.             Italic          =   0   'False
  456.             Strikethrough   =   0   'False
  457.          EndProperty
  458.          Height          =   555
  459.          Left            =   30
  460.          Style           =   1  'Graphical
  461.          TabIndex        =   25
  462.          TabStop         =   0   'False
  463.          Top             =   2070
  464.          Width           =   1485
  465.       End
  466.       Begin MSComctlLib.ImageCombo icb1Color3D 
  467.          Height          =   330
  468.          Left            =   270
  469.          TabIndex        =   28
  470.          TabStop         =   0   'False
  471.          Top             =   1020
  472.          Width           =   1065
  473.          _ExtentX        =   1879
  474.          _ExtentY        =   582
  475.          _Version        =   393216
  476.          ForeColor       =   -2147483640
  477.          BackColor       =   -2147483643
  478.          Text            =   "icb1Color3D"
  479.       End
  480.       Begin VB.Label lblShadeThickness 
  481.          Caption         =   "Shade"
  482.          Height          =   225
  483.          Left            =   210
  484.          TabIndex        =   29
  485.          Top             =   480
  486.          Width           =   495
  487.       End
  488.    End
  489.    Begin VB.Frame fraRegion 
  490.       Height          =   5535
  491.       Left            =   90
  492.       TabIndex        =   23
  493.       Top             =   90
  494.       Width           =   1515
  495.       Begin VB.Image imgRegion 
  496.          Appearance      =   0  'Flat
  497.          BorderStyle     =   1  'Fixed Single
  498.          Height          =   390
  499.          Left            =   570
  500.          Picture         =   "pictext0.frx":5097E
  501.          ToolTipText     =   "Toggle drawing region (for Cut/Copy)"
  502.          Top             =   630
  503.          Width           =   375
  504.       End
  505.    End
  506.    Begin VB.Label lblFileSpec 
  507.       Appearance      =   0  'Flat
  508.       BackColor       =   &H80000004&
  509.       BorderStyle     =   1  'Fixed Single
  510.       Caption         =   "lblFileSpec"
  511.       ForeColor       =   &H80000008&
  512.       Height          =   285
  513.       Left            =   1650
  514.       TabIndex        =   20
  515.       Top             =   6120
  516.       Width           =   8985
  517.    End
  518.    Begin VB.Label lblImageSize 
  519.       Appearance      =   0  'Flat
  520.       BorderStyle     =   1  'Fixed Single
  521.       Caption         =   "W= H="
  522.       ForeColor       =   &H80000008&
  523.       Height          =   285
  524.       Left            =   90
  525.       TabIndex        =   19
  526.       Top             =   6120
  527.       Width           =   1425
  528.    End
  529.    Begin VB.Menu mnuFile 
  530.       Caption         =   "&File"
  531.       Begin VB.Menu mnuFileNew 
  532.          Caption         =   "&New"
  533.       End
  534.       Begin VB.Menu mnuFileOpen 
  535.          Caption         =   "&Open...."
  536.       End
  537.       Begin VB.Menu mnuFileSave 
  538.          Caption         =   "&Save...."
  539.       End
  540.       Begin VB.Menu mnuFileSep1 
  541.          Caption         =   "-"
  542.       End
  543.       Begin VB.Menu mnuFileExit 
  544.          Caption         =   "E&xit"
  545.       End
  546.    End
  547.    Begin VB.Menu mnuText 
  548.       Caption         =   "&Text"
  549.       Begin VB.Menu mnuTextWrite 
  550.          Caption         =   "&Ordinary...."
  551.          Enabled         =   0   'False
  552.          Index           =   0
  553.       End
  554.       Begin VB.Menu mnuTextWrite 
  555.          Caption         =   "&Hollow...."
  556.          Enabled         =   0   'False
  557.          Index           =   1
  558.       End
  559.       Begin VB.Menu mnuTextWrite 
  560.          Caption         =   "Framed...."
  561.          Enabled         =   0   'False
  562.          Index           =   2
  563.       End
  564.       Begin VB.Menu mnuTextWrite 
  565.          Caption         =   "&Shadowed...."
  566.          Enabled         =   0   'False
  567.          Index           =   3
  568.       End
  569.       Begin VB.Menu mnuTextWrite 
  570.          Caption         =   "&1-color 3-D...."
  571.          Index           =   4
  572.       End
  573.       Begin VB.Menu mnuTextWrite 
  574.          Caption         =   "&2-color 3-D"
  575.          Enabled         =   0   'False
  576.          Index           =   5
  577.       End
  578.       Begin VB.Menu mnuTextWrite 
  579.          Caption         =   "E&mbossed..."
  580.          Enabled         =   0   'False
  581.          Index           =   6
  582.       End
  583.       Begin VB.Menu mnuTextWrite 
  584.          Caption         =   "E&ngraved..."
  585.          Enabled         =   0   'False
  586.          Index           =   7
  587.       End
  588.       Begin VB.Menu mnuTextWrite 
  589.          Caption         =   "&Gradient text...."
  590.          Enabled         =   0   'False
  591.          Index           =   8
  592.       End
  593.    End
  594.    Begin VB.Menu mnuTools 
  595.       Caption         =   "T&ools"
  596.       Begin VB.Menu mnuToolsRegion 
  597.          Caption         =   "&Region"
  598.       End
  599.    End
  600.    Begin VB.Menu mnuEdit 
  601.       Caption         =   "&Edit"
  602.       Begin VB.Menu mnuEditUndo 
  603.          Caption         =   "&Undo"
  604.       End
  605.       Begin VB.Menu mnuEditSep1 
  606.          Caption         =   "-"
  607.       End
  608.       Begin VB.Menu mnuEditCut 
  609.          Caption         =   "Cu&t"
  610.       End
  611.       Begin VB.Menu mnuEditCopy 
  612.          Caption         =   "&Copy"
  613.       End
  614.       Begin VB.Menu mnuEditPaste 
  615.          Caption         =   "&Paste"
  616.       End
  617.       Begin VB.Menu mnuEditPasteTransparent 
  618.          Caption         =   "Paste t&ransparent (top pixel)"
  619.       End
  620.       Begin VB.Menu mnuEditSep2 
  621.          Caption         =   "-"
  622.       End
  623.       Begin VB.Menu mnuEditClearClipboard 
  624.          Caption         =   "C&lear Clipboard"
  625.       End
  626.       Begin VB.Menu mnuEditSep3 
  627.          Caption         =   "-"
  628.       End
  629.       Begin VB.Menu mnuEditPasteFromFile 
  630.          Caption         =   "Paste from &file"
  631.       End
  632.       Begin VB.Menu mnuEditPasteFromFileTransparent 
  633.          Caption         =   "Paste from file tr&ansparent (top pixel)"
  634.       End
  635.    End
  636. Attribute VB_Name = "frmPicText0"
  637. Attribute VB_GlobalNameSpace = False
  638. Attribute VB_Creatable = False
  639. Attribute VB_PredeclaredId = True
  640. Attribute VB_Exposed = False
  641. ' PicText0.prg
  642. ' By Herman Liu
  643. ' A demo on how to:
  644. '  (1) Write text onto a background image with user-selected font, size and color, and
  645. '      optionally at a rotated angle, and allow the user to drag the text to anywhere on
  646. '      the background image with due speed and ease.
  647. '  (2) Enable cut, copy and/or paste of a region of the current image, or copy the whole
  648. '      image to clipboard.
  649. '  (3) Superimpose an image on the existing one and allow the user to drag it to any
  650. '      desired position to blend in.  Through clipboard the added image may originate from
  651. '      an external program such as a clip art or an art text from Word.  Alternatively it
  652. '      may come directly from a file.  In either case, user may retrieve it as opaque or
  653. '      as transparent.
  654. '  (4) Resize the picture by dragging its edges, auto-scroll region at edge, etc.
  655. '-----------------------------------------------------------------------------------------
  656. ' Acknowledgement: Subsequent to the original posting, anti-alias is added in rotating text.
  657. ' The subroutine of anti-alias is learnt from the excellent code of Twan van Laarhoven.
  658. '-----------------------------------------------------------------------------------------
  659. ' Remarks: To avoid complicating the issue, only one or two text submenu items under the
  660. ' Text menu are made available for demo purposes; others are dimmed as some of them involve
  661. ' some other API calls.
  662. '-----------------------------------------------------------------------------------------
  663. Option Explicit
  664. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, _
  665.     ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
  666.     ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
  667. Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
  668.     ByVal y As Long, ByVal mDestWidth As Long, ByVal mDestHeight As Long, _
  669.     ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal mSrcWidth As Long, _
  670.     ByVal mSrcHeight As Long, ByVal dwRop As Long) As Long
  671. Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
  672.    ByVal y As Long) As Long
  673. Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
  674.    ByVal y As Long, ByVal crColor As Long) As Long
  675. Private Const Pi = 3.14159265359
  676. Dim CurrW As Long
  677. Dim CurrH As Long
  678. Dim Red As Integer, Green As Integer, Blue As Integer
  679. Dim HRed As String, HGreen As String, HBlue As String
  680. Dim colorHex As String
  681. Dim Xold As Single
  682. Dim Yold As Single
  683. Dim X1Reg As Single
  684. Dim X2Reg As Single
  685. Dim Y1Reg As Single
  686. Dim Y2Reg As Single
  687. Dim Xcurr As Single
  688. Dim Ycurr As Single
  689. Dim Xprev As Single
  690. Dim Yprev As Single
  691. Dim Xoffset As Single
  692. Dim Yoffset As Single
  693. Dim Xmin As Single
  694. Dim Ymin As Single
  695. Dim Xmax As Single
  696. Dim Ymax As Single
  697. Dim BrushSize As Integer
  698. Dim mFileSpec As String
  699. Dim mSuspend As Boolean
  700. Dim ImageLoaded As Boolean
  701. Dim mDirty As Boolean
  702. Dim AllowUndoFlag As Boolean
  703. Dim RegionFlag As Boolean
  704. Dim RegionMoveReadyFlag As Boolean
  705. Dim PasteOnFlag As Boolean
  706. Dim TransparentFlag As Boolean
  707. Dim ColorChangeFlag As Boolean
  708. Dim sizeHorizontal As Boolean
  709. Dim sizeVertical As Boolean
  710. Dim mResult
  711. Dim gCancel As Boolean
  712. Dim gcdg As Object
  713. Private Sub Form_Load()
  714.     mSuspend = True
  715.     picAuto.AutoSize = True
  716.     Dim i
  717.     cboFontName.Clear
  718.     For i = 0 To Screen.FontCount - 1
  719.         cboFontName.AddItem Screen.Fonts(i)
  720.     Next i
  721.     For i = 0 To Screen.FontCount
  722.         If cboFontName.List(i) = "Verdana" Then
  723.             cboFontName.ListIndex = i
  724.             Exit For
  725.         End If
  726.     Next i
  727.     Set icb1Color3D.ImageList = ImageList1
  728.     icb1Color3D.Locked = True
  729.     icb1Color3D.ComboItems.Clear
  730.     Dim CI As ComboItem
  731.     Set CI = icb1Color3D.ComboItems.Add(1, "UpperLeft", "U Left", "UpperLeft", , 0)
  732.     Set CI = icb1Color3D.ComboItems.Add(2, "UpperRight", "U Right", "UpperRight", , 0)
  733.     Set CI = icb1Color3D.ComboItems.Add(3, "LowerLeft", "L Left", "LowerLeft", , 0)
  734.     Set CI = icb1Color3D.ComboItems.Add(4, "LowerRight", "L Right", "LowerRight", , 0)
  735.     icb1Color3D.SelectedItem = icb1Color3D.ComboItems(1)
  736.     cboShadeThickness.Clear
  737.     For i = 1 To 9
  738.          cboShadeThickness.AddItem i
  739.     Next i
  740.     cboShadeThickness.ListIndex = 3
  741.     cboRotateAngle.Clear
  742.     For i = -360 To 360
  743.           cboRotateAngle.AddItem i
  744.     Next i
  745.     cboRotateAngle.ListIndex = 360
  746.      ' Display an initial sample text angle
  747.     HsbRotateAngle_Change
  748.       ' Default
  749.     Red = 0
  750.     Green = 64
  751.     Blue = 128
  752.     HRed = Format(Hex(Red), "00")
  753.     HGreen = Format(Hex(Green), "00")
  754.     HBlue = Format(Hex(Blue), "00")
  755.     colorHex = HRed & HGreen & HBlue
  756.     lblTextColor.Caption = "RGB(" & Red & ", " & Green & ", " & Blue & ")  Hex: #" & colorHex
  757.     picTextColor.BackColor = RGB(Red, Green, Blue)
  758.     Set gcdg = CommonDialog1
  759.     mSuspend = False
  760.     SizeForm
  761. End Sub
  762. Private Sub Form_Activate()
  763.     If gCancel Then
  764.          Unload Me
  765.          Exit Sub
  766.     End If
  767. End Sub
  768. ' Try to gain larger space on screen for image display
  769. Private Sub SizeForm()
  770.     Dim X, y
  771.     Dim w, h
  772.     Dim picZOldWidth, picZOldHeight
  773.     HideFrames
  774.     fraRegion.Visible = False
  775.     fraTextPanel.Visible = True
  776.     fraRotateAngle.Visible = True
  777.     fra1Color3D.Visible = True
  778.     Me.WindowState = vbMaximized
  779.     w = Screen.Width / Screen.TwipsPerPixelX
  780.     h = Screen.Height / Screen.TwipsPerPixelY
  781.     VScroll1.Left = w - VScroll1.Width - 5
  782.     VScroll1.Height = h - HScroll1.Height - 200
  783.     picZ.Width = w - picZ.Left - VScroll1.Width - 5
  784.     picZ.Height = VScroll1.Height
  785.     HScroll1.Top = picZ.Top + picZ.Height
  786.     HScroll1.Width = picZ.Width
  787.     picDisp.Move 0, 0
  788.     lblImageSize.Top = HScroll1.Top + HScroll1.Height + 10
  789.     lblFileSpec.Top = lblImageSize.Top
  790.     lblFileSpec.Width = picZ.ScaleWidth + VScroll1.Width
  791.     picSnap.Width = picDisp.Width
  792.     picSnap.Height = picDisp.Height
  793.     picSnap.Move 0, 0
  794.     picUndo.Width = picDisp.Width
  795.     picUndo.Height = picDisp.Height
  796.     lblFileSpec = "......"
  797.     CurrW = picDisp.ScaleWidth
  798.     CurrH = picDisp.ScaleHeight
  799.     setScrollMax
  800.     lblImageSize.Caption = "W=" & CStr(CurrW) & "  H=" & CStr(CurrH)
  801.     ImageLoaded = True
  802.     mDirty = False
  803.     AllowUndoFlag = False
  804.     RegionFlag = False
  805.     RegionMoveReadyFlag = False
  806.     PasteOnFlag = False
  807.     WriteSample
  808. End Sub
  809. Private Sub HideFrames()
  810.     picSnap.Visible = False
  811.     picDisp.Visible = True
  812.     fraRotateAngle.Visible = False
  813.     fra1Color3D.Visible = False
  814. End Sub
  815. Private Sub WriteSample()
  816.      If CInt(txtFontSize.Text) < 6 Or CInt(txtFontSize.Text) > 99 Then
  817.           lblTextSample.Caption = ""
  818.           Exit Sub
  819.      End If
  820.      lblTextSample.Caption = "Aa"
  821.      If picTextColor.BackColor = vbWhite Then
  822.           lblTextSample.BackColor = RGB(0, 0, 255)
  823.      Else
  824.           lblTextSample.BackColor = vbWhite
  825.      End If
  826.      lblTextSample.ForeColor = picTextColor.BackColor
  827.      lblTextSample.Font = cboFontName.Text
  828.      lblTextSample.Font.Size = CInt(txtFontSize.Text)
  829.      lblTextSample.Font.Bold = (imgBold.Appearance = 1)
  830.      lblTextSample.Font.Italic = (imgItalic.Appearance = 1)
  831. End Sub
  832. Private Sub setScrollMax()
  833.     HScroll1.Max = picDisp.ScaleWidth - picZ.ScaleWidth
  834.     VScroll1.Max = picDisp.ScaleHeight - picZ.ScaleHeight
  835.     If HScroll1.Max <= 0 Then
  836.          HScroll1.Max = 0
  837.     Else
  838.          If picZ.ScaleWidth / HScroll1.Max < 1 Then
  839.               HScroll1.SmallChange = 1
  840.          Else
  841.               HScroll1.SmallChange = picZ.ScaleWidth / HScroll1.Max
  842.          End If
  843.          HScroll1.LargeChange = HScroll1.SmallChange
  844.          If HScroll1.Max >= 40 Then
  845.               HScroll1.LargeChange = HScroll1.Max / 20
  846.               If HScroll1.LargeChange < HScroll1.SmallChange Then
  847.                    HScroll1.LargeChange = HScroll1.SmallChange
  848.               End If
  849.          End If
  850.     End If
  851.     If VScroll1.Max <= 0 Then
  852.          VScroll1.Max = 0
  853.     Else
  854.          If picZ.ScaleHeight / VScroll1.Max < 1 Then
  855.               VScroll1.SmallChange = 1
  856.          Else
  857.               VScroll1.SmallChange = picZ.ScaleHeight / VScroll1.Max
  858.          End If
  859.          VScroll1.LargeChange = VScroll1.SmallChange
  860.          If VScroll1.Max >= 40 Then
  861.               VScroll1.LargeChange = VScroll1.Max / 20
  862.               If VScroll1.LargeChange < VScroll1.SmallChange Then
  863.                    VScroll1.LargeChange = VScroll1.SmallChange
  864.               End If
  865.          End If
  866.     End If
  867. End Sub
  868. Private Sub cboFontName_Click()
  869.     Dim objFont As New StdFont
  870.     objFont.Name = cboFontName.Text
  871.     If StrComp(cboFontName.Text, objFont.Name, vbTextCompare) = 0 Then
  872.          WriteSample
  873.     Else
  874.          MsgBox cboFontName.Text & " not available in system."
  875.     End If
  876. End Sub
  877. Private Sub cmdTextColor_Click()
  878.     On Error GoTo errHandler
  879.     Dim DialogNum
  880.     imgColorPicker.Appearance = 0
  881.     gcdg.CancelError = True
  882.     gcdg.Flags = cdlCFBoth
  883.     gcdg.ShowColor
  884.     DialogNum = gcdg.Color
  885.     picTextColor.BackColor = DialogNum
  886.     DispDialogColor DialogNum
  887.     picDisp.SetFocus
  888.     Exit Sub
  889. errHandler:
  890.     picDisp.SetFocus
  891.     If Err.Number <> 32755 Then
  892.         ErrMsgProc "cmdTextColor_click"
  893.     End If
  894. End Sub
  895. Sub DispDialogColor(inDialogNum)
  896.     Blue = (inDialogNum \ &H10000) Mod &H100
  897.     Green = (inDialogNum \ &H100) Mod &H100
  898.     Red = inDialogNum Mod &H100
  899.     HRed = Format(Hex(Red), "00")
  900.     HGreen = Format(Hex(Green), "00")
  901.     HBlue = Format(Hex(Blue), "00")
  902.     colorHex = HRed & HGreen & HBlue
  903.     picTextColor.BackColor = RGB(Red, Green, Blue)
  904.     WriteSample
  905.     lblTextColor.Caption = "RGB(" & Red & ", " & Green & ", " & _
  906.             Blue & ")  Hex: #" & colorHex
  907.     picDisp.SetFocus
  908. End Sub
  909. Private Sub HScroll1_Change()
  910.     picDisp.Left = -HScroll1.Value
  911. End Sub
  912. Private Sub HScroll1_Scroll()
  913.     picDisp.Left = -HScroll1.Value
  914. End Sub
  915. Private Sub VScroll1_Change()
  916.     picDisp.Top = -VScroll1.Value
  917. End Sub
  918. Private Sub VScroll1_Scroll()
  919.     picDisp.Top = -VScroll1.Value
  920. End Sub
  921. Private Sub imgColorPicker_Click()
  922.     If ImageLoaded = False Then
  923.         Exit Sub
  924.     End If
  925.     If imgColorPicker.Appearance = 1 Then
  926.         imgColorPicker.Appearance = 0
  927.     Else
  928.         imgColorPicker.Appearance = 1
  929.     End If
  930. End Sub
  931. Private Sub imgRegion_Click()
  932.     If ImageLoaded = False Then
  933.         Exit Sub
  934.     End If
  935.     imgRegion.Appearance = Abs(imgRegion.Appearance - 1)
  936.     fraTextPanel.Visible = imgRegion.Appearance = 0
  937.     If imgRegion.Appearance = 1 Then
  938.         mnuToolsRegion.Checked = True
  939.           ' Transparency not applicable if Region
  940.         TransparentFlag = False
  941.         fraTextPanel.Visible = False
  942.     Else
  943.         mnuToolsRegion.Checked = False
  944.         fraTextPanel.Visible = True
  945.     End If
  946.     imgColorPicker.Appearance = 0
  947.     ClearFlags
  948. End Sub
  949. Private Sub mnuFile_Click()
  950.     mnuFileSave.Enabled = (ImageLoaded = True)
  951.     'mnuEilePrint.Enabled = (ImageLoaded = True)
  952. End Sub
  953. Private Sub mnuFileNew_Click()
  954.     If mDirty Then
  955.         Dim tmp
  956.         tmp = MsgBox("Save current picture?", vbYesNoCancel + vbQuestion)
  957.         If tmp = vbCancel Then
  958.             Exit Sub
  959.         ElseIf tmp = vbYes Then
  960.             mnuFileSave_Click
  961.             If gCancel Then
  962.                 Exit Sub
  963.             End If
  964.         End If
  965.     End If
  966.     picDisp.Picture = LoadPicture()
  967.     picSnap.Picture = LoadPicture()
  968.     picUndo.Picture = LoadPicture()
  969.     picRegion.Picture = LoadPicture()
  970.     picMask.Picture = LoadPicture()
  971.     lblFileSpec.Caption = ""
  972.     HScroll1.Value = 0
  973.     VScroll1.Value = 0
  974.     CurrW = picDisp.ScaleWidth
  975.     CurrH = picDisp.ScaleHeight
  976.     setScrollMax
  977.     lblImageSize.Caption = "W=" & CStr(CurrW) & "  H=" & CStr(CurrH)
  978.     imgColorPicker.Appearance = 0
  979.     ImageLoaded = True
  980.     mDirty = False
  981.     picDisp.SetFocus
  982.     Exit Sub
  983. End Sub
  984. Private Sub mnuFileOpen_Click()
  985.     On Error GoTo errHandler
  986.     If mDirty Then
  987.         Dim tmp
  988.         tmp = MsgBox("Save current picture?", vbYesNoCancel + vbQuestion)
  989.         If tmp = vbCancel Then
  990.             Exit Sub
  991.         ElseIf tmp = vbYes Then
  992.             mnuFileSave_Click
  993.             If gCancel Then
  994.                 Exit Sub
  995.             End If
  996.         End If
  997.     End If
  998.     gcdg.Filter = "(bmp, gif)|*.bmp;*.gif|(*.*)|*.*|"
  999.     gcdg.FilterIndex = 1
  1000.     gcdg.DefaultExt = "bmp"
  1001.     gcdg.Flags = cdlOFNFileMustExist
  1002.     gcdg.FileName = ""
  1003.     gcdg.CancelError = True
  1004.     gcdg.ShowOpen
  1005.     If gcdg.FileName = "" Then
  1006.           picDisp.SetFocus
  1007.           Exit Sub
  1008.     End If
  1009.     mFileSpec = gcdg.FileName
  1010.     picDisp.Picture = LoadPicture()
  1011.     picDisp.AutoSize = True
  1012.     picDisp.Picture = LoadPicture(mFileSpec)
  1013.     picDisp.AutoSize = False
  1014.     picSnap.Picture = LoadPicture()
  1015.     picSnap.Width = picDisp.Width
  1016.     picSnap.Height = picDisp.Height
  1017.     picUndo.Picture = LoadPicture()
  1018.     picUndo.Width = picDisp.Width
  1019.     picUndo.Height = picDisp.Height
  1020.     picRegion.Picture = LoadPicture()
  1021.     picMask.Picture = LoadPicture()
  1022.     lblFileSpec.Caption = mFileSpec
  1023.     HScroll1.Value = 0
  1024.     VScroll1.Value = 0
  1025.     CurrW = picDisp.ScaleWidth
  1026.     CurrH = picDisp.ScaleHeight
  1027.     setScrollMax
  1028.     lblImageSize.Caption = "W=" & CStr(CurrW) & "  H=" & CStr(CurrH)
  1029.     imgColorPicker.Appearance = 0
  1030.     ImageLoaded = True
  1031.     mDirty = False
  1032.     picDisp.SetFocus
  1033.     Exit Sub
  1034. errHandler:
  1035.     picDisp.SetFocus
  1036.     If Err <> 32755 Then
  1037.          ErrMsgProc "mnuFileOpen_Click"
  1038.     End If
  1039. End Sub
  1040. Private Sub mnuFileSave_Click()
  1041.     On Error GoTo errHandler
  1042.     gCancel = False
  1043.     picDisp.Refresh
  1044.     imgColorPicker.Appearance = 0
  1045.     HScroll1.Value = 0
  1046.     VScroll1.Value = 0
  1047.     Dim mPath As String
  1048.     mPath = CurDir
  1049.     mFileSpec = lblFileSpec.Caption
  1050.     gcdg.FileName = mFileSpec
  1051.     gcdg.Filter = "Bitmap files (*.bmp)|*.bmp|(*.*)|*.*|"
  1052.     gcdg.DefaultExt = "bmp"
  1053.     gcdg.FilterIndex = 1
  1054.     gcdg.Flags = cdlOFNOverwritePrompt
  1055.     gcdg.CancelError = True
  1056.     gcdg.ShowSave
  1057.     mFileSpec = gcdg.FileName
  1058.     SavePicture picDisp.Picture, mFileSpec
  1059.     lblFileSpec.Caption = mFileSpec
  1060.     ChDir mPath
  1061.     mDirty = False
  1062.     Exit Sub
  1063. errHandler:
  1064.     If Err <> 32755 Then
  1065.          ErrMsgProc "mnuFileSave"
  1066.     Else
  1067.          gCancel = True
  1068.     End If
  1069. End Sub
  1070. Private Sub mnuFileExit_Click()
  1071.     Unload Me
  1072. End Sub
  1073. Private Sub mnuEdit_Click()
  1074.     mnuEditUndo.Enabled = (AllowUndoFlag = True)
  1075.     mnuEditCut.Enabled = (ImageLoaded = True) And RegionMoveReadyFlag = True
  1076.     mnuEditCopy.Enabled = (ImageLoaded = True)
  1077.     mnuEditPaste.Enabled = (ImageLoaded = True) And (Clipboard.GetFormat(vbCFBitmap) Or _
  1078.         Clipboard.GetFormat(vbCFMetafile) Or Clipboard.GetFormat(vbCFDIB) Or _
  1079.         Clipboard.GetFormat(vbCFPalette))
  1080.     mnuEditPasteTransparent.Enabled = mnuEditPaste.Enabled
  1081.     mnuEditPasteFromFile.Enabled = ImageLoaded
  1082.     mnuEditPasteFromFileTransparent.Enabled = ImageLoaded
  1083. End Sub
  1084. Private Sub DoBackUp()
  1085.     picDisp.Refresh
  1086.     If picUndo.ScaleWidth <> picDisp.ScaleWidth Or _
  1087.          picUndo.ScaleHeight <> picDisp.ScaleHeight Then
  1088.         picUndo.Picture = LoadPicture()
  1089.         picUndo.Width = picDisp.Width
  1090.         picUndo.Height = picDisp.Height
  1091.     End If
  1092.     mResult = BitbltPic(picDisp, picUndo)
  1093.     AllowUndoFlag = True
  1094. End Sub
  1095. Private Sub mnuEditUndo_Click()
  1096.     RegionFlag = False
  1097.     RegionMoveReadyFlag = False
  1098.     PasteOnFlag = False
  1099.     If picUndo.ScaleWidth <> picDisp.ScaleWidth Or _
  1100.          picUndo.ScaleHeight <> picDisp.ScaleHeight Then
  1101.         picDisp.Picture = LoadPicture()
  1102.         picDisp.Width = picUndo.Width
  1103.         picDisp.Height = picUndo.Height
  1104.     End If
  1105.     mResult = BitbltPic(picUndo, picDisp)
  1106.     imgColorPicker.Appearance = 0
  1107.     HScroll1.Value = 0
  1108.     VScroll1.Value = 0
  1109.     AllowUndoFlag = False
  1110. End Sub
  1111. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  1112.     If mDirty Then
  1113.         Dim tmp
  1114.         tmp = MsgBox("Save current picture?", vbYesNoCancel + vbQuestion)
  1115.         If tmp = vbCancel Then
  1116.             Cancel = True
  1117.             Exit Sub
  1118.         ElseIf tmp = vbYes Then
  1119.             mnuFileSave_Click
  1120.             If gCancel Then
  1121.                 Cancel = True
  1122.                 Exit Sub
  1123.             End If
  1124.         End If
  1125.     End If
  1126. End Sub
  1127. Private Sub imgBold_Click()
  1128.     If imgBold.Appearance = 1 Then
  1129.         imgBold.Appearance = 0
  1130.     Else
  1131.         imgBold.Appearance = 1
  1132.     End If
  1133.     WriteSample
  1134. End Sub
  1135. Private Sub imgItalic_Click()
  1136.     If imgItalic.Appearance = 1 Then
  1137.         imgItalic.Appearance = 0
  1138.     Else
  1139.         imgItalic.Appearance = 1
  1140.     End If
  1141.     WriteSample
  1142. End Sub
  1143. Private Sub txtFontSize_KeyPress(KeyAscii As Integer)
  1144.     KeyAscii = FilterNumericKey(KeyAscii)
  1145. End Sub
  1146. Private Sub txtFontSize_change()
  1147.     If Trim(txtFontSize.Text) = "" Or Val(txtFontSize.Text) <= 0 Then
  1148.          txtFontSize.Text = 6
  1149.     End If
  1150.     imgColorPicker.Appearance = 0
  1151.     WriteSample
  1152. End Sub
  1153. Private Function PreVet() As Boolean
  1154.     If ImageLoaded = False Then
  1155.         MsgBox "No image loaded yet"
  1156.         PreVet = False
  1157.         Exit Function
  1158.     End If
  1159.     If Len(Trim(txbWriteText.Text)) = 0 Then
  1160.         MsgBox "No text entered yet"
  1161.         PreVet = False
  1162.         Exit Function
  1163.     End If
  1164.     If CInt(txtFontSize.Text) < 6 Or CInt(txtFontSize.Text) > 99 Then
  1165.         MsgBox "Limit font size to between 6 and 99"
  1166.         PreVet = False
  1167.         Exit Function
  1168.     End If
  1169.     PreVet = True
  1170. End Function
  1171. Private Function BitbltPic(SrcPic As Control, DestPic As Control) As Boolean
  1172.     On Error GoTo errHandler
  1173.     Dim SrcX As Long
  1174.     Dim SrcY As Long
  1175.     BitbltPic = True
  1176.     SrcX = SrcPic.ScaleWidth
  1177.     SrcY = SrcPic.ScaleHeight
  1178.     DestPic.Picture = LoadPicture()
  1179.     mResult = BitBlt(DestPic.hdc, 0, 0, SrcX, SrcY, SrcPic.hdc, 0, 0, vbSrcCopy)
  1180.     DestPic.Picture = DestPic.Image
  1181.     If mResult = 0 Then
  1182.         GoTo errHandler
  1183.     End If
  1184.     Exit Function
  1185. errHandler:
  1186.     BitbltPic = False
  1187.     ErrMsgProc "BitbltPic"
  1188. End Function
  1189. Private Sub cmdCancel_Click(Index As Integer)
  1190.     HideFrames
  1191.     fraTextPanel.Visible = True
  1192.     fraRegion.Visible = True
  1193. End Sub
  1194. Private Sub mnuTools_Click()
  1195.     mnuToolsRegion.Enabled = ImageLoaded
  1196. End Sub
  1197. Private Sub mnuToolsRegion_Click()
  1198.     mnuToolsRegion.Checked = Not mnuToolsRegion.Checked
  1199.     fraRotateAngle.Visible = False
  1200.     fra1Color3D.Visible = False
  1201.     fraRegion.Visible = True
  1202.     If mnuToolsRegion.Checked Then
  1203.         imgRegion.Appearance = 1
  1204.     Else
  1205.         imgRegion.Appearance = 0
  1206.     End If
  1207.     fraTextPanel.Visible = fraRegion.Visible And imgRegion.Appearance = 0
  1208. End Sub
  1209. Private Sub mnuText_Click()
  1210.     imgColorPicker.Appearance = 0
  1211.     imgRegion.Appearance = 0
  1212.     fraTextPanel.Visible = True
  1213.     'Dim i
  1214.     'For i = 0 To 7
  1215.     '     mnuTextWrite(i).Enabled = ImageLoaded and Not (fraTextWrite(i).Visible)
  1216.     'Next i
  1217.     mnuTextWrite(4).Enabled = ImageLoaded And Not (fra1Color3D.Visible)
  1218. End Sub
  1219. Private Sub mnuTextWrite_Click(Index As Integer)
  1220.     ClearFlags
  1221.     picDisp.Cls
  1222.     HideFrames
  1223.     fraRotateAngle.Visible = True
  1224.     fraRegion.Visible = False
  1225.     If Index = 4 Then
  1226.         fra1Color3D.Visible = True
  1227.     End If
  1228.     Exit Sub
  1229. End Sub
  1230. Private Sub cmd1color3dProceed_click()
  1231.     If Not PreVet Then
  1232.          Exit Sub
  1233.     End If
  1234.     On Error Resume Next
  1235.     Screen.MousePointer = vbHourglass
  1236.     imgColorPicker.Appearance = 0
  1237.     HScroll1.Value = 0
  1238.     VScroll1.Value = 0
  1239.     Dim mDirection As Integer
  1240.     Dim i As Integer, j As Integer
  1241.     Dim tmp As String
  1242.     Dim colorRGB
  1243.     Dim r As Integer, g As Integer, b As Integer
  1244.     Dim X, y, X2, Y2
  1245.     Dim transp As Long
  1246.     Dim isAntiAlias As Boolean
  1247.     Dim posX As Long, posY As Long
  1248.     Dim w, h
  1249.     picTemp.Picture = LoadPicture()
  1250.     picRegion.Picture = LoadPicture()
  1251.     picMask.Picture = LoadPicture()
  1252.     DoBackUp
  1253.     BitbltPic picDisp, picSnap
  1254.     SetupFont picTemp
  1255.       ' Size picTemp to fit text
  1256.     picTemp.Width = picTemp.TextWidth(txbWriteText.Text) + 10
  1257.     picTemp.Height = picTemp.TextHeight(txbWriteText.Text) + 10
  1258.     If picTemp.Width >= picDisp.Width Then picTemp.Width = picDisp.Width
  1259.     If picTemp.Height >= picDisp.Height Then picTemp.Height = picDisp.Height
  1260.     tmp = Right(lblTextColor.Caption, 6)
  1261.     HRed = Left(tmp, 2)
  1262.     HGreen = Mid(tmp, 3, 2)
  1263.     HBlue = Right(tmp, 2)
  1264.     r = CInt("&H" & HRed)
  1265.     g = CInt("&H" & HGreen)
  1266.     b = CInt("&H" & HBlue)
  1267.     colorRGB = RGB(r, g, b)
  1268.     picSnap.ScaleMode = vbTwips
  1269.     picTemp.ScaleMode = vbTwips
  1270.     j = CInt(cboShadeThickness.Text) * Screen.TwipsPerPixelX
  1271.     If r > 255 - j Then r = 255 - j
  1272.     If g > 255 - j Then g = 255 - j
  1273.     If b > 255 - j Then b = 255 - j
  1274.     Select Case icb1Color3D.SelectedItem.Index              ' 1-based
  1275.         Case 1
  1276.             X = 2: y = 2           ' Just a little bit away from 0.  x & y are to increase
  1277.             mDirection = 1
  1278.         Case 2
  1279.             X = 2 + j: y = 2
  1280.             mDirection = 2
  1281.         Case 3
  1282.             X = 2 + j: y = 2 + j
  1283.             mDirection = 3
  1284.         Case 4
  1285.             X = 2: y = 2 + j
  1286.             mDirection = 4
  1287.     End Select
  1288.        ' Start to print
  1289.     For i = 0 To j
  1290.         If mDirection = 1 Then
  1291.              PrintAtPosFilterWhite picTemp, X + i, y + i, colorRGB, txbWriteText
  1292.         ElseIf mDirection = 2 Then
  1293.              PrintAtPosFilterWhite picTemp, X - i, y + i, colorRGB, txbWriteText
  1294.         ElseIf mDirection = 3 Then
  1295.              PrintAtPosFilterWhite picTemp, X - i, y - i, colorRGB, txbWriteText
  1296.         ElseIf mDirection = 4 Then
  1297.              PrintAtPosFilterWhite picTemp, X + i, y - i, colorRGB, txbWriteText
  1298.         End If
  1299.         colorRGB = RGB(r + i, g + i, b + i)
  1300.     Next i
  1301.     tmp = Right(lblTextColor.Caption, 6)
  1302.       ' Restore back to vbPixels
  1303.     picSnap.ScaleMode = vbPixels
  1304.     picTemp.ScaleMode = vbPixels
  1305.       ' Obtain the region size capable to accommodate a rotated text at any angle
  1306.     X = SizeToRotateRegion(picTemp)
  1307.       ' Size picRegion accordingly
  1308.     picRegion.Width = picRegion.Width - picRegion.ScaleWidth + X
  1309.     picRegion.Height = picRegion.Height - picRegion.ScaleHeight + X
  1310.       ' Rotate text onto picRegion
  1311.     transp = CLng(picRegion.Point(0, 0))
  1312.     isAntiAlias = False
  1313.     posX = picRegion.ScaleWidth / 2
  1314.     posY = picRegion.ScaleHeight / 2
  1315.     picRegion.Cls
  1316.     RotatePic picTemp, picRegion, HsbRotateAngle.Value, True, transp, isAntiAlias, posX, posY
  1317.         
  1318.     picRegion.Refresh
  1319.       ' Prepare a mask if this approach is adopted
  1320.     picMask.Width = picRegion.Width
  1321.     picMask.Height = picRegion.Height
  1322.     BitbltPic picRegion, picMask
  1323.     CreateMask picMask, vbBlack
  1324.     SetPrevAndCurrValues 0, 0
  1325.     SetLeeWay picRegion, picDisp, 80
  1326.       ' Impute flags
  1327.     PasteOnFlag = True
  1328.     TransparentFlag = True
  1329.     RegionMoveReadyFlag = True
  1330.     imgRegion.Appearance = 1
  1331.     fraTextPanel.Visible = False        ' Since imgRegion.Appearance is set to 1
  1332.     X1Reg = 0
  1333.     X2Reg = 0
  1334.     X2Reg = picRegion.ScaleWidth - 1
  1335.     Y2Reg = picRegion.ScaleHeight - 1
  1336.     UpdateRegionDragging
  1337.     fra1Color3D.Visible = False
  1338.     fraRegion.Visible = True
  1339.     mDirty = True
  1340.     HideFrames
  1341.     picDisp.SetFocus
  1342.     Screen.MousePointer = vbDefault
  1343. End Sub
  1344. Private Sub SetupFont(inPic As Object)
  1345.     inPic.Font.Name = cboFontName.Text
  1346.     inPic.Font.Size = CInt(txtFontSize.Text)
  1347.     inPic.ForeColor = picTextColor.BackColor
  1348.     If imgBold.Appearance = 1 Then
  1349.          inPic.Font.Bold = True
  1350.     Else
  1351.          inPic.Font.Bold = False
  1352.     End If
  1353.     If imgItalic.Appearance = 1 Then
  1354.          inPic.Font.Italic = True
  1355.     Else
  1356.          inPic.Font.Italic = False
  1357.     End If
  1358. End Sub
  1359. Private Sub PrintAtPosFilterWhite(ByVal inPic As PictureBox, ByVal X As Single, _
  1360.          ByVal y As Single, ByVal inColor As Long, ByVal inText As String)
  1361.       ' Note here we don't use real whole white &HFFFFFF, but a very near one &HFFEEFF,
  1362.       ' so that it is visible (1) when printered on picRegionX (against its white
  1363.       ' background) and (2) when picRegion is combined with picMask later.
  1364.     Dim tmpColor As Long
  1365.     If inColor > &HFFEEFF Then
  1366.          tmpColor = &HFFEEFF
  1367.     Else
  1368.          tmpColor = inColor
  1369.     End If
  1370.     inPic.CurrentX = X
  1371.     inPic.CurrentY = y
  1372.     inPic.ForeColor = tmpColor
  1373.     inPic.Print inText
  1374. End Sub
  1375. Private Sub icb1Color3D_Click()
  1376.     picDisp.SetFocus
  1377.     imgColorPicker.Appearance = 0
  1378. End Sub
  1379. Private Sub picDisp_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
  1380.     If Button <> vbLeftButton Then
  1381.          Exit Sub
  1382.     End If
  1383.     If picDisp.MousePointer = vbSizeWE Then
  1384.          Xold = X
  1385.          sizeHorizontal = True
  1386.          sizeVertical = False
  1387.          Exit Sub
  1388.     ElseIf picDisp.MousePointer = vbSizeNS Then
  1389.          Yold = y
  1390.          sizeVertical = True
  1391.          sizeHorizontal = False
  1392.          Exit Sub
  1393.     End If
  1394.          
  1395.     Dim w, h
  1396.     If imgColorPicker.Appearance = 1 Then
  1397.            ' Let MouseUp handle it
  1398.          Exit Sub
  1399.     ElseIf imgRegion.Appearance = 1 Then
  1400.          RegionFlag = True
  1401.          If RegionMoveReadyFlag = False Then
  1402.               picDisp.Cls
  1403.               X1Reg = X: X2Reg = X: Y1Reg = y: Y2Reg = y
  1404.               
  1405.               DrawRegionLines
  1406.          Else
  1407.                  ' If the MouseDown point is not within existing region, then
  1408.                  ' not to flag RegionMovaReadyFlag, if one exists, cancel it.
  1409.               If Not ((X >= X1Reg And X <= X2Reg) And (y >= Y1Reg And y <= Y2Reg)) Then
  1410.                   picDisp.Cls                           ' Clear dotted lines
  1411.                   DoBackUp
  1412.                   ClearFlags
  1413.                   Exit Sub
  1414.               End If
  1415.               
  1416.               '----------------------------------------------------------------------
  1417.               ' Notes values of Xprev, Yprev, Xcurr, Ycurr, Xoffset and Yoffset
  1418.               ' are initiated in PrepareRegionDragging (or Paste ...), and Xprev and
  1419.               ' Yprev are updated in UpdateRegionDragging
  1420.               '----------------------------------------------------------------------
  1421.               Xoffset = Xcurr - X
  1422.               Yoffset = Ycurr - y
  1423.          End If
  1424.     End If
  1425. End Sub
  1426. Private Sub picDisp_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
  1427.     SetMousePointer X, y
  1428.     Dim w, h
  1429.     If sizeHorizontal Or sizeVertical Then
  1430.           If sizeHorizontal Then
  1431.               picDisp.Width = picDisp.Width + (X - Xold)
  1432.               Xold = X
  1433.               mDirty = True
  1434.               CurrW = picDisp.ScaleWidth
  1435.               lblImageSize.Caption = "W=" & CStr(CurrW) & "  H=" & CStr(CurrH)
  1436.               DoEvents
  1437.           Else
  1438.               picDisp.Height = picDisp.Height + (y - Yold)
  1439.               Yold = y
  1440.               mDirty = True
  1441.               CurrH = picDisp.ScaleHeight
  1442.               lblImageSize.Caption = "W=" & CStr(CurrW) & "  H=" & CStr(CurrH)
  1443.               DoEvents
  1444.           End If
  1445.     ElseIf imgRegion.Appearance = 1 Then
  1446.          If RegionFlag = False Then
  1447.               Exit Sub
  1448.          End If
  1449.          
  1450.          If Not RegionMoveReadyFlag Then         ' Then draw a new rectangle
  1451.               DrawRegionLines
  1452.               X2Reg = X: Y2Reg = y
  1453.               DrawRegionLines
  1454.               
  1455.                ' AutoScrollAtEdge is to enable a continuous draw of region lines when
  1456.                ' the region area extends beyond the viewport.
  1457.                ' For region drawing, have to test x and y here rather than entirely rely
  1458.                ' on AutoScrollAtEdge so that the mouse pointer can be retreated a little
  1459.                ' from the edge without triggering AutoScrollAtEdge (thus avoiding the
  1460.                ' unsolvable loop when, e.g., region is about the same height as picZ)
  1461.               If X >= (picZ.ScaleWidth + HScroll1) Or y >= (picZ.ScaleHeight + VScroll1) Or _
  1462.                      X <= HScroll1 Or y <= VScroll1 Then
  1463.                    If AutoScrollAtEdge Then
  1464.                         picDisp.Refresh
  1465.                    End If
  1466.               End If
  1467.          Else
  1468.               Xcurr = X + Xoffset
  1469.               Ycurr = y + Yoffset
  1470.               If Xcurr < Xmin Then Xcurr = Xmin
  1471.               If Xcurr > Xmax Then Xcurr = Xmax
  1472.               If Ycurr < Xmin Then Ycurr = Xmin
  1473.               If Ycurr > Ymax Then Ycurr = Ymax
  1474.          
  1475.               X1Reg = Xcurr
  1476.               X2Reg = X1Reg + picRegion.ScaleWidth
  1477.               Y1Reg = Ycurr
  1478.               Y2Reg = Y1Reg + picRegion.ScaleHeight
  1479.                        
  1480.               UpdateRegionDragging
  1481.          End If
  1482.     End If
  1483. End Sub
  1484. Private Sub picDisp_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
  1485.     On Error Resume Next
  1486.     If ImageLoaded = False Then
  1487.          Exit Sub
  1488.     End If
  1489.     RegionFlag = False
  1490.     mDirty = True
  1491.     If sizeHorizontal Or sizeVertical Then
  1492.          sizeHorizontal = False
  1493.          sizeVertical = False
  1494.          imgColorPicker.Appearance = 0
  1495.          picSnap.Picture = LoadPicture()
  1496.          picSnap.Width = picDisp.Width
  1497.          picSnap.Height = picDisp.Height
  1498.          picUndo.Picture = LoadPicture()
  1499.          picUndo.Width = picDisp.Width
  1500.          picUndo.Height = picDisp.Height
  1501.          BitbltPic picDisp, picSnap
  1502.          picDisp.Picture = LoadPicture()
  1503.          BitbltPic picSnap, picDisp
  1504.          picSnap.Picture = LoadPicture()
  1505.          setScrollMax
  1506.          mnuEditUndo.Enabled = False
  1507.     ElseIf imgColorPicker.Appearance = 1 Then
  1508.          imgColorPicker.Appearance = 0
  1509.          picDisp.Cls
  1510.          picDisp.Picture = picDisp.Image
  1511.          picTextColor.BackColor = picDisp.Point(X, y)
  1512.          DispDialogColor picDisp.Point(X, y)
  1513.          WriteSample
  1514.          picDisp.SetFocus
  1515.     ElseIf imgRegion.Appearance = 1 Then
  1516.          RegionFlag = False
  1517.          
  1518.             ' The region should at least be one pixel size
  1519.          If (Abs(X2Reg - X1Reg > 1) And Abs(Y2Reg - Y1Reg > 1)) Then
  1520.               If RegionMoveReadyFlag = False Then
  1521.                    RegionMoveReadyFlag = True
  1522.                    ValidateForSwapXY
  1523.                    TransparentFlag = False
  1524.                    PrepareRegionDragging
  1525.                'Else  Continue to keep it True.  We already have done
  1526.                  ' PrepareRegionDragging previously; we just wait for
  1527.                  ' user to further drag or do something else.
  1528.               End If
  1529.          Else
  1530.               picDisp.DrawMode = vbCopyPen
  1531.               picDisp.DrawStyle = vbSolid
  1532.          End If
  1533.     End If
  1534. End Sub
  1535. Private Function AutoScrollAtEdge() As Boolean
  1536.     Dim m
  1537.     Dim b1 As Boolean, b2 As Boolean
  1538.     m = 10
  1539.     b1 = False: b2 = False
  1540.     If X2Reg > (picZ.ScaleWidth + HScroll1 - m) Then
  1541.         If (HScroll1.Value + HScroll1.LargeChange) < HScroll1.Max Then
  1542.              HScroll1.Value = HScroll1.Value + HScroll1.LargeChange
  1543.         Else
  1544.              HScroll1.Value = HScroll1.Max
  1545.         End If
  1546.         b1 = True
  1547.     End If
  1548.       ' Have to first test if b1 is False, otherwise with a region approx the size of
  1549.       ' picZ is extended to wider then picZ, a conflicting situation would arise, i.e.
  1550.       ' both "X2Reg >..." and "X1Reg <..." become True.
  1551.     If b1 = False Then
  1552.         If X1Reg < (HScroll1 + m) Then
  1553.             If (HScroll1.Value - HScroll1.LargeChange) > HScroll1.Min Then
  1554.                  HScroll1.Value = HScroll1.Value - HScroll1.LargeChange
  1555.             Else
  1556.                  HScroll1.Value = HScroll1.Min
  1557.             End If
  1558.             b1 = True
  1559.         End If
  1560.     End If
  1561.     If Y2Reg > (picZ.ScaleHeight + VScroll1 - m) Then
  1562.         If (VScroll1.Value + VScroll1.LargeChange) < VScroll1.Max Then
  1563.              VScroll1.Value = VScroll1.Value + VScroll1.LargeChange
  1564.         Else
  1565.              VScroll1.Value = VScroll1.Max
  1566.         End If
  1567.         b2 = True
  1568.     End If
  1569.     If b2 = False Then
  1570.         If Y1Reg < (VScroll1 + m) Then
  1571.             If (VScroll1.Value - VScroll1.LargeChange) > VScroll1.Min Then
  1572.                  VScroll1.Value = VScroll1.Value - VScroll1.LargeChange
  1573.             Else
  1574.                  VScroll1.Value = VScroll1.Min
  1575.             End If
  1576.             b2 = True
  1577.         End If
  1578.     End If
  1579.     AutoScrollAtEdge = b1 Or b2
  1580. End Function
  1581. Private Sub picSnap_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
  1582.     If ImageLoaded = False Then
  1583.          Exit Sub
  1584.     End If
  1585.     Screen.MousePointer = vbHourglass
  1586.     DoBackUp
  1587.          
  1588.     Dim mSpotColor As Long
  1589.     Dim w, h
  1590.     Dim i, j
  1591.     Dim c As Long
  1592.     w = picSnap.ScaleWidth
  1593.     h = picSnap.ScaleHeight
  1594.          
  1595.        ' picSnap is ready for use here since menu clicked
  1596.     mSpotColor = picSnap.Point(X, y)
  1597.     Screen.MousePointer = vbDefault
  1598. End Sub
  1599. Private Sub ValidateXY()
  1600.     Dim tmp As Single
  1601.     If X1Reg > X2Reg Then
  1602.         tmp = X1Reg
  1603.         X1Reg = X2Reg
  1604.         X2Reg = tmp
  1605.     End If
  1606.     If Y1Reg > Y2Reg Then
  1607.         tmp = Y1Reg
  1608.         Y1Reg = Y2Reg
  1609.         Y2Reg = tmp
  1610.     End If
  1611. End Sub
  1612. Private Sub SetMousePointer(inX, inY)
  1613.     If imgRegion.Appearance = 1 Then
  1614.         If RegionMoveReadyFlag Then
  1615.              If (inX > X1Reg And inX < X2Reg) And (inY > Y1Reg And inY < Y2Reg) Then
  1616.                   picDisp.MousePointer = vbSizeAll
  1617.              Else
  1618.                   picDisp.MousePointer = vbCrosshair
  1619.              End If
  1620.         Else
  1621.              If inX >= picDisp.ScaleWidth - 2 Then
  1622.                   picDisp.MousePointer = vbSizeWE
  1623.              ElseIf inY >= picDisp.ScaleHeight - 2 Then
  1624.                   picDisp.MousePointer = vbSizeNS
  1625.              Else
  1626.                   picDisp.MousePointer = vbCrosshair
  1627.              End If
  1628.         End If
  1629.     Else
  1630.         If inX >= picDisp.ScaleWidth - 2 Then
  1631.              picDisp.MousePointer = vbSizeWE
  1632.         ElseIf inY >= picDisp.ScaleHeight - 2 Then
  1633.              picDisp.MousePointer = vbSizeNS
  1634.         Else
  1635.              picDisp.MousePointer = vbDefault
  1636.         End If
  1637.     End If
  1638. End Sub
  1639. Sub SetLeeWay(inPic1 As Object, inPic2 As Object, inPercent As Integer)
  1640.     Xmin = (inPic1.ScaleWidth / 100 * inPercent) * -1
  1641.     Ymin = (inPic1.ScaleHeight / 100 * inPercent) * -1
  1642.     Xmax = inPic2.ScaleWidth - inPic1.ScaleWidth - Xmin
  1643.     Ymax = inPic2.ScaleHeight - inPic1.ScaleHeight - Ymin
  1644. End Sub
  1645. Sub SetPrevAndCurrValues(ByVal inX As Single, ByVal inY As Single)
  1646.     Xprev = inX
  1647.     Yprev = inY
  1648.     Xcurr = Xprev
  1649.     Ycurr = Yprev
  1650.     Xoffset = 0
  1651.     Yoffset = 0
  1652. End Sub
  1653. Private Sub DrawRegionLines()
  1654.     picDisp.DrawMode = vbInvert
  1655.     picDisp.DrawStyle = vbDot
  1656.     picDisp.Line (X1Reg, Y1Reg)-(X2Reg, Y2Reg), , B
  1657.     picDisp.DrawMode = vbCopyPen
  1658.     picDisp.DrawStyle = vbSolid
  1659. End Sub
  1660. Sub WhiteNonPaintArea(inPic As PictureBox, inColor As Long)
  1661.     On Error Resume Next
  1662.     Dim picHdc As Long
  1663.     Dim w As Long, h As Long
  1664.     Dim i, j
  1665.     w = inPic.ScaleWidth
  1666.     h = inPic.ScaleHeight
  1667.     picHdc = inPic.hdc
  1668.     For i = 0 To w + 1
  1669.         For j = 0 To h + 1
  1670.             If GetPixel(picHdc, i, j) = inColor Then
  1671.                   SetPixel picHdc, i, j, &HFFFFFF
  1672.             End If
  1673.         Next j
  1674.         DoEvents
  1675.     Next i
  1676. End Sub
  1677. Sub CreateMask(inPic As PictureBox, inColor As Long)
  1678.     On Error Resume Next
  1679.     Dim picHdc As Long
  1680.     Dim w As Long, h As Long
  1681.     Dim i, j
  1682.     w = inPic.ScaleWidth
  1683.     h = inPic.ScaleHeight
  1684.     picHdc = inPic.hdc
  1685.     For i = 0 To w + 1
  1686.         For j = 0 To h + 1
  1687.             If GetPixel(picHdc, i, j) <> &HFFFFFF Then
  1688.                  SetPixel picHdc, i, j, inColor
  1689.             End If
  1690.         Next j
  1691.         DoEvents
  1692.     Next i
  1693. End Sub
  1694. Private Sub mnuEditCut_Click()
  1695.     On Error Resume Next
  1696.     If ImageLoaded = False Then
  1697.          MsgBox "No picture loaded yet"
  1698.          Exit Sub
  1699.     End If
  1700.     If X2Reg = 0 Or Y2Reg = 0 Then
  1701.          MsgBox "No picture region yet"
  1702.          Exit Sub
  1703.     End If
  1704.     If RegionMoveReadyFlag Then
  1705.          picDisp.Cls
  1706.     End If
  1707.     DoBackUp
  1708.     mnuEditCopy_Click
  1709.         
  1710.     ' Create a hole
  1711.     picDisp.Line (X1Reg, Y1Reg)-(X2Reg - 1, Y2Reg - 1), picDisp.BackColor, BF
  1712.     picDisp.Picture = picDisp.Image
  1713.     ClearFlags
  1714.     mDirty = True
  1715. End Sub
  1716. Private Sub mnuEditCopy_Click()
  1717.    On Error Resume Next
  1718.    If ImageLoaded = False Then
  1719.        MsgBox "No picture loaded yet"
  1720.        Exit Sub
  1721.    End If
  1722.    picDisp.Cls
  1723.    Dim X, y, w, h, w2, h2
  1724.    If RegionMoveReadyFlag Then
  1725.        X = X1Reg
  1726.        y = Y1Reg
  1727.        w = X2Reg - X1Reg + 1
  1728.        h = Y2Reg - Y1Reg + 1
  1729.        picAuto.AutoSize = False
  1730.        picAuto.Picture = LoadPicture()
  1731.        picAuto.Width = picAuto.Width - picAuto.ScaleWidth + w
  1732.        picAuto.Height = picAuto.Height - picAuto.ScaleHeight + h
  1733.        picDisp.Cls
  1734.        mResult = BitBlt(picAuto.hdc, 0, 0, w, h, picDisp.hdc, X, y, vbSrcCopy)
  1735.        Clipboard.SetData picAuto.Image, vbCFBitmap
  1736.        picAuto.AutoSize = True
  1737.        DrawRegionLines
  1738.    Else
  1739.        Clipboard.SetData picDisp.Picture, vbCFBitmap
  1740.    End If
  1741. End Sub
  1742. Private Sub mnuEditPaste_Click()
  1743.    TransparentFlag = False
  1744.    PasteProc
  1745. End Sub
  1746. Private Sub mnuEditPasteTransparent_Click()
  1747.    TransparentFlag = True
  1748.    PasteProc
  1749. End Sub
  1750. Private Sub PasteProc()
  1751.     If Not (Clipboard.GetFormat(vbCFBitmap) Or _
  1752.         Clipboard.GetFormat(vbCFMetafile) Or _
  1753.         Clipboard.GetFormat(vbCFDIB) Or _
  1754.         Clipboard.GetFormat(vbCFPalette)) Then
  1755.          MsgBox "No picture in clipboard yet"
  1756.          Exit Sub
  1757.     End If
  1758.        ' There mar.Sub
  1759. y End If
  1760.    P PasteProc()
  1761. s Picon AsasteOnFlag = Fa       Dh > X2Reg Then
  1762.    cZ)
  1763.     eg .Yight + hata pic Picon A    Yight + hatFor j = 0 T
  1764.     If pieg > Y2Reg Then
  1765.  > X2Reg Then
  1766. eg > Y2Reg Then
  1767.  > X2eighExit Sub
  1768.     EndDisp.Width + (X - Xold)
  1769.               Xold = X
  1770.               mDirty = True
  1771.    1ld = X
  1772. idthmyl1.LargeChang)
  1773. cDi    SetPixel p= p, ByVal inY As Sing            Xold mar.to.m
  1774.     eg .Yight + hhen
  1775.  > X2Reg Then
  1776.  > X2eighExit Sub
  1777.     EndDisp.Width + irentFlag = TA  For i = 0 To w + 1 i = 0 To w arent_Click()
  1778.  To w arent_Click()
  1779.  ax = inPic2.Scale_Click()
  1780.  ax = inHmDirTo w arent_Clicp.Width + irent
  1781.     nHmDirTo  ir b2 = False
  1782.     If X+ hat X
  1783. idthmyl eg .Yight +  
  1784. End SubMectiidth
  1785.         pTo  ir myl eg .Yight +  
  1786. End SubMectiidtHourglass
  1787.  ubMectiidtHourglass
  1788.  ubMecti    pTo o mnuEhen
  1789.  tbltit
  1790.          Exit <Box "No pi    EndDisp.Width nuEhen
  1791.  tshal ipicAuto.Scauld at least be one pix
  1792.  tshal ipi       yet"
  1793.  ,ght + hClipXSub
  1794.  nuEhen
  1795.  tll1 - m) Then
  1796. g .icale_Cto 1
  1797. picTemp.TrgeChang)
  1798.         N  If Imagelick()
  1799.  tll1 - m) Then
  1800. g .icale_Cto 1
  1801. picTemp.TrWhite elick()
  1802.  tll1 - m) Tdhite elick()t
  1803.   3idth
  1804.          picU + 1
  1805.        h = Y2Reg y    En  h = Y2Reg y    En  h = Y2Reg y    En  h = Y2Reg y    En  h = Y2Reg 
  1806. Private Sub cmd1color3dProceeeeeeeeeeeeeeeeeeeeeee1
  1807.             xtWrite_Clicttm"Snap
  1808.     F   en
  1809. g .icale    F   en
  1810. g .ical1) w)
  1811.     HBlue = Format(Hex(Blue), "00")
  1812.     isAntiAlias = c As Control) As Boolean
  1813.     On Error GoTo errHandler
  1814. Reg = Xcure = yan
  1815.           If RegionMoveReadyFlag = False Then
  1816.                    RegionMoveReadyFlag = True
  1817.                    VaaleWid X2eighExit                 VaaleWid XXh Thenisp.MousePoi                   VaaleWid XYicon AsasteOnFlag = 
  1818.   vbSrcCopy)
  1819.        Clip                VaaleWidpicDispnFlag = 
  1820.   vbSrcCopy)
  1821.        Clip                VaaleWidpicDispnFlag = 
  1822.   vbSrcCopy)
  1823.        Clip                VaaleWidpicDispnFlag = 
  1824.   vbSrcCoppicDispnFlag = en
  1825.          
  1826.        h so     mDirty = ale_C   
  1827.        h so     mDirtyh  hhMpicDisp_MousAs Single, ByVal inY As Single)
  1828.     XprTemp.TrWhite elick()
  1829.  eadyFlag = e, By .Y            ' 1-based
  1830.         Case 1
  1831.             X = 2: y = 2           ' Just a little bit away from 0.  x & y are to increase
  1832.             mDirection = 1
  1833.         Case 2
  1834.             X = 2 + j: y = 2
  1835.             mDirection = 2
  1836.         Case 3
  1837.          e 3
  1838.          e 3
  1839.          e 3
  1840.              au 3
  1841.          e 3
  1842.  Reg, Y2Reg), , B
  1843.     picDispPictureBoi
  1844.    -------'s e 3
  1845.     nHboard.GGGG
  1846.          picU + 1
  1847.     rard.GGGG
  1848. icU +s
  1849. y End board.GGGG
  1850.          picU  
  1851. y End Ded = False To    
  1852. icU bSizeAll
  1853.              Else
  1854.                   picDisp.MousePointer = vbCrosshair
  1855.              End If
  1856.         Else
  1857. End SubMectiidtHusePointer = vbCTSubMsePo        ter =
  1858.  tbue = Format(Hex(Blue), "b0Tem's e 3
  1859. r = FF Xof,Single, ByV)     FF Xe = 0
  1860.      MsePo      = Xight + hae
  1861.        
  1862. Privatsoll1.Value -     ter =
  1863.  tnd Ded = F   Vaa, B
  1864.     picDispvbCrItalic.AppeDis
  1865. Private = F   Vaa, Pointer = vbCTSubMsePo        ter =
  1866.  tbue = F    cDis-------'s e en
  1867.   = -HScroll1.Value
  1868. End Sub
  1869. Private Sub HSceeeeeeeeeeeee1
  1870.     d yet"
  1871.          Ex  Else
  1872.  izeAll
  1873. Privai       
  1874. Privai    aSl1.Value se
  1875.  izeAlPtlue se
  1876.  izeAlPtlue se
  1877.  izeAlPtlue se
  1878.  izeAlPtlue se
  1879.  izeAlPtlue se
  1880.  izeAlPtlue se
  1881.  izeAlPtlue se
  1882.  izeAlPtlue se
  1883.  izeAlPtlue se
  1884.  izeAlPtlue se
  1885.  izeAlPtlue se
  1886.  izeAlPtlue se
  1887.  izeAlPtlue se
  1888.  izeAlP
  1889.   = -HScroll1.Value
  1890. End Sub
  1891. Private Sub HSceeeeeeeeeeevbDefault
  1892. xe = 1       
  1893. Pndth nuEhen
  1894. nut  Ex  Elslalues(ByVal in(ByVal in(ByVal in(a izeAlbOn lbOn lb = 1       e se
  1895.  izeAlPtl/=
  1896. nut  Ex  Elslalues(ByVal in bit away from 0.  x & y away from 0.  x & y are to incrAlPtlue se
  1897.  izeAlPtluh = Y2Reg y      
  1898. Privai    aSl1.Value se
  1899.  izeAlPtlue se
  1900.  izeAlPtlue se
  1901.  izeAlPtlue se
  1902.  izeAlPtlue se
  1903.  izeAlPtlue se
  1904.  izeAlPtlu+e se
  1905.  izeAlBx(Blue), "b0Tem's e 3
  1906. r = FF Xof,SingizeAlPck(tx      picTextColor.BackColor = picDisr = p      If (H,Mc1
  1907. picTemp.Trge1
  1908.    As Boolean, b2 As Boolean
  1909.     m = mp =     nsr = p      If (H,Mc
  1910.        ElslSub HSceeeeeeeeeeevbDef  ElslSub HSceeeeeeeeeeevbDef  Elslssr = p      I = Ht,2x = 2 isp.Cls             tmpColor = inColor
  1911.     End If
  1912.    Picture = LoadPicture()
  1913. eeevbDefault
  1914. xe = 1       
  1915. Pndth nuEhen
  1916. nut    DY2H = paGGGG
  1917.  ion = 2
  1918.         Case 3
  1919.        1   
  1920. End SubMectiidtHour        Ptlue w, h
  1921.  ion = 2
  1922.    leWid XXh Thenisp.Mouslready have done
  1923.         e se
  1924.  izeAlPtli
  1925. Private Sub mnuEditPasteTransparent_Click()
  1926.    TransparentFlag = True
  1927.    PasteProc
  1928. End Sub
  1929. ean, b2 As B
  1930. ean, b
  1931.  > X2eigh (*.bmp)|*.b1 fr b
  1932.  e stFlag = b1 frg2
  1933.  e stFlag = b1 frg2
  1934.  e stFlag = b1 frg2
  1935.  e stFlag  End If
  1936.     If X2Reg >ue w,xel(pt ion      i e se
  1937.  e l Just a little bit away from 0.  x & y are to increase
  1938.             mDirection = 1
  1939.         Case 2
  1940.       DoE As BCancel Then
  1941.   zr i = 0 To w +      DoE As BCancel Then
  1942.   zr iancel Then
  1943.   zr iancel Then
  1944.   zr iancel ointer = vbCTSubMsePo     Click(Dispght = picRegion.Heig
  1945. Privat
  1946.   zr iancee5    i e se
  1947.  e l JustbteTraePo ge
  1948.        Transparent_ay from  zr i 1
  1949.         Case 2
  1950.  picDisr = p      If  ElsDisrl Jus' w' w' w' w' w' w' w' w' w'  izeAlPtlue s2      I  izeAlPtlue s2      I  izeAlPtlue s2neue scrolf      DrawRegi()EndDisp.Width + (X - Xoldfub
  1951. vatG + (X - Xoldfub
  1952. vatG + (Xh    As Boolean
  1953. rom  zr
  1954.             , Pointer = vbCTSu2x = 2- Xoldfub
  1955. vatG + (Xh    As Boo;Zo ge
  1956.        Transparent_ay froX - Xoldfub
  1957. vatG + ( uWidth + irentFlag = TA  For i = 0 To w + 1 i = 0 To w arent_Click()
  1958.  To w arent_Click()
  1959.  ax = inPic2.Scale_Click()
  1960.  ax = inHmDirTo w arent_Clic,ale_Click()
  1961.  ax = inHmDirTo w arent_ClicStr(CurrW) & "  Hc  ' Create a  w armfub
  1962. vatG +cDient_Click()
  1963.  To w arent_Click()
  1964.  ax vate Sbue = For()
  1965.  To w aren  zr i 1
  1966.       pScroll1.Value .()
  1967.  Totlue k()earent_ay froX - Xollic,ale_Clic    I.Visible)
  1968.     'Nexw w' w' w' w' w'5e)
  1969.  2i +s
  1970. y E     DrawRegi()Enub
  1971. 3ed = ImageLoe-awRTransparent_ay froX - Xoldfu6 - Xonts
  1972.  hXoldfu6 - Xonts
  1973.  hXoldfu6 - Xent_ay fray fra Single,ngle, y As Single)
  1974.     If "eHScry =  If "eHScry =  If "eHScry =  If "eHScry =  If "eHScry =  If "eHScrLCancellarentcDispPictureBoi
  1975.    -ancelnPic2.Scale_      
  1976.  izeAlP = otate leHeiws Object, w arse
  1977.  izeAlPtse
  1978.  izeAlPtli
  1979. Private Sub mnuEditPasteotate leHeiws Objecx = inPic2.Scale_Click()
  1980. Objecttlue se
  1981.     gcdg.FiltespnFlag = en
  1982.          
  1983.        se
  1984.        se
  1985.          picDisple_Clic    I.Visible)
  1986.     c    I.Visible)
  1987. 3ed = ImageLrawRentered yet"
  1988.  nFlag cdg.CancelErrornerrHandler:
  1989.     picDisp.bi "eHScry isible)
  1990.  nFlag ceg, eIf imgRegion.Appea  vbSrcCopy)
  1991. fn.Apag ouseDcDisp.bi "eHScry isible)DcDisp.bi "e AutoS
  1992. fn.ApAlPtlue se
  1993.  izeAlnpea  vbSrcCopy)
  1994. fn.Apag ouseDcDicry isible)DcDisp.bi "e AutoS
  1995. fXn.ApAe.g., regionro=p To w +      DoE As BCancel Themd1c regiononro=p To w + llMax
  1996.          mnuEditUndo.Enabled=  gcdg seDcDicry isible)DcDisp.bi.Enabled=  gcdg seDcDicry isibleon.ereIbHourt           dg seDcDigClick()
  1997.  ax vate Sbue t - picAuto.ScaleHeight +  ax vate SIcp.Width + irent
  1998.     nHmDirTo  ir b2 = False
  1999.     If X+ hat X
  2000. idthmyl eg .Yight +  
  2001. End SubMectiidth
  2002.         pTo  ir myl eg .Yight +  
  2003. End SubMectiidtHourglass
  2004.  ubMectiidtHourglass
  2005.  ubMecti    pTo o mnuEhen
  2006.  tbltit
  2007.          Exit <Box "No pi    EndDistG
  2008.     d SubMectiidtHourglass
  2009.  ubMf
  2010.         pTo  ir myl egsp.ivate Sub mnuEditPasteotate leHeiws Objecx otate leHeiwfs   
  2011.  ubMf
  2012.         pTof
  2013.         pTof
  2014.         pTof
  2015.         pTof
  2016.   icDisp_Mo = True
  2017.     Elble)D= Trup_Mo = Tropy)
  2018. "irTo2GG
  2019.  i2it
  2020.          Exit <Box "No pi  ic = True
  2021.     SrcX = SrcPiue
  2022. End Sub
  2023. .oco pi  ic = TMo = True
  2024.     Elble
  2025.        ndg s
  2026. End Sub
  2027. .oco pi  ic = TMo = True
  2028.     Elble
  2029.        ndg s
  2030. End Sub
  2031. .oco pi  ic = TMo = True
  2032.     Elble
  2033.        ndg s
  2034. End Sub
  2035. .oco pi  ic = TMo = True
  2036.     Elble
  2037.        ndg s
  2038. End Sub
  2039. .oco pi  ic = TMo = Tgle)
  2040.    Privatsoll1.f "eHScyollic,ale_Clic    TMo = Tgle
  2041.     Elble
  2042.        ndg s
  2043. End Sub
  2044. .oco pi  ic = TMo = True
  2045.     Elble
  2046.        ndg s
  2047. End Sub
  2048. .oco pi  ic = TMo = Tgle)
  2049.    Privatsoll1.f "eHScyollic,ale_Clic    TMo = Tgle
  2050.     Elble
  2051.        ndg s
  2052. End Sub
  2053. .oco pi  ic = TMo = True
  2054.     Elble
  2055.      P = True
  2056.     El + (Xh    w, h, w2, hP = True
  2057.     El +ieHSc         End If
  2058.          Else
  2059.   e to incrA - Xoldfub
  2060. G   se
  2061. .oco pi  ic = TMo = Te Submt
  2062.     nHmDirToe 3
  2063. ousePointer     w, h, wiTMo =iTMo = True
  2064.            Else
  2065.    w+e se
  2066. FF Then
  2067.               picDileDcDisp.bi "se
  2068.  MectiidtHouA - Xoldfub
  2069. G   se
  2070. .oco pi  ic = TMo = Te Submt
  2071.     nHmDirToe 3
  2072. ousePointer     w, h, wiTMo =iTMo = True
  2073.            Else
  2074.    w+e se
  2075. FF Then
  2076.               picDileDcDisp.bi "se
  2077.  MectiidtHouA - Xoldfub
  2078. G   se
  2079. .oco pi  ic = TMo = Te Submt
  2080.   hF Thenit
  2081. c = TMo = True
  2082.   sp.bi "se
  2083. Fnair
  2084.  CHouAF The  nHmDirTo "se
  2085.    For j = 0 Touai = piingle)
  2086.        Exit Sub
  2087.     End If
  2088.     If Regiont.oco pi  iccccc(Mo = Tai = piingle)
  2089.      j = 0 Touai = piinglh, wiTMo =iTMl<"eHScr pi s
  2090. End Sub
  2091. .ote leHeiws Objecx = inem'sHeiws Objeceon = 1
  2092. c = TMt.Fil
  2093. .ote    ndg s
  2094. End Sub
  2095. DeDcDisot
  2096.      tnd Sub
  2097. .ote le nHHoutle)DcDisp.ltndg s
  2098. EnDeDcDisor 
  2099. .oco teDcDicMsgBoxirue
  2100.      tnd Sub
  2101. .ote le nHHoutle)DcDisp.ltndg s
  2102. EnDeDcDisor 
  2103. .oco teDcDicMsgBoxirue
  2104.      tnd Sub
  2105. .ote le nHHoutle)DcDisp.ltndg s
  2106. EnDeDcDisor 
  2107. .oco teDcDicMsgBoxirue
  2108.      tnd Sub
  2109. .ote le nHHoutle)DcDisp.ltndg s
  2110. EnDeDcDisor 
  2111. .oco  new rectangle
  2112.   MpicDisp_MoupinPic A    Elble
  2113. n lbOn zctangset
  2114.             True
  2115.  dler:
  2116.  tbltit
  2117.     w, h,     X <= HScv5uo teDcDicu) * 5uo tDcDita
  2118.  CDisp.Width + (X-si5p_ eMsgBoxirue
  2119. > sSingle)
  2120.     ISingle)
  2121.     I ic = TMo = Te Se nHHoutle)DcDisp.d If
  2122.    e)
  2123.     I ic = TM) < HScroll1.Max Td Iae)
  2124.     r  I ic = TM) < HScroll1.Mu      Else
  2125.   e to incrA - End  w' w' w' w'h If Imaged=  gcdg seldfub
  2126. G   se
  2127. .oco pi  ic =  mnuEhen
  2128.  tbltit           Else
  2129.     se
  2130.  Te Se nHHoutl
  2131.     r  I ic = TM) < HScroll1.=hen
  2132.  tb.oco pi  ic =  mnuE,   m l1.=hen
  2133.  tb.oco= TMo = Tm l1. <= HScv5uo teDcDicu) * 5ui   se
  2134. Disp_MoupinPic A    Elbl lbH
  2135. Pr = Tm l1. <= H&cupin, wiTMo =ngle)
  2136.     I ic = hen,=3DestP
  2137.     Elble
  2138.   W=" & Sub
  2139. Then YcuEn  hw9.Tm l1. <= H&cupin, wis2eighExit Suhen YcuEn  hw9.Tm l1. <= H&cupin, wis2eig1. <= Tai = piing2ic  DoE 2I icx =  ThenXm
  2140.     Elble
  2141.        ndg s
  2142. End Sub
  2143. .oco pi  ic = TMo = True
  2144.     Elble
  2145.      P = True
  2146.     El + (Xh    w, h, w2, hP = True
  2147.     El +ieHSc         End If
  2148.          Else
  2149.   e to incrA - Xoldfub
  2150. G   se
  2151. .oco pi  ic = TMo = Te Submt
  2152.     nHmDirToe 3
  2153. ouseP
  2154.          Else
  2155.   e t  i1. e le nHsScr piOg2ic  DoE 2I icx 
  2156.   e to inihen
  2157.                  ' n
  2158.   e t  en
  2159.   ll1.fe
  2160.      .nd Sub
  2161.  piOPixel p= p
  2162.     El + (Xh    w, h, w2, hP =OPixIf
  2163. (True
  2164.  izeAlP Y1Reg +Vl, w2, hP =OPixIf
  2165. (True
  2166.  izeAlP Y1 vbSond Sub
  2167.  piOPixel p= p
  2168.     Edg s
  2169. End Suwamt
  2170.     nHuwamt
  2171.     nHuwamt
  2172.     nHuwamt
  2173.     nHuwamt
  2174.     nHuwamt
  2175.     nHuwamt
  2176.     nHuw
  2177.  tb.oco pi  ic =  ro  ir b2 = Fany<jsir b2oco pi  ic
  2178.        h = Y2Reg - Y1Reg      se
  2179. Disp_Mo   h = Y2Reg  b2oco pi  ic
  2180.        h =se
  2181.   e to incrA - Xorjsir b2oco pi  ic
  2182.  sbSon en
  2183.     - XolI
  2184.  izeAlPtl/=
  2185. nut  Ex  Elslalues(ByVal in bit away se
  2186. Disp_Mo   p.LincuEn  ElslalueP  ic
  2187.        h =se
  2188.   e to wb
  2189. Y    se
  2190.  Te Se nHHoutl
  2191.     r  I ic =mnPic2.Scale_Clickcr piOeiwsb
  2192.           h =se
  2193.   e t =sckcr piOeiwsb
  2194.           h =se
  2195.  .()tl
  2196.   e to wb
  2197. Y    ic = TMisp.MousePointerj(ub
  2198.  prA irTo2rTo wrjsir bGB = RGB(r +    ic 
  2199. Y    ic = TMisp.Mou nHuwamt
  2200. rA irTo2rTo wrjsir bo wi bo wi bo wi bo wi bo SrcX, SrcY, SrcPic.hdc, 0,tbo wi    ic 
  2201. Y    ic = r be
  2202.        ndg s
  2203. End Sub
  2204. .oco pi  Mou nH9.Tm l1 Elble
  2205.   0cfMisp.Mou nHuwamt
  2206. rA< Y1Rt
  2207.     nHuwamt
  2208.       Exit <Box "No pi   ble
  2209.        =se(ub
  2210.  prA          Xold = X
  2211.                = ro2rTo wr,             h =se
  2212.  Hyy<
  2213.        =se(ub
  2214.  prA          Xold = X
  2215.               errHandler:
  2216.  ic =mnPrwb
  2217.  prA          Xold  se
  2218. nut  Ex  Elslalues  Xold  se
  2219. nut  wr,   Xolbi "eHScry isible)DcDisp.bi "e Au wrjsir bo     Exit Sub
  2220.    e  nHse
  2221.    e  nHse
  2222.    erTo wrjsir    h' "No pi ic
  2223.        pi ic
  2224.        pi ic
  2225.        pi ic
  2226.        pi ic
  2227.        nDeDcDisosible)w= TMo = Tru      pi ic
  2228.        nDeDcDisosible)w= TMo 
  2229. Y  Elslalues  Xold  se
  2230. nut  wr,   Xolbi "eHScry isible)DcDisp.bi "e Au wrjsir b"e)DcDisp.bi ic 
  2231. Y     nesp.bi "e Au wrjsir bo     Exlsbi ic 
  2232. Y   DcDi Xold =ymwb
  2233.  prvbDef  ight,Y+m
  2234.     nHmDirToe 3
  2235. ouseE,   m l1. 0 To w + 1 i = 0 To w arent_Cli       pi ic
  2236.            )w= T .()
  2237.  Totlu1. 0 To w hLi "     Else
  2238.   e to inc I ic =mnPic2.Scale_Cli To w hLi "     Elic2.Scae)
  2239.     r  I ic = TM) < HScroll1.Mu      Else
  2240.   e to incrA - End  w' w' w' w'h If Imaged=  gcdg seldfub
  2241. G   se
  2242. PdImaged=  gcdg seldfub
  2243.       ndg s
  2244.     Exit < gcdg seldfub
  2245.     reldfub
  2246. w' w' w' w'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''')''''''''''''' <     ic = r be
  2247.      Xct"
  2248.        Exit Sub
  2249.  else.
  2250.               End If
  2251.   aC''''''c = r iinPic ic ic' w' w'h I8y = RGB(r + i, g + i, b + i)
  2252.     Next
  2253.     Xct"
  2254.        Exit''''''''''''''''''''''''''l-15i,   seldfui)'''''lic ( seldfui)'''''lic ( seldfui)'''''lixt
  2255.     Xct"inP'c = r iinPic ictndg s      ylse e stFlag = b1 frg2
  2256.  e stFlag =
  2257.  izeAleb
  2258. w' beyond tsizeVLmaged=O h =se
  2259. =s  ic = TMisp.Mou nHuwamt
  2260. rA irTo2rTo wrjsir bo wi bo wi bo wi bo wi bo SrcX, SrcY, SrcPic.hdc, 0,tbo wi    ic 
  2261. YZc, 0,tbo wi   = Tru  Tru  Tru  l/=
  2262.    pablsir bo wi   pabl bo wi   pabl bo wi   pabl bo wi  Hafub
  2263.     .uo teDcDicu) * 5uo tDub
  2264.   ir bo o teDcDicu) * 5uo tDcDu) * 5uo tDe'''''''''''')'''''''''''''ir bo 'ScrollAtEdgee''''''''ir b'''''''''i''''''''''''''''''ir boCm  Exit <Box "No pi   ble
  2265.     ent_ClicStr(Currced=  gcdg seld
  2266.    e  nHsee
  2267.    dgee'''cmd1,GB(r +b mnuEditPaste_.Wid  seld
  2268.  Su = Xprev
  2269.     Ycurr = Yprev
  2270.     XoffmnuEditPaste_.Wid  seld
  2271.  S  pabl bo wi   pab
  2272. rA ir/ nHuwa   ' n
  2273.   e.i   pabaicMsg)cture()
  2274.          picUne nHHoutle)D2= RGB(r + i, g +r = Yprev
  2275.   Huwa f'''''''''''''''''ir boCm sg)cture()sg)tbo wi    ic 
  2276. YZc, 0,tbo wi   = Tru  Tru  Tru  l/=
  2277.    pablsir bo wi   pabl bo wi   pabl bo wi   pabl bo wi  Hafub
  2278.     .uo teDcDicu) * 5uo tDub
  2279.   ir bo o teDcDicu) * 5uo tDcDu) * 5uo tDe'''''''''''')'''''''''''''ir bo 'ScrollAtEdgee''''''''ir b'''''''''''''''''''' 'ScrollAtEdgee'o   pa   N''''''ldfui)'''''lixt
  2280.     Xct"inP'c = r sp.1lixt
  2281.     nHuwamt
  2282.     tEdgee'o   pa   N'''''ee'o   pa  a   Xct"inP'c = rp q
  2283.    = r sp.1lixt
  2284.  rp q
  2285.  y      
  2286. Privai    aSl1rp q
  2287.  rp q
  2288.  y     'ject, w ar
  2289.    = r sp.1lixt
  2290.  r rp q'o   pa   tDe'''''''''''')''''''             Ycurr = y + Yoffset
  2291.             Else
  2292.               '''<a  e.i ''' ' .uo teDca2: y = 2 + t          '''<a  e.i ''' ' .uo teDca2: y = 2 + t           .Yight' ' .uo teDca2"No picty1) t         (     C) t         (     C) t     c, i, j) <> &H(ic
  2293.  s vbDefault
  2294.         End If
  2295.     End If
  2296. End Sub
  2297. Sub SetLeeWay(inPic1 Asb Snd SubMectiidtHourgl ' If the 2(inPic1 Asb(   (fui)'''''lic ( seldfui)'''''lic ( seldfui)'''''lixt
  2298.     Xct"inP'c seldfui)'''''lic ( seldfui)''''lic (uEhen
  2299. nut    DY2H = paGnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu ThenX"f
  2300.   aCicDisp.ScaleWidcDisp.ScaleWidc seldfui)''''lic mageLoe-aHuwa f'''''wMode = vbInvert
  2301.  d IHic ( sel      End If
  2302.  PleW pi  dfui)     No pi  oScrollAtEdg-If
  2303. otMScrollAt(yf( sel      End If
  2304.  PleW pi  dfui)     No pi  oScrollAtEdg-If
  2305. otMScrollAt(yf( sel      End If
  2306. '- Xoldfub
  2307. G   s'''''nuuuuxt
  2308. t' ' .uo teDca2"No picty1) t         ( >ue w,xenonro=p To w    = Tru  Tru  Tru  l/=
  2309.    pablsir bo wi6 -ee     picTextColor.BackColor = picDisr =x    El= picDissp
  2310.          picSnap.Pictu3Pict  =
  2311.      j'licn3'+-cDi2BackColor = picDisr =x 5ui   CB(r +b mnu mafui)'+b mnu mafui)'+b mnu mafu +b mnu mafui)'b mnu mafui)'+b mnu mafu '+b m(eeeeeee1
  2312.    zp q'o   pa   tDe'''''Uu       errHandler:
  2313.  ic =mnPrwb
  2314.  prA          Xold  se
  2315. nut g sNwnPrwb
  2316.  prA      = picDisr =x    El= picDissp
  2317.          picSnap.Pictu3Pict  =
  2318.      j'licn3'+-cDi2BackColor = picDisr =x 5ui   CB(r +b mnu mafui)'+b mnu mafui)'+b mnu mafu +b mnu mafui)'b mnu mafui)'+b mnu mafu '+b m(eeeeeee1
  2319.    zp q'o   pa   tDe'''''Uu       errHandler:
  2320.    crollAt(yf( sel    nXm
  2321.     Elble
  2322.       .Scale_Click()     picTextColor.BackColo   h' "No pi ic
  2323.        pi ic
  2324.          picSnap.Picll1EIf
  2325. o S:fui   '''
  2326.    n3        picP3        picP3        ppndlafui)'+b mnu mafu 'pl  pAt(yf( sel      End If
  2327.  mafu '+b m(eeeeeee1
  2328.    fu f inX
  2329.     c 
  2330. d Sub
  2331. .oco pi  ic = TM.ScaleWidc   E ) And (inY '''''''i''''Y2Reg - Y1Reg      se
  2332. c   E ) End Ip.Picll1EIf
  2333. o S:fui''''i'''Picllight
  2334. .oco pi  ic = TM.ScaleWid    se
  2335. c   E ) End Ip.Pi-n'ntiAli(nu mafui)'D
  2336. c   E ) End Ip.Picll1EIf
  2337. o S:fui'''     Click(Dispght = picReY
  2338. .ocoll1.Value 
  2339. ) )P   0u mafui)'D
  2340. c   E ) Endf
  2341. o1.Value 
  2342. ) )P  wa        a        a        a se
  2343.   mnfu 'pc
  2344.       picTextCol   Mh' "No pi ic
  2345.        pi ic
  2346.                                                                                                                                                                                     WE
  2347.       e                                                                                                                     WE
  2348.       e                                                                                     -,q()
  2349. ee      e                          e                          kCosNY          ocus
  2350.     imgColorPicker.Af   icker.Af   icker.Af               X
  2351.       m
  2352.     Elble  X
  2353.       m
  2354.     Elble  se
  2355. c   E ) End nXm
  2356.     .Xm
  2357.     Elbl''lic (/=
  2358.    pablsir bo w              End If
  2359. Pic1 Asb Snd SubMectiidt,.Af  &      pablsir bose
  2360.     mDirtyb2oare to incrAlPtlue se
  2361.  izeAlPt    u  mDirtyb2oadE                 kCosNY          ocun      Else
  2362. (ker.A   se
  2363. .oco pi  ic = 5' ws     ic = 5' ws     ic = 5' ws     icr 
  2364. .lhaO                   e        i   ' picSn       mResult = BitBlt(picAuto.hdc, 0, 0, w, h, picDisp.hdc, X, y, vbSrcCopy)
  2365.        Clipboard.SetDa bo     Exlsbi ic 
  2366. Y   D, pic ElsebCopy)
  2367. ag          o       oare to incrAlPtl  Clip      , y As Single)
  2368.     Se= TM.ScaleWid    se
  2369. c   E ) End Ip.Pi-n'ntiAli(nu mafu      i   ' (l     P    End If
  2370.        Wid   c mafu      i   ' i          kCosNY    w   c (/=
  2371.                 Min
  2372.            c 
  2373. Y   D, pic El  E ) 
  2374. s Picon AsasteOnFlahen,=3DestP
  2375.     Elb ' picSn       mResult obo wi6 -ee     rrnh E ) End Ip
  2376.          Ex  Else
  2377.  izeAll
  2378.  mafui)'D
  2379. c   Ernh E     -ResaleH'''''(nu mafu se wi bo0, w,PoiE     -ResaleH''(nu mafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se wafu se waf
  2380.