Beispiel #1
0
        private void TextViewControl_ViewChanged(object sender, EventArgs e)
        {
            //set status info
            try
            {
                var char_at_caret = TextViewControl.CharAtCaret;

                toolStripStatusLabelProcent.Text     = string.Format("{0:P}", TextViewControl.ViewPercent);
                toolStripStatusLabelCharAtCaret.Text = string.Format("[{0}] [U+{1:X4}]", char.GetUnicodeCategory(char_at_caret), char.ConvertToUtf32(char_at_caret.ToString(), 0));
                toolStripStatusLabelPosition.Text    = string.Format("{0:N0} / {1:N0}", TextViewControl.CharIndexAtCaret, TextViewControl.CharsTotal);

                var enc          = text_provider.GetEncoding();
                var char_bytes   = enc.GetBytes(new char[] { char_at_caret });
                var bytes_string = string.Empty;
                for (var i = 0; i < char_bytes.Length; i++)
                {
                    bytes_string = bytes_string + string.Format("{0:X2} ", char_bytes[i]);
                }
                toolStripStatusLabelBytes.Text = bytes_string;
            }
            catch (Exception ex)
            {
                //and fallback
                toolStripStatusLabelCharAtCaret.Text = ex.Message;
            }
        }