Здравствуйте. Пытаюсь написать программу, в которой нужна заливка произвольной фигуры. Беру многократно советуемую в разных местах ExtFloodFill, но синтаксис vb.net 2008 изменился - в частности подчеркивается и не узнается hdc (PictureBox1.hdc), как результат - ExtFloodFill не работает.
Private Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Const FLOODFILLBORDER = 0
Const FLOODFILLSURFACE = 1
Dim FloodMethod As Long
Private b As Boolean = False
Private m_Drawing As Boolean = False
Private m_LastPoint As Point = Nothing
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
m_Drawing = True
m_LastPoint = New Point(e.X, e.Y)
Dim gr As Graphics = Graphics.FromImage(PictureBox1.Image)
If b = True Then
ExtFloodFill([B]PictureBox1.hdc (здесь подчеркивается, что здесь писать - не знаю[/B], e.X, e.Y, RGB(0, 0, 0), FLOODFILLBORDER)
End If
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
PictureBox1.Cursor = Cursors.Arrow
If Not m_Drawing Then Exit Sub
Dim gr As Graphics = Graphics.FromImage(PictureBox1.Image)
gr.DrawLine(New Pen(Color.Black, 1), m_LastPoint, New Point(e.X, e.Y))
m_LastPoint = New Point(e.X, e.Y)
PictureBox1.Refresh()
End Sub
Private Sub PictureBox1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
m_Drawing = False
Dim gr As Graphics = Graphics.FromImage(PictureBox1.Image)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Bitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height)
PictureBox1.Image = Bitmap
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
b = True
End Sub
То есть функции, которые работали в прежних версиях, теперь не работают. Информации никакой как правильно залить произвольную фигуру в vb.net 2008 найти не могу уже которую неделю :). Помогите, пожалуйста
А как этим пользоваться? Я нашл "it is a link from the 05 msdn library...if you do not have the help library you should be able to go online to msdn and serch for the sample app", иду в http://msdn.microsoft.com/, ввожу туда ту строчку - ничего не может найти. Что делать?