public HexEditor() { BackgroundColor = Color.FromBytes(0, 0, 0); CanGetFocus = true; HexEditorData = new HexEditorData(); HexEditorData.EditMode = new SimpleEditMode(); HexEditorData.Caret.Changed += delegate { if (!HexEditorData.Caret.PreserveSelection) { HexEditorData.ClearSelection(); } RequestResetCaretBlink(); if (HexEditorData.Caret.AutoScrollToCaret) { ScrollToCaret(); } RepaintLine(HexEditorData.Caret.Line); }; HexEditorData.Caret.OffsetChanged += delegate(object sender, CaretLocationEventArgs e) { if (!HexEditorData.Caret.PreserveSelection) { HexEditorData.ClearSelection(); } RequestResetCaretBlink(); if (HexEditorData.Caret.AutoScrollToCaret) { ScrollToCaret(); } RepaintLine(e.OldOffset / BytesInRow); RepaintLine(HexEditorData.Caret.Line); }; HexEditorData.Undone += delegate { PurgeLayoutCaches(); Repaint(); }; HexEditorData.Redone += delegate { PurgeLayoutCaches(); Repaint(); }; HexEditorData.SelectionChanged += HexEditorDataSelectionChanged; HexEditorData.Replaced += delegate(object sender, ReplaceEventArgs e) { if (e.Count > 0) { PurgeLayoutCaches(); Repaint(); } }; style = new HexEditorStyle(); iconMargin = new IconMargin(this); margins.Add(iconMargin); gutterMargin = new GutterMargin(this); margins.Add(gutterMargin); hexEditorMargin = new HexEditorMargin(this); margins.Add(hexEditorMargin); textEditorMargin = new TextEditorMargin(this); margins.Add(textEditorMargin); margins.Add(new EmptySpaceMargin(this)); HexEditorData.UpdateRequested += delegate { HexEditorData.Updates.ForEach(update => update.AddRedraw(this)); HexEditorData.Updates.Clear(); }; Options = HexEditorOptions.DefaultOptions; Options.Changed += OptionsChanged; }