本文整理匯總了VB.NET中System.Drawing.Imaging.ImageAttributes.SetColorKey方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET ImageAttributes.SetColorKey方法的具體用法?VB.NET ImageAttributes.SetColorKey怎麽用?VB.NET ImageAttributes.SetColorKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Imaging.ImageAttributes
的用法示例。
在下文中一共展示了ImageAttributes.SetColorKey方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: SetColorKeyExample
Public Sub SetColorKeyExample(ByVal e As PaintEventArgs)
' Open an Image file, and draw it to the screen.
Dim myImage As Image = Image.FromFile("Circle.bmp")
e.Graphics.DrawImage(myImage, 20, 20)
' Create an ImageAttributes object and set the color key.
Dim lowerColor As Color = Color.FromArgb(245, 0, 0)
Dim upperColor As Color = Color.FromArgb(255, 0, 0)
Dim imageAttr As New ImageAttributes
imageAttr.SetColorKey(lowerColor, upperColor, _
ColorAdjustType.Default)
' Draw the image with the color key set.
Dim rect As New Rectangle(150, 20, 100, 100)
e.Graphics.DrawImage(myImage, rect, 0, 0, 100, 100, _
GraphicsUnit.Pixel, imageAttr)
' Image
End Sub