Is it possible to make only part of a control's text, or a string, bold? It looks like it's all or nothing. Thanks.
Printable View
Is it possible to make only part of a control's text, or a string, bold? It looks like it's all or nothing. Thanks.
not sure about textbox... but look into richtext box.
richNewCode.SelectionFont = New Font(richNewCode.SelectionFont.Name, cmbFont.SelectedIndex - 1, richNewCode.Font.Style.Bold)
Thanks, I can do the rich textbox, but am really looking for a label or string that can be used to set the label's text (or button, whatever). I tried bolding a selection in a richtextbox and setting a label's text to the that, but it lost the formatting.
You can , by drawing the string with DrawString function in the Graphics Class .
Thanks, Pirate. Never used that before. In the code below, I get an error "Expression does not produve a value" in the call to G.DrawString. Can you see what's wrong?
VB Code:
Private Sub cmdBold_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBold.Click Dim G As Graphics Dim F As New Font(Label1.Font.Name, Label1.Font.Size, FontStyle.Bold) Dim x, y As Integer Label1.Text = "Select a " x = Label1.Text.Length y = Label1.Height G = Me.CreateGraphics Label1.Text += G.DrawString("Project", F, New SolidBrush(Color.Black), x, y) End Sub
Here you are assigning a sub to text property of the textbox control . You can't do that but what do you want to do exactly ?Quote:
Originally posted by salvelinus
Thanks, Pirate. Never used that before. In the code below, I get an error "Expression does not produve a value" in the call to G.DrawString. Can you see what's wrong?
VB Code:
Label1.Text += G.DrawString("Project", F, New SolidBrush(Color.Black), x, y)
What I'm trying for is for a label text to look like:
Select a Project
Thanks.
Sample :Quote:
Originally posted by salvelinus
What I'm trying for is for a label text to look like:
Select a Project
Thanks.