📄 form1.h
字号:
#include <fstream>
#include "stdafx.h"
#include <iostream>
# include "Image.h"
//#include "Image.h"
//################
/*int HEIGHT,WIDTH;
int OFFSET;
int ISIZE;
unsigned char *m_cHeaderData;
#pragma pack(2) /*2 byte packing */
/* typedef struct
{
unsigned short type;
unsigned long size;
unsigned short reserved1,reserved2;
unsigned long offset;
}Header;
#pragma pack() /* Default packing */
/* typedef struct
{
unsigned long size;
long width,height;
unsigned short planes;
unsigned short bits;
unsigned int compression;
unsigned int imagesize;
int xresolution,yresolution;
unsigned int ncolors;
unsigned int importantcolors;
}Infoheader;
Header headfirst;
Infoheader headsecond; */
//#########################
#pragma once
using namespace System::Runtime::InteropServices;
namespace t1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
typedef unsigned char uchar;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
System::String ^filename;
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
//Declare the OpenFileDialog as a new OpenFileDialog.
OpenFileDialog ^openFileDialog = gcnew OpenFileDialog();
//Declare the PictureBox as a new PictureBox
PictureBox ^picBox = gcnew PictureBox();
//Set the openFileDialog's Filter.
openFileDialog1->Filter = "Bitmap Image|*.bmp|Tiff Image|*.tiff|pgm Image|*.pgm";
//Set the openFileDialog's FileName to nothing.
openFileDialog1->FileName = "";
//Initialize label text to nothing.
label2->Text = "";
label6->Text = "";
label4->Text = "";
label8->Text = "";
lblHeight->Text = "";
lblWidth->Text = "";
label11->Visible = false;
btnStat->Enabled = false;
lblMean->Visible = false;
lblMedian->Visible = false;
lblMode->Visible = false;
lblStdv->Visible = false;
pnlStat->Visible = false;
pnlFilter->Visible = false;
pnlBottom->Visible = true;
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
protected:
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::Panel^ panel1;
private: System::Windows::Forms::PictureBox^ pictureBox1;
private: System::Windows::Forms::Panel^ pnlMain;
private: System::Windows::Forms::Panel^ panel4;
private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ openToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ saveToolStripMenuItem;
private: System::Windows::Forms::Button^ btnStat;
private: System::Windows::Forms::Panel^ panel3;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ lblMean;
private: System::Windows::Forms::Label^ lblWidth;
private: System::Windows::Forms::Label^ label11;
private: System::Windows::Forms::Label^ lblHeight;
private: System::Windows::Forms::Label^ label9;
private: System::Windows::Forms::Label^ label8;
private: System::Windows::Forms::Label^ lblStdv;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::Label^ lblMedian;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Label^ lblMode;
private: System::Windows::Forms::Panel^ pnlStat;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Panel^ pnlBottom;
private: System::Windows::Forms::Button^ btnLine;
private: System::Windows::Forms::Button^ btnHistogram;
private: System::Windows::Forms::Button^ btnFilter;
private: System::Windows::Forms::Button^ btnEdge;
private: System::Windows::Forms::Panel^ pnlFilter;
private: System::Windows::Forms::Button^ btnMode;
private: System::Windows::Forms::Button^ btnMedian;
private: System::Windows::Forms::Button^ btnMean;
private: System::Windows::Forms::Button^ btnFilMain;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma 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>
void InitializeComponent(void)
{
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->pnlStat = (gcnew System::Windows::Forms::Panel());
this->label1 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->pnlFilter = (gcnew System::Windows::Forms::Panel());
this->btnFilMain = (gcnew System::Windows::Forms::Button());
this->btnMode = (gcnew System::Windows::Forms::Button());
this->btnMedian = (gcnew System::Windows::Forms::Button());
this->btnMean = (gcnew System::Windows::Forms::Button());
this->pnlMain = (gcnew System::Windows::Forms::Panel());
this->btnFilter = (gcnew System::Windows::Forms::Button());
this->btnEdge = (gcnew System::Windows::Forms::Button());
this->btnLine = (gcnew System::Windows::Forms::Button());
this->btnHistogram = (gcnew System::Windows::Forms::Button());
this->btnStat = (gcnew System::Windows::Forms::Button());
this->panel4 = (gcnew System::Windows::Forms::Panel());
this->lblWidth = (gcnew System::Windows::Forms::Label());
this->label11 = (gcnew System::Windows::Forms::Label());
this->lblHeight = (gcnew System::Windows::Forms::Label());
this->label9 = (gcnew System::Windows::Forms::Label());
this->panel3 = (gcnew System::Windows::Forms::Panel());
this->label8 = (gcnew System::Windows::Forms::Label());
this->lblStdv = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->lblMedian = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->lblMode = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->lblMean = (gcnew System::Windows::Forms::Label());
this->pnlBottom = (gcnew System::Windows::Forms::Panel());
this->menuStrip1->SuspendLayout();
this->panel1->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
this->pnlStat->SuspendLayout();
this->pnlFilter->SuspendLayout();
this->pnlMain->SuspendLayout();
this->panel4->SuspendLayout();
this->panel3->SuspendLayout();
this->SuspendLayout();
//
// openFileDialog1
//
this->openFileDialog1->FileName = L"openFileDialog1";
//
// menuStrip1
//
this->menuStrip1->AllowDrop = true;
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->fileToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->RenderMode = System::Windows::Forms::ToolStripRenderMode::Professional;
this->menuStrip1->ShowItemToolTips = true;
this->menuStrip1->Size = System::Drawing::Size(727, 24);
this->menuStrip1->TabIndex = 2;
this->menuStrip1->Text = L"menuStrip1";
this->menuStrip1->ItemClicked += gcnew System::Windows::Forms::ToolStripItemClickedEventHandler(this, &Form1::menuStrip1_ItemClicked);
//
// fileToolStripMenuItem
//
this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->openToolStripMenuItem,
this->saveToolStripMenuItem});
this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
this->fileToolStripMenuItem->Text = L"File";
this->fileToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fileToolStripMenuItem_Click);
//
// openToolStripMenuItem
//
this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
this->openToolStripMenuItem->Size = System::Drawing::Size(103, 22);
this->openToolStripMenuItem->Text = L"Open";
this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this->saveToolStripMenuItem->Name = L"saveToolStripMenuItem";
this->saveToolStripMenuItem->Size = System::Drawing::Size(103, 22);
this->saveToolStripMenuItem->Text = L"Save";
//
// panel1
//
this->panel1->BackColor = System::Drawing::Color::PapayaWhip;
this->panel1->Controls->Add(this->pictureBox1);
this->panel1->Location = System::Drawing::Point(13, 40);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(537, 355);
this->panel1->TabIndex = 3;
//
// pictureBox1
//
this->pictureBox1->Location = System::Drawing::Point(-1, 0);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(538, 356);
this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->pictureBox1->TabIndex = 0;
this->pictureBox1->TabStop = false;
//
// pnlStat
//
this->pnlStat->BackColor = System::Drawing::SystemColors::GradientActiveCaption;
this->pnlStat->Controls->Add(this->label1);
this->pnlStat->Controls->Add(this->button1);
this->pnlStat->Location = System::Drawing::Point(0, 1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -