【问题标题】:how to use color selected from color dialog be used as brush color for printing [closed]如何使用从颜色对话框中选择的颜色作为打印的画笔颜色 [关闭]
【发布时间】:2014-05-19 19:18:39
【问题描述】:

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

请帮助我已经做了好几天了,但还是一无所获

【问题讨论】:

  • 如果你已经在这里工作了好几天,你应该有一些代码可以展示给我们。

标签: .net vb.net brush colordialog


【解决方案1】:

您只需要获取用户选择的颜色并将其转换为适当的画笔即可:

    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

【讨论】:

    【解决方案2】:
    Dim col as Color = Colors.Red
    Dim bru as SolidColorBrush = New SolidColorBrush(col)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-04
      相关资源
      最近更新 更多