public HexBoxControl()
{
Width = 200;
Height = 200;
Label fileOffsetLabel = new Label()
{
Location = new Point(3, 5),
Width = 60,
Text = "File Offset:",
};
fileOffsetBox = new TextBox()
{
Width = 100,
Location = new Point(fileOffsetLabel.Left + fileOffsetLabel.Width + 5, 2),
};
Label rvaOffsetLabel = new Label()
{
Location = new Point(fileOffsetBox.Right + 10, 5),
Width = 30,
Text = "RVA:",
};
rvaOffsetBox = new TextBox()
{
Width = 100,
Location = new Point(rvaOffsetLabel.Right + 5, 2),
};
Label vaOffsetLabel = new Label()
{
Location = new Point(rvaOffsetBox.Right + 10, 5),
Width = 30,
Text = "VA:",
};
vaOffsetBox = new TextBox()
{
Width = 100,
Location = new Point(vaOffsetLabel.Right + 5, 2),
};
targetSectionLabel = new Label()
{
Text = "Target Section:",
Location = new Point(vaOffsetBox.Right + 5, 5),
AutoSize = true,
};
hexBox = new HexBox()
{
Location = new Point(0, fileOffsetBox.Bottom + 7),
Width = this.Width,
Height = this.Height - (fileOffsetBox.Bottom + 7),
Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
StringViewVisible = true,
LineInfoVisible = true,
LineInfoForeColor = Color.Blue,
UseFixedBytesPerLine = true,
BytesPerLine = 16,
VScrollBarVisible = true,
};
this.Controls.AddRange(new Control[] {
fileOffsetLabel,
fileOffsetBox,
rvaOffsetLabel,
rvaOffsetBox,
vaOffsetLabel,
vaOffsetBox,
targetSectionLabel,
hexBox });
fileOffsetBox.Leave += fileOffsetBox_Leave;
fileOffsetBox.KeyUp += fileOffsetBox_KeyUp;
rvaOffsetBox.Leave += rvaOffsetBox_Leave;
rvaOffsetBox.KeyUp += rvaOffsetBox_KeyUp;
vaOffsetBox.Leave += vaOffsetBox_Leave;
vaOffsetBox.KeyUp += vaOffsetBox_KeyUp;
}