Circular gradients in .NET WinForms app -


in winforms app (c#) have circle (defined rectangle) presently filling solid color. fill circular (not linear) gradient (so 1 color in center fades color uniformly around edges).

i have experimented pathgradientbrush, having no luck (i still see solid color). if has sample code this, terrific!

i found solution here.

private void label1_paint(object sender, painteventargs e) {     graphicspath gp = new graphicspath();     gp.addellipse(label1.clientrectangle);      pathgradientbrush pgb = new pathgradientbrush(gp);      pgb.centerpoint = new pointf(label1.clientrectangle.width / 2,                                   label1.clientrectangle.height / 2);     pgb.centercolor = color.white;     pgb.surroundingcolors = new color[] { color.red };      e.graphics.fillpath(pgb, gp);      pgb.dispose();     gp.dispose(); } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -