void FindNext()
{
if (_findBuffer.Length == 0)
{
Find();
return;
}
// show cancel dialog
_formFindCancel = new FormFindCancel();
_formFindCancel.SetHexBox(hexBox1);
_formFindCancel.Closed += new EventHandler(FormFindCancel_Closed);
_formFindCancel.Show();
// block activation of main form
//Activated += new EventHandler(FocusToFormFindCancel);
// start find process
FindOptions fo = new FindOptions();
fo.Hex = _findBuffer;
fo.Type = FindType.Hex;
//long res = hexBox1.Find(_findBuffer, hexBox1.SelectionStart + hexBox1.SelectionLength);
long res = hexBox1.Find(fo);
_formFindCancel.Dispose();
// unblock activation of main form
//Activated -= new EventHandler(FocusToFormFindCancel);
if (res == -1) // -1 = no match
{
MessageBox.Show("Find reached end of file", "EDC15P Suite",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (res == -2) // -2 = find was aborted
{
return;
}
else // something was found
{
if (!hexBox1.Focused)
{
hexBox1.Focus();
}
}
ManageAbility();
}