A universal ABOUT similar to Microsoft products

xiaoxiao2021-03-06  68

Renderings

Project assemblyinfo.vb content

Imports system.reflection

1.0.0

.0 ")>

Call the method in the main interface of the program:

Private sub aboutmenuitem_click (byvale as system.object, byval e as system.eventargs) Handles AboutmentMenuItem.click

DIM FRMABOUT AS New Lzmtw.about.aboutform (ME)

FRMabout.aboutinfo.image = image.fromfile (Application.Startuppath & "/../sea.jpg")

FRMabout.initaboutInfo ()

Frmabout.showdialog ()

End Sub

The following is the About class

Imports system.diagnostics

Imports system.reflection

Namespace lzmtw.about 'Reference, please keep this reference space name

Public Class AboutForm

Inherits System.Windows.Forms.form

#Region "Windows Form Designer Generated Code"

Public Sub New (Byval Mainform As Form)

Mybase.new ()

'This call is required for the Windows Form Designer.

InitializeComponent ()

'Add any initialization after INITIALIZECOMPONENT ()

M_aboutInfo = New AboutInfo (MainForm)

m_aboutinfo.icon = mainform.icon

'Update interface

INITABOUTINFO ()

End Sub

'Form rewriting Dispose to clean up the list of components.

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 Form Designer

Private Components as System.comPonentModel.icontainer

'Note: The following process is necessary for the Windows Form Designer.

'You can modify this process using the Windows Form Designer.

'Don't modify it using the code editor. Friend Withevents Productlabel as System.Windows.Forms.label

Friend Withevents Label1 As System.Windows.Forms.Label

Friend Withevents Label2 As System.Windows.Forms.Label

Friend withevents columnheader1 as system.windows.forms.columnheader

Friend Withevents ColumnHeader2 As System.Windows.Forms.columnHeader

Friend Withevents Label3 As System.Windows.Forms.label

Friend Withevents Groupbox1 As System.Windows.Forms.groupBox

Friend Withevents Okbutton as System.Windows.Forms.Button

Friend WitHevents Systeminfobutton as System.Windows.Forms.Button

Friend Withevents alarmlabel as system.windows.Forms.Label

Friend Withevents ImagePictureBox as system.windows.Forms.PictureBox

Friend Withevents UserTextBox as system.windows.Forms.TextBox

Friend Withevents AssemblyListView As System.Windows.Forms.ListView

Friend Withevents iCopictureBox as system.windows.Forms.PictureBox

Friend Withevents DescriptionTextBox as system.windows.Forms.TextBox

private subinitializecomponent ()

Dim Resources as system.resources.resourceManager = new system.resources.resourceManager (gettype (aboutform))

Me.ImagePictureBox = new system.windows.Forms.PictureBox

Me.ProductLabel = new system.windows.Forms.Label

Me.label1 = new system.windows.forms.label

Me.UsertextBox = new system.windows.Forms.TextBox

Me.Label2 = new system.windows.forms.label

Me.assemblyingListView = new system.windows.forms.listview

Me.ColumnHeader1 = new system.windows.forms.columnheader

Me.columnheader2 = new system.windows.Forms.columnHeader

Me.label3 = new system.windows.Forms.Label

Me.icopicturebox = new system.windows.Forms.PictureBox

Me.DescriptionTextBox = new system.windows.forms.textBoxme.groupBox1 = new system.windows.Forms.groupbox

Me.okbutton = new system.windows.Forms.Button

Me.systeminfobutton = new system.windows.Forms.Button

Me.AlarmLabel = New System.windows.Forms.Label

Me.suspendlayout ()

'

'ImagePicturebox

'

Me.ImagePictureBox.location = new system.drawing.point (8, 8)

Me.imagePictureBox.name = "imagePicturebox"

Me.ImagePictureBox.size = new system.drawing.size (88, 272)

Me.imagePictureBox.tabindex = 0

Me.imagePictureBox.Tabstop = false

'

'ProductLabel

'

Me.ProductLabel.Location = new system.drawing.point (104, 16)

Me.ProductLabel.name = "ProductLabel"

Me.ProductLabel.size = new system.drawing.size (400, 40)

Me.ProductLabel.TabINDEX = 1

'

'Label1

'

Me.Label1.Location = new system.drawing.point (104, 60)

Me.Label1.name = "label1"

Me.label1.size = new system.drawing.size (168, 16)

Me.Label1.tabindex = 3

Me.Label1.Text = "This product is all:"

'

'UserTextBox

'

Me.USERTEXTBOX.BACKCOLOR = system.drawing.systemcolors.Control

Me.UsertextBox.Borderstyle = System.Windows.Forms.Borderstyle.FixedsingLele

