home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / caver_dave2079088112007.psc / frm39Barcode.frm < prev    next >
Text File  |  2007-08-11  |  16KB  |  502 lines

  1. VERSION 5.00
  2. Begin VB.Form frm39Barcode 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   " CREATE A 3 of 9 BARCODE"
  5.    ClientHeight    =   6660
  6.    ClientLeft      =   2865
  7.    ClientTop       =   2670
  8.    ClientWidth     =   11295
  9.    Icon            =   "frm39Barcode.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   6660
  14.    ScaleWidth      =   11295
  15.    Begin VB.CommandButton Command5 
  16.       Height          =   615
  17.       Left            =   7920
  18.       Picture         =   "frm39Barcode.frx":0EFA
  19.       Style           =   1  'Graphical
  20.       TabIndex        =   15
  21.       ToolTipText     =   "MINIMISE ME"
  22.       Top             =   5760
  23.       Width           =   615
  24.    End
  25.    Begin VB.CommandButton Command7 
  26.       Height          =   615
  27.       Left            =   9600
  28.       Picture         =   "frm39Barcode.frx":104C
  29.       Style           =   1  'Graphical
  30.       TabIndex        =   14
  31.       ToolTipText     =   "SHOW HELP"
  32.       Top             =   5760
  33.       Width           =   615
  34.    End
  35.    Begin VB.CommandButton Command6 
  36.       Height          =   615
  37.       Left            =   8760
  38.       Picture         =   "frm39Barcode.frx":1D16
  39.       Style           =   1  'Graphical
  40.       TabIndex        =   13
  41.       ToolTipText     =   "SHOW ABOUT AND LINK"
  42.       Top             =   5760
  43.       Width           =   615
  44.    End
  45.    Begin VB.CommandButton Command4 
  46.       Height          =   615
  47.       Left            =   10440
  48.       Picture         =   "frm39Barcode.frx":29E0
  49.       Style           =   1  'Graphical
  50.       TabIndex        =   12
  51.       ToolTipText     =   "EXIT THIS APPLICATION:- BY THE NEAREST DOOR!"
  52.       Top             =   5760
  53.       Width           =   615
  54.    End
  55.    Begin VB.CommandButton Command3 
  56.       Height          =   615
  57.       Left            =   5160
  58.       Picture         =   "frm39Barcode.frx":36AA
  59.       Style           =   1  'Graphical
  60.       TabIndex        =   11
  61.       ToolTipText     =   "CLEAR AND RESET ALL"
  62.       Top             =   5760
  63.       Width           =   615
  64.    End
  65.    Begin VB.CommandButton Command2 
  66.       Height          =   615
  67.       Left            =   4440
  68.       Picture         =   "frm39Barcode.frx":4374
  69.       Style           =   1  'Graphical
  70.       TabIndex        =   10
  71.       ToolTipText     =   "PREVIEW CURRENT BARCODE"
  72.       Top             =   5760
  73.       Width           =   615
  74.    End
  75.    Begin VB.Frame Frame2 
  76.       Caption         =   "Make Barcode"
  77.       Height          =   1095
  78.       Left            =   240
  79.       TabIndex        =   5
  80.       Top             =   4320
  81.       Width           =   10815
  82.       Begin VB.CommandButton Command1 
  83.          Height          =   615
  84.          Left            =   120
  85.          Picture         =   "frm39Barcode.frx":503E
  86.          Style           =   1  'Graphical
  87.          TabIndex        =   7
  88.          ToolTipText     =   "CREATE BARCODE"
  89.          Top             =   270
  90.          Width           =   1095
  91.       End
  92.       Begin VB.TextBox Text1 
  93.          Height          =   285
  94.          Left            =   1335
  95.          TabIndex        =   6
  96.          Top             =   600
  97.          Width           =   6480
  98.       End
  99.       Begin VB.Label Label4 
  100.          Caption         =   "Enter Text For Barcode Here (Max 20 Characters)"
  101.          Height          =   300
  102.          Left            =   1335
  103.          TabIndex        =   9
  104.          Top             =   240
  105.          Width           =   6240
  106.       End
  107.       Begin VB.Label Label1 
  108.          BorderStyle     =   1  'Fixed Single
  109.          Height          =   285
  110.          Left            =   7920
  111.          TabIndex        =   8
  112.          Top             =   600
  113.          Width           =   2655
  114.       End
  115.    End
  116.    Begin VB.PictureBox Picture1 
  117.       AutoRedraw      =   -1  'True
  118.       BackColor       =   &H00FFFFFF&
  119.       Height          =   3975
  120.       Left            =   240
  121.       ScaleHeight     =   3915
  122.       ScaleWidth      =   10755
  123.       TabIndex        =   0
  124.       Top             =   240
  125.       Width           =   10815
  126.    End
  127.    Begin VB.Frame Frame1 
  128.       Caption         =   "Picture Properties"
  129.       Height          =   855
  130.       Left            =   240
  131.       TabIndex        =   2
  132.       Top             =   5640
  133.       Width           =   4095
  134.       Begin VB.Label Label2 
  135.          BorderStyle     =   1  'Fixed Single
  136.          Height          =   285
  137.          Left            =   120
  138.          TabIndex        =   4
  139.          Top             =   360
  140.          Width           =   1815
  141.       End
  142.       Begin VB.Label Label3 
  143.          BorderStyle     =   1  'Fixed Single
  144.          Height          =   285
  145.          Left            =   2040
  146.          TabIndex        =   3
  147.          Top             =   360
  148.          Width           =   1815
  149.       End
  150.    End
  151.    Begin VB.Label Node 
  152.       BackColor       =   &H00C00000&
  153.       Caption         =   "Label2"
  154.       Height          =   75
  155.       Index           =   0
  156.       Left            =   75
  157.       TabIndex        =   1
  158.       Top             =   120
  159.       Visible         =   0   'False
  160.       Width           =   75
  161.    End
  162. End
  163. Attribute VB_Name = "frm39Barcode"
  164. Attribute VB_GlobalNameSpace = False
  165. Attribute VB_Creatable = False
  166. Attribute VB_PredeclaredId = True
  167. Attribute VB_Exposed = False
  168. Option Explicit
  169.  
  170. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  171.  
  172. Private Const WM_PAINT = &HF
  173. Private Const WM_PRINT = &H317
  174. Private Const PRF_CLIENT = &H4&    ' Draw the window's client area
  175. Private Const PRF_CHILDREN = &H10& ' Draw all visible child windows
  176. Private Const PRF_OWNED = &H20&    ' Draw all owned windows
  177.  
  178. Dim i As Integer
  179.  
  180. Const myerrfilepath = 53
  181. Const errfilepath = 75
  182. '    Const rterror = 68
  183.  
  184. Private Sub Command1_Click()
  185. Text1.Text = UCase$(Text1) ' convert all entered text to capitals
  186.  
  187. Picture1.Cls ' clear the box on each click instead of overwriting
  188.  
  189. Picture1.CurrentX = 567 ' barcode
  190. Picture1.CurrentY = 567 '        position
  191.  
  192. Picture1.Font = "Free 3 of 9 Extended"
  193. Picture1.FontSize = 45
  194. Picture1.Print Text1.Text ' barcode text
  195.  
  196. Picture1.CurrentX = 567  ' postion  the    below   barcode
  197. Picture1.CurrentY = 1400 '        of   text     the
  198. Picture1.FontSize = 15
  199. Picture1.FontName = "Courier"
  200. Picture1.FontSize = 15
  201. 'Picture1.Print Spc(5); ' add additional spaces if required
  202. Picture1.Print Text1.Text
  203.  
  204.  
  205. Text1.Text = ""
  206. Text1.SetFocus
  207. End Sub
  208.  
  209. Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  210. '*******************************************************
  211. '*            set the command button cursor            *
  212. '*******************************************************
  213. Command1.MousePointer = 99
  214. Command1.MouseIcon = LoadResPicture(101, vbResCursor)
  215. End Sub
  216.  
  217. Private Sub Command2_Click()
  218. '*******************************************************
  219. '*          show the card preview window               *
  220. '*        minimises the main design window             *
  221. '*******************************************************
  222. Dim rv As Long
  223.  
  224. frmPreview.Show
  225. Me.WindowState = vbMinimized
  226. '* this came straight from ms technet!
  227. frmPreview.Picture1.AutoRedraw = True
  228. rv = SendMessage(Picture1.hwnd, WM_PAINT, frmPreview.Picture1.hDC, 0)
  229. rv = SendMessage(Picture1.hwnd, WM_PRINT, frmPreview.Picture1.hDC, PRF_CHILDREN + PRF_CLIENT + PRF_OWNED)
  230. frmPreview.Picture1.Picture = frmPreview.Picture1.Image
  231. frmPreview.Picture1.AutoRedraw = False
  232. End Sub
  233.  
  234. Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  235. '*******************************************************
  236. '*            set the command button cursor            *
  237. '*******************************************************
  238. Command2.MousePointer = 99
  239. Command2.MouseIcon = LoadResPicture(101, vbResCursor)
  240. End Sub
  241.  
  242. Private Sub Command3_Click()
  243. Picture1.Width = 10815
  244. Picture1.Height = 3975
  245.  HideNodes
  246. 'Label2.Caption = " Width =  " & Picture1.Width
  247. 'Label3.Caption = " Height = " & Picture1.Height
  248. Label2.Caption = " Width =  " & Round((Picture1.Width / 567), 2) & " cm"
  249. Label3.Caption = " Height = " & Round((Picture1.Height / 567), 2) & " cm"
  250.  
  251. Picture1.Cls
  252.  
  253. End Sub
  254.  
  255. Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  256. '*******************************************************
  257. '*            set the command button cursor            *
  258. '*******************************************************
  259. Command3.MousePointer = 99
  260. Command3.MouseIcon = LoadResPicture(101, vbResCursor)
  261. End Sub
  262.  
  263. Private Sub Command4_Click()
  264. Unload Me
  265. Unload frmPreview
  266. Unload frmLink
  267. End Sub
  268.  
  269. Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  270. '*******************************************************
  271. '*            set the command button cursor            *
  272. '*******************************************************
  273. Command4.MousePointer = 99
  274. Command4.MouseIcon = LoadResPicture(101, vbResCursor)
  275. End Sub
  276.  
  277. Private Sub Command5_Click()
  278. Me.WindowState = vbMinimized
  279. End Sub
  280.  
  281. Private Sub Command5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  282. '*******************************************************
  283. '*            set the command button cursor            *
  284. '*******************************************************
  285. Command5.MousePointer = 99
  286. Command5.MouseIcon = LoadResPicture(101, vbResCursor)
  287. End Sub
  288.  
  289. Private Sub Command6_Click()
  290. frmLink.Show
  291. End Sub
  292.  
  293. Private Sub Command6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  294. '*******************************************************
  295. '*            set the command button cursor            *
  296. '*******************************************************
  297. Command6.MousePointer = 99
  298. Command6.MouseIcon = LoadResPicture(101, vbResCursor)
  299. End Sub
  300.  
  301. Private Sub Command7_Click()
  302. frm39BarcodeHelp.Show
  303. End Sub
  304.  
  305. Private Sub Command7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  306. '*******************************************************
  307. '*            set the command button cursor            *
  308. '*******************************************************
  309. Command7.MousePointer = 99
  310. Command7.MouseIcon = LoadResPicture(101, vbResCursor)
  311. End Sub
  312.  
  313. Private Sub Form_Load()
  314.  If Node.Count = 1 Then
  315.         For i = 1 To 7
  316.             Load Node(i)
  317.         Next
  318.     End If
  319. Label1.Caption = " No of Characters = " & "0"
  320. Text1.MaxLength = 20
  321. 'Label2.Caption = " Width =  " & (Picture1.Width / 567) & " cm"
  322. 'Label3.Caption = " Height = " & (Picture1.Height / 567) & " cm"
  323. Label2.Caption = " Width =  " & Round((Picture1.Width / 567), 2) & " cm"
  324. Label3.Caption = " Height = " & Round((Picture1.Height / 567), 2) & " cm"
  325.  
  326. End Sub
  327.  
  328. Private Sub Text1_Change()
  329. Label1.Caption = " No of Characters = " & Len(Text1.Text) '= UCase$(Text1)
  330. 'Text2.Text = UCase(Text1.Text)
  331. End Sub
  332. Private Sub Picture1_DblClick()
  333.  For i = 0 To 7
  334.         Node(i).Visible = False
  335.     Next
  336. End Sub
  337. Private Sub HideNodes()
  338.     For i = 0 To 7
  339.         Node(i).Visible = False
  340.     Next
  341. End Sub
  342. Private Sub SizeObject(NodeIndex As Integer, X As Single, Y As Single)
  343.     On Error Resume Next
  344.     
  345.     With Picture1
  346.         Select Case NodeIndex
  347.             Case 0
  348.                 .Width = .Width + (.Left - X)
  349.                 .Height = .Height + (.Top - Y)
  350.                 .Left = X
  351.                 .Top = Y
  352.             Case 1
  353.                 .Width = .Width + (.Left - X)
  354.                 .Left = X
  355.             Case 2
  356.                 .Width = (.Left - X) + .Width
  357.                 .Height = Y - .Top
  358.                 .Left = X
  359.             Case 3
  360.                 .Height = .Height + .Top - Y
  361.                 .Top = Y
  362.             Case 4
  363.                 .Height = Y - .Top
  364.             Case 5
  365.                 .Width = X - .Left
  366.                 .Height = .Height + .Top - Y
  367.                 .Top = Y
  368.             Case 6
  369.                 .Width = X - .Left
  370.             Case 7
  371.                 .Width = X - .Left
  372.                 .Height = Y - .Top
  373.         End Select
  374.     End With
  375. Label2.Caption = " Width =  " & Round((Picture1.Width / 567), 2) & " cm"
  376. Label3.Caption = " Height = " & Round((Picture1.Height / 567), 2) & " cm"
  377.     'KeyEdit = "Move"
  378. End Sub
  379. Private Sub SetNodes(SelectedControl As Control)
  380.     With SelectedControl
  381.         For i = 0 To 7
  382.             Select Case i
  383.                 'Left Top
  384.                 Case 0
  385.                     Node(i).Left = .Left - Node(i).Width
  386.                     Node(i).Top = .Top - Node(i).Height
  387.                 'Left center
  388.                 Case 1
  389.                     Node(i).Left = .Left - Node(i).Width
  390.                     Node(i).Top = .Top + ((.Height - Node(i).Height) / 2)
  391.                 'Left bottom
  392.                 Case 2
  393.                     Node(i).Left = .Left - Node(i).Width
  394.                     Node(i).Top = .Top + .Height
  395.                 'Center Top
  396.                 Case 3
  397.                     Node(i).Left = .Left + ((.Width + Node(i).Width) / 2)
  398.                     Node(i).Top = .Top - Node(i).Height
  399.                 'Center Bottom
  400.                 Case 4
  401.                     Node(i).Left = .Left + ((.Width + Node(i).Width) / 2)
  402.                     Node(i).Top = .Top + .Height
  403.                  'Right Top
  404.                 Case 5
  405.                     Node(i).Left = .Left + .Width
  406.                     Node(i).Top = .Top - Node(i).Height
  407.                 'Right Center
  408.                 Case 6
  409.                     Node(i).Left = .Left + .Width
  410.                     Node(i).Top = .Top + ((.Height - Node(i).Height) / 2)
  411.                 'Right Bottom
  412.                 Case 7
  413.                     Node(i).Left = .Left + .Width
  414.                     Node(i).Top = .Top + .Height
  415.             End Select
  416.             Node(i).Visible = True
  417.         Next
  418.     End With
  419. End Sub
  420.  
  421. Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
  422.     SetNodes Picture1
  423. End Sub
  424.  
  425. Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  426.     SizeObject Source.Index, X, Y
  427. End Sub
  428.  
  429.  
  430. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  431.     MousePointer = 0
  432. End Sub
  433.  
  434. Private Sub Picture1_Click()
  435.     If Node.Count = 1 Then
  436.         For i = 1 To 7
  437.             Load Node(i)
  438.         Next
  439.     End If
  440.     SetNodes Picture1
  441. End Sub
  442.  
  443. Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
  444.     SetNodes Picture1
  445. End Sub
  446.  
  447. Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  448.      'SizeObject Source.Index, X, Y
  449.     With Picture1
  450.         Select Case Source.Index
  451.             Case 0
  452.                 .Top = .Top + Y
  453.                 .Left = .Left + X
  454.                 .Width = .Width - X
  455.                 .Height = .Height - Y
  456.             Case 1
  457.                 .Left = .Left + X
  458.                 .Width = .Width - X
  459.             Case 2
  460.                 .Width = .Width - X
  461.                 .Height = Y
  462.                 .Left = .Left + X
  463.             Case 3
  464.                 .Height = .Height - Y
  465.                 .Top = .Top + Y
  466.             Case 4
  467.                 .Height = Y
  468.             Case 5
  469.                 .Width = X
  470.                 .Height = .Height - Y
  471.                 .Top = .Top + Y
  472.             Case 6
  473.                 .Width = X
  474.             Case 7
  475.                 .Width = X
  476.                 .Height = Y
  477.         End Select
  478.     End With
  479. End Sub
  480.  
  481. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  482.     MousePointer = 0
  483. End Sub
  484.  
  485. Private Sub node_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  486.    HideNodes
  487.    Node(Index).Drag
  488. End Sub
  489.  
  490. Private Sub node_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  491.     Select Case Index
  492.         Case 0, 7
  493.             MousePointer = 8
  494.         Case 1, 6
  495.             MousePointer = 9
  496.         Case 2, 5
  497.             MousePointer = 6
  498.         Case 3, 4
  499.             MousePointer = 7
  500.     End Select
  501. End Sub
  502.