Click here to Skip to main content
15,921,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guy's

please could any one help me with this error : out of memory .
when i try to draw a polygon using the PathGradientBrush
this is my code:

VB
Dim p1 As New Point(140, 130)
     Dim p2 As New Point(180, 130)
     Dim p3 As New Point(200, 150)
     Dim p4 As New Point(180, 170)
     Dim p5 As New Point(140, 170)
     Dim p6 As New Point(120, 150)
     Dim shape As Point() = {p1, p2, p3, p4, p5, p6}
     Dim path As New GraphicsPath(FillMode.Alternate)
     Dim gra1 As New PathGradientBrush(path)
     gra1.CenterColor = Color.FromArgb(200, Color.MediumVioletRed)
     Dim colors As Color() = {Color.FromArgb(200, Color.Red), Color.Yellow}
     gra1.SurroundColors = colors
     path.AddPolygon(shape)
     g.FillPolygon(gra1, shape)
Posted

the problem is solved by moving
path.AddPolygon(shape)
and write it before the gra1 definition.
 
Share this answer
 
Hello ..............................!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900