或者改为:
Protected Shared Function GetHalfToneBrush_() As IntPtr
If _halfToneBrush.Equals(IntPtr.Zero) Then Dim bitmap As New bitmap(8, 8, PixelFormat.Format32bppArgb) Dim white As Color = Color.FromArgb(255, 255, 255, 255)
Dim black As Color = Color.FromArgb(255, 0, 0, 0) Dim flag As Boolean = True ' Alternate black and white pixels across all lines
Dim x As Integer
Dim y As Integer For x = 0 To 8 - 1
For y = 0 To 8 - 1
Dim tempColor As Color
If flag Then
tempColor = Color.White
Else
tempColor = Color.Black
End If
bitmap.SetPixel(x, y, tempColor)
Next
Next Dim hBitmap As IntPtr = bitmap.GetHbitmap() Dim brush As Win32.LOGBRUSH = New Win32.LOGBRUSH
brush.lbStyle = Convert.ToUInt32(Win32.BrushStyles.BS_PATTERN)
brush.lbHatch = Convert.ToUInt32(hBitmap)
End If Return _halfToneBrush
End Function 'GetHalfToneBrush Protected Shared Function GetHalfToneBrush() As IntPtr
If _halfToneBrush.Equals(IntPtr.Zero) Then
Dim bitmap As New bitmap(8, 8, PixelFormat.Format32bppArgb) Dim white As Color = Color.FromArgb(255, 255, 255, 255)
Dim black As Color = Color.FromArgb(255, 0, 0, 0) Dim flag As Boolean = True ' Alternate black and white pixels across all lines
Dim x As Integer
While x < 8
Dim y As Integer
While y < 8
Dim tempColor As Color
If flag Then
tempColor = Color.White
Else
tempColor = Color.Black
End If
bitmap.SetPixel(x, y, tempColor)
End While
End While
Dim hBitmap As IntPtr = bitmap.GetHbitmap() Dim brush As New Win32.LOGBRUSH brush.lbStyle = Convert.ToUInt32(Win32.BrushStyles.BS_PATTERN)
brush.lbHatch = Convert.ToUInt32(hBitmap) _halfToneBrush = Gdi32.CreateBrushIndirect(brush)
End If
Return _halfToneBrush
End Function 'GetHalfToneBrush
Protected Shared Function GetHalfToneBrush_() As IntPtr
If _halfToneBrush.Equals(IntPtr.Zero) Then Dim bitmap As New bitmap(8, 8, PixelFormat.Format32bppArgb) Dim white As Color = Color.FromArgb(255, 255, 255, 255)
Dim black As Color = Color.FromArgb(255, 0, 0, 0) Dim flag As Boolean = True ' Alternate black and white pixels across all lines
Dim x As Integer
Dim y As Integer For x = 0 To 8 - 1
For y = 0 To 8 - 1
Dim tempColor As Color
If flag Then
tempColor = Color.White
Else
tempColor = Color.Black
End If
bitmap.SetPixel(x, y, tempColor)
Next
Next Dim hBitmap As IntPtr = bitmap.GetHbitmap() Dim brush As Win32.LOGBRUSH = New Win32.LOGBRUSH
brush.lbStyle = Convert.ToUInt32(Win32.BrushStyles.BS_PATTERN)
brush.lbHatch = Convert.ToUInt32(hBitmap)
End If Return _halfToneBrush
End Function 'GetHalfToneBrush Protected Shared Function GetHalfToneBrush() As IntPtr
If _halfToneBrush.Equals(IntPtr.Zero) Then
Dim bitmap As New bitmap(8, 8, PixelFormat.Format32bppArgb) Dim white As Color = Color.FromArgb(255, 255, 255, 255)
Dim black As Color = Color.FromArgb(255, 0, 0, 0) Dim flag As Boolean = True ' Alternate black and white pixels across all lines
Dim x As Integer
While x < 8
Dim y As Integer
While y < 8
Dim tempColor As Color
If flag Then
tempColor = Color.White
Else
tempColor = Color.Black
End If
bitmap.SetPixel(x, y, tempColor)
End While
End While
Dim hBitmap As IntPtr = bitmap.GetHbitmap() Dim brush As New Win32.LOGBRUSH brush.lbStyle = Convert.ToUInt32(Win32.BrushStyles.BS_PATTERN)
brush.lbHatch = Convert.ToUInt32(hBitmap) _halfToneBrush = Gdi32.CreateBrushIndirect(brush)
End If
Return _halfToneBrush
End Function 'GetHalfToneBrush
解决方案 »
- 请~帮帮我吧!
- 类中使用页中的DropDownList
- 讨论下URL传值问题!
- 同一个DLL中的MD5函数加密相同的字符串结果不同?
- 一直用DELPHI做开发,为了赶潮流学了一段时间.NET(C#),因项目性质不同,我做的方面用VC 的多,现在不知道学习c++还是C#??????
- 如何得到DataGrid绑定的DataTable的当前行的行号?
- datagrid中的foramt怎么用
- treeview 使用的问题
- 各位帮帮我:怎样访问StringBuilder的内存数据?
- 女友叫我证明此题,难倒我了!
- 如何在一个windows services里调用一个activeX控件
- 高手帮忙解决一个datagrid的问题啊。。
for(int x=0; x<8; x++, flag = !flag)
for(int y=0; y<8; y++, flag = !flag)
bitmap.SetPixel(x, y, (flag ? white : black));
其他的偶都会!
帮忙!
For x = 0 To 8 - 1
flag = Not flag
For y = 0 To 8 - 1
flag = Not flag
Dim tempColor As Color
If flag Then
tempColor = Color.White
Else
tempColor = Color.Black
End If
bitmap.SetPixel(x, y, tempColor)
Next
Next本贴当作从分。先到先得得·!!