Me.USERTEXTBOX.ENABLED = FALSE

Me.UserTextBox.location = new system.drawing.point (104, 76)

Me.USERTEXTBOX.MULTILINE = TRUE

Me.UserTextBox.name = "UserTextBox"

Me.UserTextBox.readonly = TRUE

Me.USERTEXTBOX.SIZE = New System.drawing.size (400, 32)

Me.UserTextBox.tabindex = 4

Me.USERTEXTBOX.TEXT = "" "

'

'Label2

'

Me.label2.location = new system.drawing.point (104, 112)

Me.Label2.name = "label2"

Me.label2.size = new system.drawing.size (120, 16)

Me.Label2.tabindex = 5

Me.Label2.Text = "Quote Set:"

'

'Assemblylistview

'

Me.assemblyingListView.columns.addrange (new system.windows.forms.columnheader () {me.columnheader1, me.columnheader2})

Me.assemblyingListView.Location = New System.drawing.Point (104, 128)

Me.assemblyingListView.Name = "assemblylistview"

Me.assemblyingListView.Size = new system.drawing.size (400, 80)

Me.assemblyingListView.TabINDEX = 6

Me.assemblyingListView.view = system.windows.forms.view.details

'

'ColumnHeader1

'

Me.ColumnHeader1.text = "Project"

Me.columnheader1.width = 150

'

'ColumnHeader2

'

Me.ColumnHeader2.text = "Version"

Me.columnheader2.width = 150

'

'Label3

'

Me.label3.Location = new system.drawing.point (104, 216)

Me.label3.name = "label3"

Me.label3.size = new system.drawing.size (96, 16)

Me.label3.tabindex = 7

Me.Label3.Text = "Product Details:"

'

'Icopicturebox

'

Me.icopicturebox.location = new system.drawing.point (104, 240)

Me.icopicturebox.name = "iCopictureBox"

Me.icopicturebox.size = new system.drawing.size (40, 32)

Me.icopicturebox.tabindex = 8

Me.icopicturebox.tabstop = false

'

'DescriptionTextBox

'

Me.descriptionTextBox.location = new system.drawing.point (160, 240)

Me.descriptionTextBox.Multiline = true

Me.descriptionTextBox.Name = "DescriptionTextBox"

Me.descriptionTextBox.readonly = true

Me.descriptionTextBox.Scrollbars = system.windows.Forms.Scrollbars.Vertical

Me.descriptionTextBox.size = new system.drawing.size (352, 40)

Me.descriptionTextBox.TabINDEX = 9Me.DescriptionTextBox.text = ""

'

'Groupbox1

'

Me.GroupBox1.Location = new system.drawing.point (8, 280)

Me.GroupBox1.name = "groupbox1"

Me.GroupBox1.size = new system.drawing.size (504, 8)

Me.GroupBox1.tabindex = 11

Me.GroupBox1.tabstop = false

'

'Okbutton

'

Me.okbutton.dialogResult = System.Windows.Forms.DialogResult.ok

Me.okbutton.location = new system.drawing.point (408, 296)

Me.okbutton.name = "okbutton"

Me.okbutton.size = new system.drawing.size (104, 24)

Me.okbutton.tabindex = 12

Me.okbutton.text = "OK"

'

'SystemInfobutton

'

Me.systeminfobutton.location = new system.drawing.point (408, 328)

Me.systeminfobutton.name = "SystemInfobutton"

Me.systeminfobutton.size = new system.drawing.size (104, 24)

Me.systeminfobutton.tabindex = 13

Me.systeminfobutton.text = "System Information (& S)"

'

'Alarmlabel

'

Me.Alarmlabel.Location = new system.drawing.point (16, 296)

Me.AlarmlamLabel.name = "alarmlabel"

Me.alarmLabel.size = new system.drawing.size (368, 64)

Me.alarmLabel.TabINDEX = 14

'

'AboutForm

'

Me.acceptButton = me.okbutton

Me.autoscalebasesize = new system.drawing.size (6, 14)

Me.clientsize = new system.drawing.size (522, 370)

Me.Controls.add (me.alarmlabel)

Me.Controls.add (me.systeminfobutton)

Me.Controls.add (me.okbutton)

Me.Controls.add (me.groupbox1)

Me.Controls.add (me.descriptiontextbox)

Me.Controls.add (me.usertextbox)

Me.Controls.Add (Me.icopicturebox)

Me.Controls.add (me.label3)

Me.Controls.add (me.assemblyingListView)

Me.Controls.add (me.label2)

Me.Controls.add (me.label1) me.controls.add (me.productlabel)

Me.Controls.add (Me.ImagePicturebox)

Me.FormBorderstyle = system.windows.Forms.FormBorderstyle.fixedToolWindow

Me.icon = ctype (Resources.GetObject ("$ this.icon"), System.drawing.icon)

Me.Name = "aboutform"

Me.showintaskbar = false

Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

Me.Text = "Form1"

Me.ResumeLayout (false)

End Sub

#End region

Private M_AboutInfo As AboutInfo

Public Readonly Property AboutInfo () as AboutInfo

Get

Return M_AboutInfo

END GET

End Property

'If you update the information, call this method to update the interface.

Public subinitaboutinfo ()

With m_aboutinfo

Me.ProductLabel.Text = .product

Me.USERTEXTBOX.TEXT = .authorization

Me.descriptionTextBox.text = .description

IF ME

.Assemblylistview.Items.count = 0 THEN

For Each Item As Object In .assemblyItems

Me.assemblyingListView.Items.Add (New ListViewItem (CType (Item, String ()))))))))

NEXT

END IF

Me.imagePictureBox.Image = .image

Me.icopicturebox.image = ctype (.ICON.TOBITMAP, Image)

Me.alarmLabel.Text = .larmm

Me.Text = .text

End with

End Sub

'Calling system information

Private sub systeminfobutton_click (byval sender as system.object, byval e as system.eventargs) Handles SystemInfobutton.click

System.Diagnostics.Process.start ("msinfo32.exe")

End Sub

END CLASS

Public Class AboutInfo

Private M_TITLE AS STRING

Private m_description as string

Private M_Product As String

Private m_copyright as string

Private M_Version As String

Private M_User As String

Private m_organization as string

PRIVATE M_IMAGE AS Image

Private m_ICON as system.drawing.icon

Private M_Alarm as string = _

"Warning: This computer program is protected by copyright law and international treaty." & _ "Copies or disseminate this program without authorization (or any part), will be severely civilian and criminal sanctions," & _ _

"And will be prosecuted within the maximum level of law."

Private const text_declare as string = "About {0}"

Private const product_declare as string = "{0} version {1}" & vbcrf & "copyright {2}. All rights reserved

Private const authorization_declare as string = "{0}" & vbcrlf & "{1}"

Private Mmainform as Form

Private masserblynameversion as arraylist

'Mainform is the main form

Sub New (Byval Mainform As Form)

MMAINFORM = MainForm

Initialize ()

End Sub

Private subinitialize ()

'The name and version of the attraction

MassemblyNameversion = New ArrayList

For Each Refasm as askemblyingName In [Assembly] .getexecutingassembly.getreferenceDassemblies

Massemblynameversion.add (new string () {refasm.name, refasm.version.tostring})

NEXT

'Take project information from the assemblyinfo.vb file from the project of MainForm

Dim t as type = mmainform.gettype

'Take the assembly title

m_title = ctype (t.assembly.getcustomattributes (getty) (0) (0) (0), AssemblyTitleAttribute) .title

'Approach Description Information

M_Description = ctype (t.assembly.getcustomattributes (getty) (0) (0) (0) (0), AssemblyDescriptionAttribute) .description

'Take copyright information

M_copyright = ctype (t.assembly.getcustomattributes (assemblycopyrightattribute) (0) (0) (0), AssemblyCopyRighttattribute) .copyright

'Take the version information

m_version = t.assembly.getname.version.tostring

'Authorized information, please read it according to the specific situation, please

m_user = system.environment.username

m_organization = system.environment.machinename

End Sub

Public Readonly Property Description () AS STRING

Get

Return M_Description

END GET

End Property

Public Writeonly Property User () AS String

Set (Byval value as string) m_user = value

End set

End Property

Public Writeonly Property Organization () AS STRING

Set (byval value as string)

m_organization = value

End set

End Property

PUBLIC Property image () as image

Get

Return M_Image

END GET

Set (ByVal Value as Image)

m_image = value

End set

End Property

Public property icon () AS icon

Get

Return M_ICON

END GET

Set (Byval Value As Icon)

m_ICON = value

End set

End Property

Public property alarm () AS STRING

Get

RETURN M_Alarm

END GET

Set (byval value as string)

M_Alarm = Value

End set

End Property

Public Readonly Property AssemblyItems () AS Array

Get

Return MassemblyNameVersion.toArray

END GET

End Property

Public Readonly Property Text () AS String

Get

Return string.format (Text_Declare, m_title)

END GET

End Property

Public Readonly Property Product () AS STRING

Get

Return string.format (Product_Declare, m_title, m_version, m_copyright)

END GET

End Property

Public Readonly Property Authorization () AS STRING

Get

Return string.format (authorization_declare, m_user, m_organization)

END GET

End Property

END CLASS

End Namespace

转载请注明原文地址:https://www.9cbs.com/read-92253.html

New Post(0)