.netvb.netbrushcolordialog

how to use color selected from color dialog be used as brush color for printing


I need to know how to use the color that the user has chosen from a color dialog to create a brush so that it can print in color

Please help i've been at it for days yet still nothing


Solution

  • You just need to get the color selected by the user and convert this into the appropriate brush:

        Dim userColor As Color = Color.Black 'set to a default color
        Using dlg As New ColorDialog
            dlg.Color = userColor
            If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
                'user selected something (and clicked ok)
                userColor = dlg.Color
            End If
        End Using
    
        Using userBrush As New SolidBrush(userColor)
            'use the brush here
        End Using