ASCII HEX Editor 國外源碼可參考一下
源代码在线查看: form1.cs
/*
***************************************************************************
**
** Module: Form1.cs
**
** Description:
**
**
** Revision History:
** ------------------------------------------------------------------------
** Date Name Reason
** 9/20/2005 HGI Initial Creation
**
**
**
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using HexEdit;
namespace HexEditExample
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Splitter splitter1;
private HexEdit.HexEditBox m_edtHex;
private HexEdit.LinkedBox m_edtASCII;
private byte[] m_abyData = new byte[4096];
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
m_edtHex.InitializeComponent();
m_edtASCII.InitializeComponent();
m_edtHex.LinkDisplay(m_edtASCII);
m_edtHex.LoadData(m_abyData);
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.m_edtHex = new HexEdit.HexEditBox();
this.m_edtASCII = new LinkedBox();
this.splitter1 = new System.Windows.Forms.Splitter();
this.SuspendLayout();
//
// m_edtHex
//
this.m_edtHex.Dock = System.Windows.Forms.DockStyle.Left;
this.m_edtHex.Location = new System.Drawing.Point(0, 0);
this.m_edtHex.Name = "m_edtHex";
this.m_edtHex.Size = new System.Drawing.Size(168, 326);
this.m_edtHex.TabIndex = 0;
this.m_edtHex.Text = "richTextBox1";
//
// m_edtASCII
//
this.m_edtASCII.Dock = System.Windows.Forms.DockStyle.Fill;
this.m_edtASCII.Location = new System.Drawing.Point(168, 0);
this.m_edtASCII.Name = "m_edtASCII";
this.m_edtASCII.Size = new System.Drawing.Size(320, 326);
this.m_edtASCII.TabIndex = 1;
this.m_edtASCII.Text = "foo";
//
// splitter1
//
this.splitter1.Location = new System.Drawing.Point(168, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(1, 326);
this.splitter1.TabIndex = 2;
this.splitter1.TabStop = false;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(488, 326);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.m_edtASCII);
this.Controls.Add(this.m_edtHex);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}