如何使用从颜色对话框中选择的颜色作为用于打印的画笔颜色

时间:2014-05-19 10:57:00

标签: .net vb.net brush colordialog

我需要知道如何使用用户从颜色对话框中选择的颜色来创建画笔,以便它可以彩色打印

请帮助我已经好几天了但仍然没有

2 个答案:

答案 0 :(得分:2)

您只需要获取用户选择的颜色并将其转换为相应的画笔:

    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

答案 1 :(得分:0)

Dim col as Color = Colors.Red
Dim bru as SolidColorBrush = New SolidColorBrush(col)