现在的位置: 首页 > 综合 > 正文

一个简单的代码生成“器”

2013年10月08日 ⁄ 综合 ⁄ 共 6619字 ⁄ 字号 评论关闭

'//一个简单的代码生成“器”

'//在比较大的数据库操作时,对字段操作有好多变量、属性、函数的类似的重复性的大量代码

'//如果一个个来重写,确是令人烦躁的事,因此自己弄了一个小程序作这部分工作。

 

 

Public Class FrmPropertyCode

    Inherits System.Windows.Forms.Form

 

#Region " Windows 窗体设计器生成的代码 "

 

    Public Sub New()

        MyBase.New()

 

        '该调用是 Windows 窗体设计器所必需的。

        InitializeComponent()

 

        ' InitializeComponent() 调用之后添加任何初始化

        Initialize()

    End Sub

 

    '窗体重写 dispose 以清理组件列表。

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

        If disposing Then

            If Not (components Is Nothing) Then

                components.Dispose()

            End If

        End If

        MyBase.Dispose(disposing)

    End Sub

 

    'Windows 窗体设计器所必需的

    Private components As System.ComponentModel.IContainer

 

    '注意: 以下过程是 Windows 窗体设计器所必需的

    '可以使用 Windows 窗体设计器修改此过程。

    '不要使用代码编辑器修改它。

    Friend WithEvents VariableTextBox As System.Windows.Forms.TextBox

    Friend WithEvents CodeTextBox As System.Windows.Forms.TextBox

    Friend WithEvents PropertyComboBox As System.Windows.Forms.ComboBox

    Friend WithEvents PropertyTextBox As System.Windows.Forms.TextBox

    Friend WithEvents SavePropertyButton As System.Windows.Forms.Button

    Friend WithEvents BuildCodeButton As System.Windows.Forms.Button

    Friend WithEvents Label1 As System.Windows.Forms.Label

    Friend WithEvents Label2 As System.Windows.Forms.Label

    Friend WithEvents Label3 As System.Windows.Forms.Label

    Friend WithEvents Label4 As System.Windows.Forms.Label

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FrmPropertyCode))

        Me.VariableTextBox = New System.Windows.Forms.TextBox

        Me.CodeTextBox = New System.Windows.Forms.TextBox

        Me.PropertyComboBox = New System.Windows.Forms.ComboBox

        Me.PropertyTextBox = New System.Windows.Forms.TextBox

        Me.SavePropertyButton = New System.Windows.Forms.Button

        Me.BuildCodeButton = New System.Windows.Forms.Button

        Me.Label1 = New System.Windows.Forms.Label

        Me.Label2 = New System.Windows.Forms.Label

        Me.Label3 = New System.Windows.Forms.Label

        Me.Label4 = New System.Windows.Forms.Label

        Me.SuspendLayout()

        '

        'VariableTextBox

        '

        Me.VariableTextBox.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _

                    Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)

        Me.VariableTextBox.Location = New System.Drawing.Point(8, 48)

        Me.VariableTextBox.Multiline = True

        Me.VariableTextBox.Name = "VariableTextBox"

        Me.VariableTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both

        Me.VariableTextBox.Size = New System.Drawing.Size(168, 176)

        Me.VariableTextBox.TabIndex = 0

        Me.VariableTextBox.Text = ""

        '

        'CodeTextBox

        '

        Me.CodeTextBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _

                    Or System.Windows.Forms.AnchorStyles.Left) _

                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)

        Me.CodeTextBox.BackColor = System.Drawing.SystemColors.Info

        Me.CodeTextBox.Location = New System.Drawing.Point(192, 48)

        Me.CodeTextBox.Multiline = True

        Me.CodeTextBox.Name = "CodeTextBox"

        Me.CodeTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both

        Me.CodeTextBox.Size = New System.Drawing.Size(344, 176)

        Me.CodeTextBox.TabIndex = 1

        Me.CodeTextBox.Text = ""

        '

        'PropertyComboBox

        '

        Me.PropertyComboBox.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)

        Me.PropertyComboBox.BackColor = System.Drawing.SystemColors.Info

        Me.PropertyComboBox.Location = New System.Drawing.Point(88, 240)

        Me.PropertyComboBox.Name = "PropertyComboBox"

        Me.PropertyComboBox.Size = New System.Drawing.Size(224, 20)

        Me.PropertyComboBox.TabIndex = 2

        '

        'PropertyTextBox

        '

        Me.PropertyTextBox.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _

                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)

        Me.PropertyTextBox.BackColor = System.Drawing.SystemColors.Info

        Me.PropertyTextBox.Location = New System.Drawing.Point(8, 296)

        Me.PropertyTextBox.Multiline = True

        Me.PropertyTextBox.Name = "PropertyTextBox"

        Me.PropertyTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both

        Me.PropertyTextBox.Size = New System.Drawing.Size(536, 112)

        Me.PropertyTextBox.TabIndex = 3

        Me.PropertyTextBox.Text = ""

        '

        'SavePropertyButton

        '

        Me.SavePropertyButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)

        Me.SavePropertyButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat

        Me.SavePropertyButton.Location = New System.Drawing.Point(320, 240)

        Me.SavePropertyButton.Name = "SavePropertyButton"

        Me.SavePropertyButton.Size = New System.Drawing.Size(104, 32)

        Me.SavePropertyButton.TabIndex = 4

        Me.SavePropertyButton.Text = "保存样式"

        '

        'BuildCodeButton

        '

        Me.BuildCodeButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)

        Me.BuildCodeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat

        Me.BuildCodeButton.Location = New System.Drawing.Point(432, 240)

        Me.BuildCodeButton.Name = "BuildCodeButton"

        Me.BuildCodeButton.Size = New System.Drawing.Size(104, 32)

        Me.BuildCodeButton.TabIndex = 5

        Me.BuildCodeButton.Text = "生成代码"

        '

        'Label1

        '

        Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)

        Me.Label1.Location = New System.Drawing.Point(8, 240)

        Me.Label1.Name = "Label1"

        Me.Label1.Size = New System.Drawing.Size(80, 23)

        Me.Label1.TabIndex = 6

        Me.Label1.Text = "样式选择:"

        '

        'Label2

        '

        Me.Label2.Location = New System.Drawing.Point(8, 16)

        Me.Label2.Name = "Label2"

        Me.Label2.Size = New System.Drawing.Size(88, 23)

        Me.Label2.TabIndex = 7

        Me.Label2.Text = "变量框:"

        '

        'Label3

        '

        Me.Label3.Location = New System.Drawing.Point(192, 16)

        Me.Label3.Name = "Label3"

        Me.Label3.Size = New System.Drawing.Size(96, 23)

        Me.Label3.TabIndex = 8

        Me.Label3.Text = "代码框:"

        '

        'Label4

        '

        Me.Label4.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)

【上篇】
【下篇】

抱歉!评论已关闭.