none
ComboBox et rtb RRS feed

  • Question

  • Salut tout le monde
    Bonne journée

    Petit probleme de memoire et je ne l'ai pas guarder dans mes snippets

    la facon de selectionner un fontname et lappliquer a un rtb j'y arrive plus

    Voici ce que jUtilise

     

    Protected Overrides Sub OnActivated(ByVal e As System.EventArgs)
    Dim fnt As System.Drawing.Text.InstalledFontCollection = New System.Drawing.Text.InstalledFontCollection
    Dim fFamily As FontFamily
    For Each fFamily In fnt.Families
    tsCFontName.Items.Add(fFamily.Name)
    Next
    tsCFontName.Text = rtf.SelectionFont.Name
    Dim i As Integer
    For i = 8 To 36 Step 2
    tsCFontSize.Items.Add(i)
    Next
    tsCFontSize.Text = rtf.SelectionFont.Size
    MyBase.OnActivated(e)
    End Sub
    Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked
    Dim NewFont As Font
    Select Case e.ClickedItem.Name
    Case "tsCFontName"
    Case "tsCFontSize"
    Case "tbBold"
    NewFont = New Font(rtf.SelectionFont, (IIf(rtf.SelectionFont.Bold, rtf.SelectionFont.Style And Not FontStyle.Bold, rtf.SelectionFont.Style Or FontStyle.Bold)))
    rtf.SelectionFont = NewFont
    Case "tbItalic"
    NewFont = New Font(rtf.SelectionFont, (IIf(rtf.SelectionFont.Italic, rtf.SelectionFont.Style And Not FontStyle.Italic, rtf.SelectionFont.Style Or FontStyle.Italic)))
    rtf.SelectionFont = NewFont
    Case "tbUnderline"
    NewFont = New Font(rtf.SelectionFont, (IIf(rtf.SelectionFont.Underline, rtf.SelectionFont.Style And Not FontStyle.Underline, rtf.SelectionFont.Style Or FontStyle.Underline)))
    rtf.SelectionFont = NewFont
    End Select
    End Sub

     

     

     

     Merci a tous

     


    BigDan
    jeudi 10 décembre 2009 18:11

Réponses