⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmimageviewer.vb

📁 how to use regular expressions
💻 VB
字号:
'Copyright (C) 2002 Microsoft Corporation
'All rights reserved.
'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
'EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF 
'MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

'Requires the Trial or Release version of Visual Studio .NET Professional (or greater).

Option Strict On

Public Class frmImageViewer
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    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

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents lblImageFilename As System.Windows.Forms.Label
    Friend WithEvents btnClose As System.Windows.Forms.Button
    Friend WithEvents picImage As System.Windows.Forms.PictureBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.picImage = New System.Windows.Forms.PictureBox()
        Me.lblImageFilename = New System.Windows.Forms.Label()
        Me.btnClose = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'picImage
        '
        Me.picImage.BackColor = System.Drawing.SystemColors.Window
        Me.picImage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.picImage.Location = New System.Drawing.Point(13, 16)
        Me.picImage.Name = "picImage"
        Me.picImage.Size = New System.Drawing.Size(392, 248)
        Me.picImage.TabIndex = 0
        Me.picImage.TabStop = False
        '
        'lblImageFilename
        '
        Me.lblImageFilename.Location = New System.Drawing.Point(8, 272)
        Me.lblImageFilename.Name = "lblImageFilename"
        Me.lblImageFilename.Size = New System.Drawing.Size(400, 32)
        Me.lblImageFilename.TabIndex = 1
        Me.lblImageFilename.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'btnClose
        '
        Me.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnClose.Location = New System.Drawing.Point(330, 314)
        Me.btnClose.Name = "btnClose"
        Me.btnClose.TabIndex = 2
        Me.btnClose.Text = "Close"
        '
        'frmImageViewer
        '
        Me.AcceptButton = Me.btnClose
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.CancelButton = Me.btnClose
        Me.ClientSize = New System.Drawing.Size(416, 350)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnClose, Me.lblImageFilename, Me.picImage})
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmImageViewer"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "frmImageViewer"
        Me.ResumeLayout(False)

    End Sub

#End Region

    ' This method overloads the default Show method so that an argument
    ' can be passed for displaying the image based on a Stream returned
    ' by GetHttpStream() on frmMain.
    Public Overloads Sub Show(ByVal strImgSrc As String)
        Dim frmMain As New frmMain()

        With picImage
            Try
                ' Set the PictureBox Image property to the Image generated by
                ' the Http response stream.
                .Image = Image.FromStream(frmMain.GetHttpStream(strImgSrc))
            Catch exp As Exception
                MsgBox(exp.ToString, MsgBoxStyle.Critical, Me.Text)
            End Try

            .SizeMode = PictureBoxSizeMode.CenterImage
        End With

        lblImageFilename.Text = strImgSrc

        Me.Show()
        Application.DoEvents()
    End Sub

    ' Handles the "Close" button Click event. Hides the Form.
    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Hide()
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -