03-15-2012, 09:57 AM
(This post was last modified: 03-15-2012, 11:46 AM by AceInfinity.)
I didn't want to keep it up in PM's so i'm dragging this to the forum where it belongs:
There, custom color dialog that wraps selected text in color bbcode tags.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ColDlg As New ColorDialog
With ColDlg
.FullOpen = True
.ShowDialog()
End With
Dim HexColorVal As String = String.Format("{0:X2}{1:X2}{2:X2}", ColDlg.Color.R, ColDlg.Color.G, ColDlg.Color.B)
TextBox1.SelectedText = AddBBCode(TextBox1.SelectedText, "[color=#" & HexColorVal & "]", "[/color]")
End Sub
Private Function AddBBCode(ByVal StartTag As String, ByVal EndTag As String) As String
Dim L_ST As Integer = StartTag.Length
Return TextBox1.SelectedText.Insert(0, StartTag).Insert(TextBox1.SelectedText.Length + L_ST, EndTag)
End Function
There, custom color dialog that wraps selected text in color bbcode tags.