📄 bitmapmaniptestform.cs
字号:
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace apocryph.BitmapManip
{
/// <summary>
/// Summary description for BitmapManipTestForm.
/// </summary>
public class BitmapManipTestForm : System.Windows.Forms.Form {
private System.Windows.Forms.Label inputLbl;
private System.Windows.Forms.TextBox inputTextBox;
private System.Windows.Forms.Button fromFileBtn;
private System.Windows.Forms.Button fromUrlBtn;
private System.Windows.Forms.PictureBox imgPicBox;
private System.Windows.Forms.Button rotate90Btn;
private System.Windows.Forms.Button rotate180Btn;
private System.Windows.Forms.Button rotate270;
private System.Windows.Forms.Button scaleBtn;
private System.Windows.Forms.TextBox scaleFactorTextBox;
private System.Windows.Forms.Button resizeBtn;
private System.Windows.Forms.TextBox resizeWidthTextBox;
private System.Windows.Forms.TextBox resizeHeightTextBox;
private System.Windows.Forms.Label xLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox thumbnailHeightTextBox;
private System.Windows.Forms.TextBox thumbnailWidthTextBox;
private System.Windows.Forms.Button thumbnailBtn;
private System.Windows.Forms.Button reverseBtn;
private System.Windows.Forms.Button flipBtn;
private System.Windows.Forms.Button cropBtn;
private System.Windows.Forms.TextBox bottomRightYTextBox;
private System.Windows.Forms.TextBox bottomRightXTextBox;
private System.Windows.Forms.TextBox topLeftYTextBox;
private System.Windows.Forms.TextBox topLeftXTextBox;
private System.Windows.Forms.Label topLeftLbl;
private System.Windows.Forms.Label bottomRightLbl;
private System.Windows.Forms.Button overlayBtn;
private System.Windows.Forms.TextBox overlayImgUrlTextBox;
private System.Windows.Forms.Label overlayImgLbl;
private System.Windows.Forms.Label alphaLbl;
private System.Windows.Forms.TextBox alphaTextBox;
private System.Windows.Forms.Label overlayPositionLbl;
private System.Windows.Forms.ComboBox overlayPositionCombo;
private System.Windows.Forms.Button revertBtn;
private System.Windows.Forms.Label currentFormatLbl;
private System.Windows.Forms.Label currentFormatValueLbl;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button jpgBtn;
private System.Windows.Forms.Label jpgQualityLbl;
private System.Windows.Forms.TextBox jpgQualityTextBox;
private System.Windows.Forms.Button bmpBtn;
private System.Windows.Forms.Button gifBtn;
private System.Windows.Forms.Button tiffBtn;
private System.Windows.Forms.Button pngBtn;
private System.Windows.Forms.Label imgDimensionsLbl;
private System.Drawing.Bitmap originalBitmap;
private System.Drawing.Bitmap modifiedBitmap;
private System.Drawing.Bitmap OverlayBitmap;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox tiffCompressionCombo;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.Run(new BitmapManipTestForm());
}
public BitmapManipTestForm() {
//
// 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() {
this.inputLbl = new System.Windows.Forms.Label();
this.inputTextBox = new System.Windows.Forms.TextBox();
this.fromFileBtn = new System.Windows.Forms.Button();
this.fromUrlBtn = new System.Windows.Forms.Button();
this.imgPicBox = new System.Windows.Forms.PictureBox();
this.rotate90Btn = new System.Windows.Forms.Button();
this.rotate180Btn = new System.Windows.Forms.Button();
this.rotate270 = new System.Windows.Forms.Button();
this.scaleBtn = new System.Windows.Forms.Button();
this.scaleFactorTextBox = new System.Windows.Forms.TextBox();
this.resizeBtn = new System.Windows.Forms.Button();
this.resizeWidthTextBox = new System.Windows.Forms.TextBox();
this.resizeHeightTextBox = new System.Windows.Forms.TextBox();
this.xLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.thumbnailHeightTextBox = new System.Windows.Forms.TextBox();
this.thumbnailWidthTextBox = new System.Windows.Forms.TextBox();
this.thumbnailBtn = new System.Windows.Forms.Button();
this.reverseBtn = new System.Windows.Forms.Button();
this.flipBtn = new System.Windows.Forms.Button();
this.cropBtn = new System.Windows.Forms.Button();
this.bottomRightYTextBox = new System.Windows.Forms.TextBox();
this.bottomRightXTextBox = new System.Windows.Forms.TextBox();
this.topLeftYTextBox = new System.Windows.Forms.TextBox();
this.topLeftXTextBox = new System.Windows.Forms.TextBox();
this.topLeftLbl = new System.Windows.Forms.Label();
this.bottomRightLbl = new System.Windows.Forms.Label();
this.overlayBtn = new System.Windows.Forms.Button();
this.overlayImgUrlTextBox = new System.Windows.Forms.TextBox();
this.overlayImgLbl = new System.Windows.Forms.Label();
this.alphaLbl = new System.Windows.Forms.Label();
this.alphaTextBox = new System.Windows.Forms.TextBox();
this.overlayPositionLbl = new System.Windows.Forms.Label();
this.overlayPositionCombo = new System.Windows.Forms.ComboBox();
this.revertBtn = new System.Windows.Forms.Button();
this.currentFormatLbl = new System.Windows.Forms.Label();
this.currentFormatValueLbl = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.jpgBtn = new System.Windows.Forms.Button();
this.jpgQualityLbl = new System.Windows.Forms.Label();
this.jpgQualityTextBox = new System.Windows.Forms.TextBox();
this.bmpBtn = new System.Windows.Forms.Button();
this.gifBtn = new System.Windows.Forms.Button();
this.tiffBtn = new System.Windows.Forms.Button();
this.pngBtn = new System.Windows.Forms.Button();
this.imgDimensionsLbl = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.tiffCompressionCombo = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// inputLbl
//
this.inputLbl.Location = new System.Drawing.Point(8, 8);
this.inputLbl.Name = "inputLbl";
this.inputLbl.TabIndex = 0;
this.inputLbl.Text = "Input:";
//
// inputTextBox
//
this.inputTextBox.Location = new System.Drawing.Point(48, 5);
this.inputTextBox.Name = "inputTextBox";
this.inputTextBox.Size = new System.Drawing.Size(288, 20);
this.inputTextBox.TabIndex = 1;
this.inputTextBox.Text = "http://www.ex-astris-scientia.org/gallery/stmagazine/worf-martok1.jpg";
//
// fromFileBtn
//
this.fromFileBtn.Location = new System.Drawing.Point(352, 6);
this.fromFileBtn.Name = "fromFileBtn";
this.fromFileBtn.TabIndex = 2;
this.fromFileBtn.Text = "From &File";
this.fromFileBtn.Click += new System.EventHandler(this.fromFileBtn_Click);
//
// fromUrlBtn
//
this.fromUrlBtn.Location = new System.Drawing.Point(440, 6);
this.fromUrlBtn.Name = "fromUrlBtn";
this.fromUrlBtn.TabIndex = 3;
this.fromUrlBtn.Text = "From &Url";
this.fromUrlBtn.Click += new System.EventHandler(this.fromUrlBtn_Click);
//
// imgPicBox
//
this.imgPicBox.Location = new System.Drawing.Point(8, 288);
this.imgPicBox.Name = "imgPicBox";
this.imgPicBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.imgPicBox.TabIndex = 4;
this.imgPicBox.TabStop = false;
//
// rotate90Btn
//
this.rotate90Btn.Location = new System.Drawing.Point(8, 40);
this.rotate90Btn.Name = "rotate90Btn";
this.rotate90Btn.TabIndex = 5;
this.rotate90Btn.Text = "Rotate 90";
this.rotate90Btn.Click += new System.EventHandler(this.rotate90Btn_Click);
//
// rotate180Btn
//
this.rotate180Btn.Location = new System.Drawing.Point(8, 72);
this.rotate180Btn.Name = "rotate180Btn";
this.rotate180Btn.TabIndex = 6;
this.rotate180Btn.Text = "Rotate 180";
this.rotate180Btn.Click += new System.EventHandler(this.rotate180Btn_Click);
//
// rotate270
//
this.rotate270.Location = new System.Drawing.Point(8, 104);
this.rotate270.Name = "rotate270";
this.rotate270.TabIndex = 7;
this.rotate270.Text = "Rotate 270";
this.rotate270.Click += new System.EventHandler(this.rotate270_Click);
//
// scaleBtn
//
this.scaleBtn.Location = new System.Drawing.Point(96, 40);
this.scaleBtn.Name = "scaleBtn";
this.scaleBtn.TabIndex = 8;
this.scaleBtn.Text = "Scale By:";
this.scaleBtn.Click += new System.EventHandler(this.scaleBtn_Click);
//
// scaleFactorTextBox
//
this.scaleFactorTextBox.Location = new System.Drawing.Point(176, 40);
this.scaleFactorTextBox.Name = "scaleFactorTextBox";
this.scaleFactorTextBox.TabIndex = 9;
this.scaleFactorTextBox.Text = "1.0";
//
// resizeBtn
//
this.resizeBtn.Location = new System.Drawing.Point(96, 72);
this.resizeBtn.Name = "resizeBtn";
this.resizeBtn.TabIndex = 10;
this.resizeBtn.Text = "Resize To:";
this.resizeBtn.Click += new System.EventHandler(this.resizeBtn_Click);
//
// resizeWidthTextBox
//
this.resizeWidthTextBox.Location = new System.Drawing.Point(176, 72);
this.resizeWidthTextBox.Name = "resizeWidthTextBox";
this.resizeWidthTextBox.Size = new System.Drawing.Size(40, 20);
this.resizeWidthTextBox.TabIndex = 11;
this.resizeWidthTextBox.Text = "0";
//
// resizeHeightTextBox
//
this.resizeHeightTextBox.Location = new System.Drawing.Point(232, 72);
this.resizeHeightTextBox.Name = "resizeHeightTextBox";
this.resizeHeightTextBox.Size = new System.Drawing.Size(40, 20);
this.resizeHeightTextBox.TabIndex = 12;
this.resizeHeightTextBox.Text = "0";
//
// xLabel
//
this.xLabel.Location = new System.Drawing.Point(216, 75);
this.xLabel.Name = "xLabel";
this.xLabel.Size = new System.Drawing.Size(16, 23);
this.xLabel.TabIndex = 13;
this.xLabel.Text = "x";
//
// label1
//
this.label1.Location = new System.Drawing.Point(216, 104);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(16, 23);
this.label1.TabIndex = 17;
this.label1.Text = "x";
//
// thumbnailHeightTextBox
//
this.thumbnailHeightTextBox.Location = new System.Drawing.Point(232, 104);
this.thumbnailHeightTextBox.Name = "thumbnailHeightTextBox";
this.thumbnailHeightTextBox.Size = new System.Drawing.Size(40, 20);
this.thumbnailHeightTextBox.TabIndex = 16;
this.thumbnailHeightTextBox.Text = "50";
//
// thumbnailWidthTextBox
//
this.thumbnailWidthTextBox.Location = new System.Drawing.Point(176, 104);
this.thumbnailWidthTextBox.Name = "thumbnailWidthTextBox";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -