listbox for fontname,combo for size,color,etc,help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • natrajdeams
    New Member
    • Apr 2010
    • 3

    #1

    listbox for fontname,combo for size,color,etc,help

    Hii I am desigining one VB project like dis..


    VB application to change the font of the textbox... use the controls list box for the fontname, check box for Effects , combo box for sixe, combo box for color, and option button for font style....

    I have written the code for loding font names and font sizes in a list box... but i am unable to get rest of the things.. please help me regarding this.... thank you....

    Code:
    Private Sub Form_Load()
    For i = 0 To Screen.FontCount - 1
    List1.AddItem Screen.Fonts(i)
    Next i
    End Sub
    Private Sub List1_Click()
    LoadFontSizes
    End Sub
    
    Private Sub LoadFontSizes()
    Dim SaveName As String
    Dim SaveSize As Single
    Dim Sizes As Variant
    Dim i As Long
    'place holders for font name and font size
    SaveName = cboFontSize.Font.Name
    SaveSize = cboFontSize.Font.Size
    Sizes = Array(6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72)
    cboFontSize.Clear
    'this is the font the user has selected
    cboFontSize.FontName = List1.Text
    'whip through the array checking all possible font sizes
    For i = LBound(Sizes) To UBound(Sizes)
    cboFontSize.FontSize = CLng(Sizes(i))
    'font supports this size, add to combo
    If cboFontSize.FontSize = CLng(Sizes(i)) Then
    cboFontSize.AddItem Sizes(i)
    End If
    Next
    cboFontSize.FontName = SaveName
    cboFontSize.FontSize = SaveSize
    End Sub
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Why reinvent the wheel? Use the common dialog control and the showfont and the showcolor methods to accomplish what you want. Fewer lines of code, common interface, and in moments, you are done....



    Good Luck

    Comment

    • natrajdeams
      New Member
      • Apr 2010
      • 3

      #3
      hii thanks for ur reply...... that is true about using common dialog controls... but my requirement is to create our own font dialog boxes using the above controls... please help me regarding this.... thank you,,,,,,,,,,,,

      Comment

      • CyberSoftHari
        Recognized Expert Contributor
        • Sep 2007
        • 488

        #4
        Explain your project properly, not the code. Your code looks a bit harder than common dialog tools for the endusers.
        (You can create yourown controls(.ocx) for your project using get and set property).

        Comment

        • natrajdeams
          New Member
          • Apr 2010
          • 3

          #5
          Hii I am desigining one VB project like dis..


          VB application to change the font of the textbox... use the controls list box for the fontname, check box for Effects , combo box for sixe, combo box for color, and option button for font style....


          thank you

          Comment

          • CyberSoftHari
            Recognized Expert Contributor
            • Sep 2007
            • 488

            #6
            If your project endusers interface are highly based on design then you can create own controls as i sugges else, you can use common dialog controls.

            Comment

            Working...