Write the text with the coefficient C₁, C₂, C₃ on the label

I need to write text with a coefficient like C 1, C 2, C 3 in the text of the label, so please tell me how can I write ???

thanks Shashi Jailval

+3
source share
4 answers

You need a font with glyphs for Unicode U + 2080 code pages for U + 2089 :

label1.Font = new Font("DejaVu Sans", 10);
label1.Text = "C₁";  // or "C\u2081"

(assuming WinForms)

+7
source

In WinForms, you need to emulate this with RichTextBox

// Appearance as a label
var subscriptFont = new System.Drawing.Font(
                        richTextBox1.Font.FontFamily, 
                        richTextBox1.Font.Size - 2);
richTextBox1.BackColor = System.Drawing.SystemColors.Control;
richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
richTextBox1.ReadOnly = true;
richTextBox1.Text = "C1, C2, C3";
// subscript 1
richTextBox1.Select(1, 1);
richTextBox1.SelectionCharOffset = -3;
richTextBox1.SelectionFont = subscriptFont;
// subscript 2
richTextBox1.Select(5, 1);
richTextBox1.SelectionCharOffset = -3;
richTextBox1.SelectionFont =subscriptFont;
// subscript 3
richTextBox1.Select(9, 1);
richTextBox1.SelectionCharOffset = -3;
richTextBox1.SelectionFont = subscriptFont;
subscriptFont.Dispose();
+3
source

, ...

+1

. .

( , , , ... UTF-8, ...)

# Winforms ? .

-3

All Articles