Class HexView
public class HexView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IDesignable
- Inheritance
-
HexView
- Implements
- Inherited Members
Remarks
HexView provides a hex editor on top of a seekable Stream with the left side showing the hex values of the bytes in the Stream and the right side showing the contents (filtered to non-control sequence ASCII characters).
Users can switch from one side to the other by using the tab key.
To enable editing, set AllowEdits to true. When AllowEdits is true the user can make changes to the hexadecimal values of the Stream. Any changes are tracked in the Edits property (a SortedDictionary<TKey, TValue>) indicating the position where the changes were made and the new values. A convenience method, ApplyEdits(Stream?) will apply the edits to the Stream.
Control the byte at the caret for editing by setting the Address property to an offset in the stream.
Control the first byte shown by setting the DisplayStart property to an offset in the stream.
Constructors
- HexView(Stream?)
Initializes a HexView class.
Properties
- AddressWidth
Gets or sets the width of the Address column on the left. Set to 0 to hide. The default is 8.
- AllowEdits
Gets or sets whether this HexView allows editing of the Stream of the underlying Stream.
- BytesPerLine
The bytes length per line.
- DisplayStart
Sets or gets the offset into the Stream that will be displayed at the top of the HexView.
- Edits
Gets a SortedDictionary<TKey, TValue> describing the edits done to the HexView. Each Key indicates an offset where an edit was made and the Value is the changed byte.
- Position
Gets the current edit position.
- Source
Sets or gets the Stream the HexView is operating on; the stream must support seeking ( CanSeek == true).
Methods
- ApplyEdits(Stream?)
Applies and edits made to the Stream and resets the contents of the Edits property.
- DiscardEdits()
Discards the edits made to the Stream by resetting the contents of the Edits property.
- OnAdvancingFocus(NavigationDirection, TabBehavior?)
Called when AdvanceFocus(NavigationDirection, TabBehavior?) is about to advance focus.
- OnDrawingContent()
Called when the View's content is to be drawn. The default implementation does nothing.
- OnKeyDownNotHandled(Key)
Called when the user has pressed key it wasn't handled by KeyDown and was not bound to a key binding.
- OnMouseEvent(MouseEventArgs)
Called when a mouse event occurs within the view's Viewport.
- PositionCursor()
Positions the cursor in the right position based on the currently focused view in the chain.
- RaiseEdited(HexViewEditEventArgs)
Raises the Edited event.
- RaisePositionChanged()
Call this when Position (and Address) has changed. Raises the PositionChanged event.