📄 picturepreviewform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.IO;
using System.ComponentModel;
using System.Windows.Forms;
namespace NiceTracker.EventConfig
{
/// <summary>
/// Summary description for PicturePreviewForm.
/// </summary>
public class PicturePreviewForm : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBoxPreview;
private string m_filename = "";
public PicturePreviewForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
}
public PicturePreviewForm( string filename )
{
InitializeComponent();
m_filename = filename;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
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()
{
this.pictureBoxPreview = new System.Windows.Forms.PictureBox();
//
// pictureBoxPreview
//
this.pictureBoxPreview.Location = new System.Drawing.Point(8, 8);
this.pictureBoxPreview.Size = new System.Drawing.Size(224, 256);
//
// PicturePreviewForm
//
this.Controls.Add(this.pictureBoxPreview);
this.Text = "Preview";
this.Load += new EventHandler(PicturePreviewForm_Load);
}
#endregion
private void PicturePreviewForm_Load(object sender, EventArgs e)
{
if ( File.Exists( m_filename ) )
{
Bitmap image = new Bitmap( m_filename );
pictureBoxPreview.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBoxPreview.Visible = true;
pictureBoxPreview.BringToFront();
pictureBoxPreview.Image = (Image)image;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -