vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Zippen wie die Profis!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB & Windows API
Re: FloodFill 
Autor: CyberDreams
Datum: 21.07.04 16:11

Hy,

vielleicht hilft dir dieses Beispiel ein bisschen weiter...?!

Option Explicit
 
Private Type COORD
  x As Long
  y As Long
End Type
 
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As Any, ByVal _
  nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As _
Any, ByVal nCount As Long) As Long
Private Declare Function FillRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As _
Long, ByVal hBrush As Long) As Long
'Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As 
' Long
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) _
  As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As _
Long
 
Const ALTERNATE = 1 ' ALTERNATE and WINDING are
Const WINDING = 2 ' constants for FillMode.
Const BLACKBRUSH = 4 ' Constant for brush type.
 
 
Private Sub Form_Paint()
Dim poly(1 To 3)  As COORD
Dim NumCoords     As Long
Dim hBrush        As Long
Dim hRgn          As Long
Dim lColor        As Long
 
  Me.Cls
  ' Number of vertices in polygon.
  NumCoords = 3
  ' Set Color
  lColor = &H80000003
  ' Set scalemode to pixels to set up points of triangle.
  Me.ScaleMode = vbPixels
  ' Assign values to points.
  poly(1).x = Form1.ScaleWidth / 2
  poly(1).y = Form1.ScaleHeight / 2
  poly(2).x = Form1.ScaleWidth / 4
  poly(2).y = 3 * Form1.ScaleHeight / 4
  poly(3).x = 3 * Form1.ScaleWidth / 4
  poly(3).y = 3 * Form1.ScaleHeight / 4
  ' Polygon function creates unfilled polygon on screen.
  ' Remark FillRgn statement to see results.
  Call Polygon(Me.hdc, poly(1), NumCoords)
  ' Gets stock black brush.
  hBrush = CreateSolidBrush(vbCyan) 'GetStockObject(BLACKBRUSH)
  ' Creates region to fill with color.
  hRgn = CreatePolygonRgn(poly(1), NumCoords, ALTERNATE)
  ' If the creation of the region was successful then color.
  If hRgn Then Call FillRgn(Me.hdc, hRgn, hBrush)
  Call DeleteObject(hRgn)
 
End Sub
 
 
Private Sub Form_Resize()
 
  Call Form_Paint
 
End Sub
LG CyberDreams
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
FloodFill2.279Ne kölsche Jung19.07.04 16:08
Re: FloodFill1.557ModeratorMartoeng19.07.04 18:39
Re: FloodFill1.506Ne kölsche Jung19.07.04 20:50
Re: FloodFill1.425Mr. Fox20.07.04 16:10
Re: FloodFill2.134CyberDreams21.07.04 16:11
Re: FloodFill1.284Ne kölsche Jung21.07.04 19:04
Re: FloodFill1.360CyberDreams22.07.04 08:03

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel