📄 fclsviewer.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Picture_Viewer
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class fclsViewer : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnSelectPicture;
private System.Windows.Forms.Button btnQuit;
private System.Windows.Forms.PictureBox picShowPicture;
private System.Windows.Forms.OpenFileDialog ofdSelectPicture;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public fclsViewer()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(fclsViewer));
this.btnSelectPicture = new System.Windows.Forms.Button();
this.btnQuit = new System.Windows.Forms.Button();
this.picShowPicture = new System.Windows.Forms.PictureBox();
this.ofdSelectPicture = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout();
//
// btnSelectPicture
//
this.btnSelectPicture.Location = new System.Drawing.Point(301, 10);
this.btnSelectPicture.Name = "btnSelectPicture";
this.btnSelectPicture.Size = new System.Drawing.Size(85, 23);
this.btnSelectPicture.TabIndex = 0;
this.btnSelectPicture.Text = "Select Picture";
this.btnSelectPicture.Click += new System.EventHandler(this.btnSelectPicture_Click);
//
// btnQuit
//
this.btnQuit.Location = new System.Drawing.Point(301, 40);
this.btnQuit.Name = "btnQuit";
this.btnQuit.Size = new System.Drawing.Size(85, 23);
this.btnQuit.TabIndex = 1;
this.btnQuit.Text = "Quit";
this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);
//
// picShowPicture
//
this.picShowPicture.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picShowPicture.Location = new System.Drawing.Point(8, 8);
this.picShowPicture.Name = "picShowPicture";
this.picShowPicture.Size = new System.Drawing.Size(282, 275);
this.picShowPicture.TabIndex = 2;
this.picShowPicture.TabStop = false;
//
// ofdSelectPicture
//
this.ofdSelectPicture.Filter = "Windows Bitmaps|*.BMP|JPEG Files|*.JPG ";
this.ofdSelectPicture.Title = "Select Picture";
//
// fclsViewer
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(392, 291);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.picShowPicture,
this.btnQuit,
this.btnSelectPicture});
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "fclsViewer";
this.Text = "Picture Viewer";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new fclsViewer());
}
private void btnSelectPicture_Click(object sender, System.EventArgs e)
{
if (ofdSelectPicture.ShowDialog() == DialogResult.OK)
{
// Load the picture into the picture box.
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName);
// Show the name of the file in the form's caption.
this.Text = String.Concat("Picture Viewer (" + ofdSelectPicture.FileName + ")");
}
}
private void btnQuit_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -