📄 form1.cs
字号:
// toolBarButton1
//
this.toolBarButton1.ImageIndex = 0;
//
// toolBarButton2
//
this.toolBarButton2.ImageIndex = 1;
//
// toolBarButton3
//
this.toolBarButton3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton4
//
this.toolBarButton4.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton5
//
this.toolBarButton5.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton6
//
this.toolBarButton6.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton9
//
this.toolBarButton9.DropDownMenu = this.contextMenu1;
this.toolBarButton9.ImageIndex = 5;
this.toolBarButton9.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem11,
this.menuItem12,
this.menuItem13});
this.contextMenu1.Popup += new System.EventHandler(this.contextMenu1_Popup);
//
// menuItem11
//
this.menuItem11.Index = 0;
this.menuItem11.Text = "JPEG";
this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
//
// menuItem12
//
this.menuItem12.Index = 1;
this.menuItem12.Text = "MPEG Iframe";
this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
//
// menuItem13
//
this.menuItem13.Index = 2;
this.menuItem13.Text = "MPEG Sequence";
this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
//
// imageList1
//
this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 473);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel1,
this.statusBarPanel2,
this.statusBarPanel3});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(576, 24);
this.statusBar1.TabIndex = 1;
this.statusBar1.Text = "statusBar1";
//
// statusBarPanel1
//
this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanel1.Text = "statusBarPanel1";
this.statusBarPanel1.Width = 454;
//
// statusBarPanel2
//
this.statusBarPanel2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
this.statusBarPanel2.Text = "XBlock:";
this.statusBarPanel2.Width = 53;
//
// statusBarPanel3
//
this.statusBarPanel3.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
this.statusBarPanel3.Text = "YBlock:";
this.statusBarPanel3.Width = 53;
//
// userControl11
//
this.userControl11.Dock = System.Windows.Forms.DockStyle.Fill;
this.userControl11.Location = new System.Drawing.Point(0, 25);
this.userControl11.Name = "userControl11";
this.userControl11.Size = new System.Drawing.Size(576, 448);
this.userControl11.TabIndex = 2;
this.userControl11.Load += new System.EventHandler(this.userControl11_Load);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(576, 497);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.userControl11,
this.statusBar1,
this.toolBar1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
// File Open
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() != DialogResult.OK)
return;
menuItem8.Enabled = menuItem9.Enabled = menuItem10.Enabled = true;
menuItem11.Enabled = menuItem12.Enabled = menuItem13.Enabled = true;
try {userControl11.LoadPictureBox1(dlg.FileName);}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error On File Open");
return;
}
statusBarPanel1.Text = "Click on Loaded Image to zoom in";
userControl11.textBox1.Visible = true;
userControl11.textBox2.Visible = true;
userControl11.textBox3.Visible = true;
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void menuItem5_Click(object sender, System.EventArgs e)
{
userControl11.mode = 8; // JPEG Mode
menuItem5.Checked = true;
menuItem6.Checked = false;
}
private void menuItem6_Click(object sender, System.EventArgs e)
{
userControl11.mode = 16; // MPEG Mode
menuItem5.Checked = false;
menuItem6.Checked = true;
}
private void menuItem10_Click(object sender, System.EventArgs e)
{
// Write MPEG Sequence
FrameNumberDialog dlg = new FrameNumberDialog();
dlg.ShowDialog();
userControl11.nPictures = dlg.numberOfFrames;
userControl11.WriteMPEGSequence();
}
private void menuItem9_Click(object sender, System.EventArgs e)
{
// Write MPEG I Frame
userControl11.nPictures = 1;
userControl11.WriteMPEGSequence();
}
private void menuItem8_Click(object sender, System.EventArgs e)
{
// Write JPEG
userControl11.WriteJPEG();
}
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if (e.Button == toolBarButton1)
menuItem2_Click(sender, e);
else if (e.Button == toolBarButton2)
menuItem3_Click(sender, e);
}
private void contextMenu1_Popup(object sender, System.EventArgs e)
{}
private void menuItem11_Click(object sender, System.EventArgs e)
{
menuItem8_Click(sender, e); // Write JPEG
}
private void menuItem12_Click(object sender, System.EventArgs e)
{
menuItem9_Click(sender, e); // Write MPEG IFrame
}
private void menuItem13_Click(object sender, System.EventArgs e)
{
menuItem10_Click(sender, e); // Write MPEG Sequence
}
private void menuItem16_Click(object sender, System.EventArgs e)
{
AboutDialog dlg = new AboutDialog();
dlg.ShowDialog();
}
private void userControl11_Load(object sender, System.EventArgs e)
{}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -