基本信息
源码名称:vb.net语言做的吊牌打印软件
源码大小:0.13M
文件格式:.rar
开发语言:ASP
更新时间:2018-05-07
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

vb.net语言做的吊牌打印软件

Public Class Form1
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
    '如果我没记错的话, .net里是没Any这个类型的, 你把他改为Long
    Private Declare Sub ReleaseCapture Lib "User32" ()

    Const WM_NCLBUTTONDOWN = &HA1
    Const HTCAPTION = 2

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        End
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.BackgroundImage = Image.FromFile(Application.StartupPath   "\01.png")
        db_m = GetDataSet("select * from 模版")

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If db_m Is Nothing Then
            Button1_Click(sender, e)
        Else
            Form3.ShowDialog()
            If ck_m = "" Then
                Exit Sub
            Else
                Dim db As DataSet
                db = GetDataSet("select * from 模版 where 名称='" & ck_m & "'")
                pback1.Width = pback1.Height / db.Tables(0).Rows(0).Item(32) * db.Tables(0).Rows(0).Item(31)


                Dim scw, sch, sc As Integer
                Dim bl As Double
                scw = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width
                sch = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Height
                sc = Math.Sqrt(scw * scw   sch * sch) / 17
                bl = pback1.Height / (120 / 25.4 * 96)
                'MsgBox(bl)

                ps = db.Tables(0).Rows(0).Item(33)


                For i = 1 To 10

                    px(i - 1) = db.Tables(0).Rows(0).Item((i - 1) * 3   1)
                    py(i - 1) = db.Tables(0).Rows(0).Item((i - 1) * 3   2)
                    pback1.Controls("lab" & i).Text = db.Tables(0).Rows(0).Item((i - 1) * 3)
                    pback1.Controls("lab" & i).Font = New Font("黑体", db.Tables(0).Rows(0).Item(33) * bl)
                    pback1.Controls("lab" & i).Left = pback1.Height / db.Tables(0).Rows(0).Item(32) * db.Tables(0).Rows(0).Item((i - 1) * 3   1) * bl
                    pback1.Controls("lab" & i).Top = pback1.Height / db.Tables(0).Rows(0).Item(32) * db.Tables(0).Rows(0).Item((i - 1) * 3   2) * bl


                    If pback1.Controls("lab" & i).Text = "" Then
                        Me.Controls("tb" & i).Visible = False
                        Me.Controls("lbc" & i).Visible = False

                    Else
                        Me.Controls("lbc" & i).Text = db.Tables(0).Rows(0).Item((i - 1) * 3)
                        Me.Controls("tb" & i).Visible = True
                        Me.Controls("lbc" & i).Visible = True
                    End If



                Next


                Button8_Click(sender, e)

                Button3.Enabled = True
                Button4.Enabled = True

                Button7.Enabled = True
                Button8.Enabled = True
                Button9.Enabled = True


            End If
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.TextBox31.Text = ""
        Form2.Button1.Text = "添加"
        Form2.ShowDialog()
        ' Form1_Load(sender, e)
        For i = 1 To 10
            Me.pback1.Controls("lab" & i).Text = ""
            Me.Controls("tb" & i).Visible = False
            Me.Controls("lbc" & i).Visible = False
        Next
        DGV1.Rows.Clear()
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = False
        Button7.Enabled = False
        Button8.Enabled = False
        Button9.Enabled = False
        Button10.Enabled = False
        Button11.Enabled = False
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Form4.Text = ck_m
        Form4.ShowDialog()
        Button8_Click(sender, e)
    End Sub

    Private Sub DGV1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DGV1.DoubleClick

    End Sub

    Private Sub DGV1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DGV1.Click
        On Error GoTo err
        If DGV1(0, DGV1.CurrentCell.RowIndex).Value <> "" Then
            For i = 1 To 10
                Me.Controls("tb" & i).Text = DGV1(i, DGV1.CurrentCell.RowIndex).Value
                pn(i - 1) = DGV1(i, DGV1.CurrentCell.RowIndex).Value
                pback1.Controls("lab" & i).Text = DGV1(i, DGV1.CurrentCell.RowIndex).Value
            Next
            Button5.Enabled = True
            Button10.Enabled = True
            Button11.Enabled = True

        End If
err:
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Dim db As DataSet
        db = GetDataSet("select * from 参数 where 模版='" & ck_m & "'")
        DGV1.Rows.Clear()
        If db Is Nothing Then
        Else

            For i = 1 To db.Tables(0).Rows.Count
                DGV1.Rows.Add()
                For j = 0 To 10
                    DGV1(j, i - 1).Value = db.Tables(0).Rows(i - 1).Item(j)
                Next
            Next
        End If

        Button5.Enabled = False
        Button10.Enabled = False
        Button11.Enabled = False
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If MsgBox("确定要删除当前参数", vbYesNo, "参数删除") = vbNo Then Exit Sub


        Dim str As String = ""
        For i = 1 To 10
            If Me.Controls("tb" & i).Visible = True Then
                str = str   " and "   "内容"   i.ToString   "='"   Me.Controls("tb" & i).Text   "'"
            End If
        Next
        str = "delete * from 参数 where 模版='"   ck_m   "'"   str
        InsertDataSet(str)
        MsgBox("删除成功!")

        Button8_Click(sender, e)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If MsgBox("确定要删除模版"   ck_m, vbYesNo, "模版删除") = vbYes Then
            InsertDataSet("delete * from 模版")
            MsgBox("删除成功!")
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If ck_m <> "" Then
            Form2.TextBox31.Text = ck_m
            Form2.TextBox31.Enabled = False
            Form2.Button1.Text = "修改"
            Form2.ShowDialog()
            Form1_Load(sender, e)
        End If
    End Sub



    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If lab1.Text = "" Then
            MsgBox("请先选择模版,在进行搜索!")
            Exit Sub
        End If

        If TextBox1.Text = "" Then
            MsgBox("搜索内容不能为空!")
            Exit Sub
        End If


        Dim db As DataSet
        db = GetDataSet("select * from 参数 where 模版='" & ck_m & "' and 内容1 like '%"   TextBox1.Text   "%' or 内容2 like '%"   TextBox1.Text   "%' or 内容3 like '%"   TextBox1.Text   "%' or 内容4 like '%"   TextBox1.Text   "%' or 内容5 like '%"   TextBox1.Text   "%' or 内容6 like '%"   TextBox1.Text   "%' or 内容7 like '%"   TextBox1.Text   "%' or 内容8 like '%"   TextBox1.Text   "%' or 内容9 like '%"   TextBox1.Text   "%' or 内容10 like '%"   TextBox1.Text   "%'")
        DGV1.Rows.Clear()
        If db Is Nothing Then
        Else

            For i = 1 To db.Tables(0).Rows.Count
                DGV1.Rows.Add()
                For j = 0 To 10
                    DGV1(j, i - 1).Value = db.Tables(0).Rows(i - 1).Item(j)
                Next
            Next
        End If
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        Form5.Button1.Enabled = True
        Form5.ShowDialog()

        If Form5.Button1.Enabled = False Then
            For i = 1 To 10
                pn(i - 1) = Me.Controls("tb" & i).Text
            Next

            PrintDialog1.Document = PrintDocument1
            PrintDialog1.ShowDialog()
            For i = 1 To CInt(Form5.TextBox1.Text)
                PrintDocument1.Print()
            Next
        End If
    End Sub

    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        For i = 1 To 10
            e.Graphics.DrawString(pn(i - 1), New Font("黑体", ps), Brushes.Black, px(i - 1) * 38 / 10, py(i - 1) * 38 / 10)
        Next
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Button5_Click(sender, e)
    End Sub



    Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
        Dim lngReturnValue As Long
        If e.Button = MouseButtons.Left Then
            ReleaseCapture()
            lngReturnValue = SendMessage(Me.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
        End If
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        For i = 1 To 10
            If DGV1(i, DGV1.CurrentCell.RowIndex).Value <> Me.Controls("tb" & i).Text Then
                GoTo nt
            End If
        Next
        Exit Sub
nt:
        If MsgBox("确定要保存当前参数么?", vbYesNo, "参数保存") = vbNo Then Exit Sub


        Dim str As String = ""
        Dim st1, st2 As String
        st1 = ""
        st2 = ""
        For i = 1 To 10
            If Me.Controls("tb" & i).Visible = True Then

                If Me.Controls("tb" & i).Text = "" Then
                    MsgBox("内容不能为空")
                    Exit Sub
                End If
                st1 = st1   ",内容"   i.ToString   "='"   Me.Controls("tb" & i).Text   "'"
                st2 = st2   " and 内容"   i.ToString   "='"   DGV1(i, DGV1.CurrentCell.RowIndex).Value   "'"
                str = str   " and 内容"   i.ToString   "='"   Me.Controls("tb" & i).Text   "'"
            End If
        Next
        st1 = "  模版='"   ck_m   "'"   st1
        str = " where 模版='"   ck_m   "'"   str
        st2 = " where 模版='"   ck_m   "'"   st2
        If GetDataSet("select * from 参数"   str) Is Nothing Then




            UpdateDataSet("update 参数 set "   st1   st2)
            MsgBox("参数保存成功", , "参数保存")
            Button8_Click(sender, e)
        End If
    End Sub
End Class