home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / olympus / ik32_15t / vb4.shr / draw.Bas < prev    next >
Encoding:
BASIC Source File  |  1996-07-23  |  5.5 KB  |  262 lines

  1. Attribute VB_Name = "Module2"
  2. Public g_Lines(10) As Long
  3. Public g_nDrawLimit As Long
  4. Function ChkXBounds(v As Long) As Integer
  5.  
  6.     If (v < 0 Or v >= g_nDrawLimit) Then
  7.         ChkXBounds = 0
  8.     Else
  9.         ChkXBounds = 1
  10.     End If
  11.     Exit Function
  12.  
  13. End Function
  14.  
  15. Function ChkYBounds(v As Long) As Integer
  16.  
  17.     If (v < 0 Or v >= g_nDrawLimit) Then
  18.         ChkYBounds = 0
  19.     Else
  20.         ChkYBounds = 1
  21.     End If
  22.     Exit Function
  23.  
  24. End Function
  25.  
  26. Sub SetDrawArrows()
  27.  
  28.     frmPicbuf!picbuf1.DrawArrows = Draw!cmbDA.ListIndex
  29.  
  30. End Sub
  31.  
  32. Sub SetDrawStyle()
  33.  
  34.     frmPicbuf!picbuf1.DrawStyle = Draw!cmbDS.ListIndex
  35.  
  36. End Sub
  37.  
  38.  
  39. Sub SetDrawWidth()
  40.  
  41.     frmPicbuf!picbuf1.DrawWidth = CInt(Draw!txtDW.Text)
  42.  
  43. End Sub
  44.  
  45. Sub SetFillStyle()
  46.  
  47.     frmPicbuf!picbuf1.FillStyle = Draw!cmbFS.ListIndex
  48.     
  49. End Sub
  50.  
  51. Sub SetFillTransparent()
  52.  
  53.     If Draw!chkFT = 1 Then
  54.         frmPicbuf!picbuf1.FillTransparent = 1
  55.     Else
  56.         frmPicbuf!picbuf1.FillTransparent = 0
  57.     End If
  58.     
  59. End Sub
  60.  
  61.  
  62. Function SetLines() As Integer
  63.  
  64.     Dim X As Long
  65.     Dim Y As Long
  66.     
  67.     ' point 1
  68.     X = CInt(Draw!txtLX1.Text)
  69.     Y = CInt(Draw!txtLY1.Text)
  70.     If (ChkXBounds(X) = 0 Or ChkYBounds(Y) = 0) Then
  71.         SetLines = 0
  72.         Exit Function
  73.     End If
  74.     g_Lines(1) = X
  75.     g_Lines(2) = Y
  76.     
  77.     ' point 2
  78.     X = CInt(Draw!txtLX2.Text)
  79.     Y = CInt(Draw!txtLY2.Text)
  80.     If (ChkXBounds(X) = 0 Or ChkYBounds(Y) = 0) Then
  81.         SetLines = 1
  82.         Exit Function
  83.     End If
  84.     g_Lines(3) = X
  85.     g_Lines(4) = Y
  86.     
  87.     ' point 3
  88.     X = CInt(Draw!txtLX3.Text)
  89.     Y = CInt(Draw!txtLY3.Text)
  90.     If (ChkXBounds(X) = 0 Or ChkYBounds(Y) = 0) Then
  91.         SetLines = 2
  92.         Exit Function
  93.     End If
  94.     g_Lines(5) = X
  95.     g_Lines(6) = Y
  96.     
  97.     ' point 4
  98.     X = CInt(Draw!txtLX4.Text)
  99.     Y = CInt(Draw!txtLY4.Text)
  100.     If (ChkXBounds(X) = 0 Or ChkYBounds(Y) = 0) Then
  101.         SetLines = 3
  102.         Exit Function
  103.     End If
  104.     g_Lines(7) = X
  105.     g_Lines(8) = Y
  106.     
  107.     ' point 5
  108.     X = CInt(Draw!txtLX5.Text)
  109.     Y = CInt(Draw!txtLY5.Text)
  110.     If (ChkXBounds(X) = 0 Or ChkYBounds(Y) = 0) Then
  111.         SetLines = 4
  112.         Exit Function
  113.     End If
  114.     g_Lines(9) = X
  115.     g_Lines(10) = Y
  116.     
  117.     SetLines = 5
  118.     Exit Function
  119.  
  120. End Function
  121.  
  122.  
  123. Sub SetImageAttributes()
  124.  
  125.     Draw!txtCD.Text = frmPicbuf!picbuf1.ColorDepth
  126.     Draw!txtIS.Text = frmPicbuf!picbuf1.Xresolution & "," & frmPicbuf!picbuf1.Yresolution
  127.     Exit Sub
  128.     
  129. End Sub
  130.  
  131. Sub SetForeColorTextBoxes()
  132.  
  133.     Draw!txtFCRed.Text = Str$(getRed(frmPicbuf!picbuf1.ForeColor))
  134.     Draw!txtFCGreen.Text = Str$(getGreen(frmPicbuf!picbuf1.ForeColor))
  135.     Draw!txtFCBlue.Text = Str$(GetBlue(frmPicbuf!picbuf1.ForeColor))
  136.     
  137.     Exit Sub
  138.  
  139. End Sub
  140.  
  141. Sub SetForeColorPicbuf()
  142.  
  143.     Dim color As Long
  144.     color = RGB(CInt(Draw!txtFCRed.Text), CInt(Draw!txtFCGreen.Text), CInt(Draw!txtFCBlue.Text))
  145.     Draw!frmPicbuf.picbuf1.ForeColor = color
  146.     
  147.     Exit Sub
  148.  
  149. End Sub
  150.  
  151.  
  152. Sub SetBackColorTextBoxes()
  153.  
  154.     Draw!txtBCRed.Text = Str$(getRed(frmPicbuf!picbuf1.BackColor))
  155.     Draw!txtBCGreen.Text = Str$(getGreen(frmPicbuf!picbuf1.BackColor))
  156.     Draw!txtBCBlue.Text = Str$(GetBlue(frmPicbuf!picbuf1.BackColor))
  157.     Exit Sub
  158.     
  159. End Sub
  160.  
  161. Sub SetFillColorTextBoxes()
  162.  
  163.     Draw!txtFillCRed.Text = Str$(getRed(frmPicbuf!picbuf1.FillColor))
  164.     Draw!txtFillCGreen.Text = Str$(getGreen(frmPicbuf!picbuf1.FillColor))
  165.     Draw!txtFillCBlue.Text = Str$(GetBlue(frmPicbuf!picbuf1.FillColor))
  166.     
  167.     Exit Sub
  168.  
  169. End Sub
  170.  
  171.  
  172. Sub SetBackColorPicbuf()
  173.  
  174.     Dim color As Long
  175.     color = RGB(CInt(Draw!txtBCRed.Text), CInt(Draw!txtBCGreen.Text), CInt(Draw!txtBCBlue.Text))
  176.     Draw!frmPicbuf.picbuf1.BackColor = color
  177.     Exit Sub
  178.  
  179. End Sub
  180.  
  181.  
  182.  
  183.  
  184. Function GetDestination() As Integer
  185.  
  186.     If Draw!optDIB.value = True Then
  187.         GetDestination = 0
  188.     Else
  189.         GetDestination = 1
  190.     End If
  191.  
  192. End Function
  193. Sub SetText()
  194.  
  195.     ' font bold
  196.     If Draw!chkFontBold.value = 1 Then
  197.         frmPicbuf!picbuf1.Font.Bold = True
  198.     Else
  199.         frmPicbuf!picbuf1.Font.Bold = False
  200.     End If
  201.     
  202.     ' font italic
  203.     If Draw!chkFontItalic.value = 1 Then
  204.         frmPicbuf!picbuf1.Font.Bold = True
  205.     Else
  206.         frmPicbuf!picbuf1.Font.Bold = False
  207.     End If
  208.     
  209.     ' font strikethrough
  210.     If Draw!chkFontStrikethru.value = 1 Then
  211.         frmPicbuf!picbuf1.Font.Strikethrough = True
  212.     Else
  213.         frmPicbuf!picbuf1.Font.Strikethrough = False
  214.     End If
  215.     
  216.     ' font underline
  217.     If Draw!chkFontUnderline.value = 1 Then
  218.         frmPicbuf!picbuf1.Font.Strikethrough = True
  219.     Else
  220.         frmPicbuf!picbuf1.Font.Strikethrough = False
  221.     End If
  222.  
  223.     ' Alignment
  224.     frmPicbuf!picbuf1.TextAlignment = Draw!cmbTA.ListIndex
  225.     
  226.     ' AutoSize
  227.     If Draw!chkTA = 1 Then
  228.         frmPicbuf!picbuf1.TextAutoSize = 1
  229.     Else
  230.         frmPicbuf!picbuf1.TextAutoSize = 0
  231.     End If
  232.     
  233.     ' Ext Leading
  234.     If Draw!chkTEL = 1 Then
  235.         frmPicbuf!picbuf1.TextExtLeading = 1
  236.     Else
  237.         frmPicbuf!picbuf1.TextExtLeading = 0
  238.     End If
  239.     
  240.     ' MultiLine
  241.     If Draw!chkTML = 1 Then
  242.         frmPicbuf!picbuf1.TextMultiLine = 1
  243.     Else
  244.         frmPicbuf!picbuf1.TextMultiLine = 0
  245.     End If
  246.     
  247.     ' get the text
  248.     frmPicbuf!picbuf1.Text = Draw!txtText.Text
  249.  
  250. End Sub
  251.  
  252. Sub SetupDrawing()
  253.     Draw.SetSelection
  254.     SetDrawWidth
  255.     SetDrawStyle
  256.     SetDrawArrows
  257.     SetFillStyle
  258.     SetFillTransparent
  259. End Sub
  260.  
  261.  
  262.