Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Using PathGradientBrush

Using PathGradientBrush

Scheduled Pinned Locked Moved C#
performancehelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JuanAlbertoMD
    wrote on last edited by
    #1

    Hello! I have this code: GraphicsPath path1 = new GraphicsPath(); path1.AddEllipse(10,10,100,100); PathGradientBrush brush1 = new PathGradientBrush(path1); brush1.CenterColor = Color.White; Color[] colorArray2 = new Color[] { ScaleColor(Color.White, 0.25f) }; Color[] colorArray1 = colorArray2; brush1.SurroundColors = colorArray1; ----------------------------------------------------------------------------------- public static Color ScaleColor(Color sourceColor, float scale) { int num1 = (int)(sourceColor.R * scale); int num2 = (int)(sourceColor.G * scale); int num3 = (int)(sourceColor.B * scale); if (num1 > 0xff) { num1 = 0xff; } if (num2 > 0xff) { num2 = 0xff; } if (num3 > 0xff) { num3 = 0xff; } return Color.FromArgb(num1, num2, num3); } --------------------------------------------------------------------------------------- this works fine but when i change the size of the ellipse and the width or height is zero my project shows an exception : Out of memory Somebody knows why this happen or why can i do to fix this? Regards, Alberto Martinez

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups