Implementing Custom Buttonbar in TX TEXT CONTROL

I am developing an office suite and I am trying to write a custom button bar for TX TEXT CONTROL. The default ones lacked customization options and some missing features. I am using a toolstrip(duh.) But I can't figure out the code. I need to know how to load fonts, text sizes and text style. (Using combobox) I am using VB.Net 2017. So please help me!
(P.S I was using my phone to type this and I kinda rushed typing this. Please ignore any grammar errors)

Like 0 Dislike

Have you tried looking through the documentation: https://www.textcontrol.com/documentati … product=tx?

Like 0 Dislike

I tried this

Toolstripcombobox1.items = textcontrol1.getsupportedfonts

But It keeps on saying toolstripcombobox1.items is read only.

Like −1 Dislike

TX Text Control is very very limited. I recommend not using it. But anyway...
I don't know why you are using textcontrol1.getsupported fonts, just get the system's fonts and convert it into items. Here is some sample code:

Imports System.Drawing.Font
Imports System.Drawing.FontFamily
Imports System.Drawing.FontConverter
 
Public Class Form1
    Private Sub BindCombo()
        ComboBox1.DrawMode = DrawMode.OwnerDrawFixed
        ComboBox1.Font = New Font("Microsoft Sans Serif, 11.25pt", 11.25)
        ComboBox1.ItemHeight = 20
        Dim objFontFamily As FontFamily
        Dim objFontCollection As System.Drawing.Text.FontCollection
        Dim tempFont As Font
        objFontCollection = New System.Drawing.Text.InstalledFontCollection()
        For Each objFontFamily In objFontCollection.Families
            ComboBox1.Items.Add(objFontFamily.Name)
 
        Next
    End Sub
 
 
 
    Private Sub ComboBox1_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ComboBox1.DrawItem
        e.DrawBackground()
        If (e.State And DrawItemState.Focus) <> 0 Then
            e.DrawFocusRectangle()
        End If
        Dim objBrush As Brush = Nothing
        Try
            objBrush = New SolidBrush(e.ForeColor)
            Dim _FontName As String = ComboBox1.Items(e.Index)
            Dim _font As Font
            Dim _fontfamily = New FontFamily(_FontName)
            If _fontfamily.IsStyleAvailable(FontStyle.Regular) Then
                _font = New Font(_fontfamily, 14, FontStyle.Regular)
            ElseIf _fontfamily.IsStyleAvailable(FontStyle.Bold) Then
                _font = New Font(_fontfamily, 14, FontStyle.Bold)
            ElseIf _fontfamily.IsStyleAvailable(FontStyle.Italic) Then
                _font = New Font(_fontfamily, 14, FontStyle.Italic)
            End If
            e.Graphics.DrawString(_FontName, _font, objBrush, e.Bounds)
        Finally
            If objBrush IsNot Nothing Then
                objBrush.Dispose()
            End If
            objBrush = Nothing
        End Try
    End Sub
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BindCombo()
    End Sub
End Class

I personally use this and you can download the file from here:
http://www.vbforums.com/attachment.php? … 1333288337
source: http://www.vbforums.com/showthread.php? … -and-style

A post by brwck

Like +1 Dislike