Click here to Skip to main content
15,897,718 members
Home / Discussions / Graphics
   

Graphics

 
AnswerRe: USB WEBCAMs Pin
MikeMarq16-Jun-09 9:08
MikeMarq16-Jun-09 9:08 
AnswerRe: USB WEBCAMs Pin
jon-martin.com21-Jul-09 2:17
jon-martin.com21-Jul-09 2:17 
QuestionMetal Circle with GDI+ Pin
Leslie Sanford10-Jun-09 19:42
Leslie Sanford10-Jun-09 19:42 
AnswerRe: Metal Circle with GDI+ Pin
Luc Pattyn11-Jun-09 6:25
sitebuilderLuc Pattyn11-Jun-09 6:25 
GeneralRe: Metal Circle with GDI+ Pin
Leslie Sanford11-Jun-09 10:14
Leslie Sanford11-Jun-09 10:14 
GeneralRe: Metal Circle with GDI+ Pin
Luc Pattyn11-Jun-09 10:19
sitebuilderLuc Pattyn11-Jun-09 10:19 
GeneralRe: Metal Circle with GDI+ Pin
Luc Pattyn12-Jun-09 3:42
sitebuilderLuc Pattyn12-Jun-09 3:42 
GeneralRe: Metal Circle with GDI+ Pin
Leslie Sanford13-Jun-09 8:41
Leslie Sanford13-Jun-09 8:41 
Luc Pattyn wrote:
forgot to ask, how did you create your circle with gradient? I'd like to see the code that generated it, maybe I could still come up with a cheaper approach than painting all those rectangles...


What I have is a Circle class for drawing the actual circle. The idea being that I'll eventually have classes for other shapes and create controls that are composed of these objects that know how to paint themselves. With that in mind, here's some code from the circle class for creating the brush used for painting it:

private void CreateBrush()
{
    if(brush != null)
    {
        brush.Dispose();
    }
 
    Rectangle r = new Rectangle(Location, Size);
 
    PointF[] ptsF = 
    {
        new PointF(0, 0),
        new PointF(r.Width / 2, 0),
        new PointF(r.Width, 0),
        new PointF(r.Width, r.Height / 2),  
        new PointF(r.Width, r.Height),
        new PointF(r.Width / 2, r.Height),
        new PointF(0, r.Height),
        new PointF(0, r.Height / 2)
    };

    brush = new PathGradientBrush(ptsF);
 
    Color[] colors = 
    {
        Color.Gray,
        Color.White,
        Color.Gray,
        Color.DarkGray,
        Color.Gray,
        Color.White,
        Color.Gray,
        Color.DarkGray
    };
 
    brush.SurroundColors = colors;
 
    brush.CenterColor = Color.White;
}


Basically, I was just trying to get the algorithm right; then I'd factor out the code into a "MetalCircle" class or whatever.

I think the Blend property may be key to improving the look.
GeneralRe: Metal Circle with GDI+ Pin
Luc Pattyn14-Jun-09 7:25
sitebuilderLuc Pattyn14-Jun-09 7:25 
GeneralRe: Metal Circle with GDI+ Pin
Leslie Sanford23-Jun-09 14:27
Leslie Sanford23-Jun-09 14:27 
GeneralRe: Metal Circle with GDI+ Pin
Luc Pattyn23-Jun-09 14:33
sitebuilderLuc Pattyn23-Jun-09 14:33 
GeneralRe: Metal Circle with GDI+ Pin
Luc Pattyn26-Jun-09 6:48
sitebuilderLuc Pattyn26-Jun-09 6:48 
GeneralRe: Metal Circle with GDI+ Pin
Henry Minute16-Jun-09 11:12
Henry Minute16-Jun-09 11:12 
QuestionWeb Cam URL Pin
Dinker Batra9-Jun-09 21:15
Dinker Batra9-Jun-09 21:15 
Questionhow can I load a image into memory? Pin
transoft8-Jun-09 4:38
transoft8-Jun-09 4:38 
QuestionCreating an Emboss/Bevelled effect for Circles and Rectangles [modified] Pin
Leslie Sanford7-Jun-09 19:56
Leslie Sanford7-Jun-09 19:56 
AnswerRe: Creating an Emboss/Bevelled effect for Circles and Rectangles Pin
Tim Craig8-Jun-09 14:38
Tim Craig8-Jun-09 14:38 
GeneralRe: Creating an Emboss/Bevelled effect for Circles and Rectangles Pin
Leslie Sanford8-Jun-09 15:37
Leslie Sanford8-Jun-09 15:37 
GeneralRe: Creating an Emboss/Bevelled effect for Circles and Rectangles Pin
Tim Craig8-Jun-09 19:09
Tim Craig8-Jun-09 19:09 
GeneralRe: Creating an Emboss/Bevelled effect for Circles and Rectangles Pin
Leslie Sanford8-Jun-09 19:52
Leslie Sanford8-Jun-09 19:52 
GeneralRe: Creating an Emboss/Bevelled effect for Circles and Rectangles Pin
Tim Craig9-Jun-09 15:05
Tim Craig9-Jun-09 15:05 
QuestionGLX rendering context problem Pin
sheeri manik2-Jun-09 15:08
sheeri manik2-Jun-09 15:08 
QuestionDxText for Offline VideoWatermarking Pin
anki12326-May-09 21:24
anki12326-May-09 21:24 
QuestionObject transform problem! Pin
Avion8525-May-09 13:30
Avion8525-May-09 13:30 
AnswerRe: Object transform problem! Pin
Baltoro4-Jun-09 7:44
Baltoro4-Jun-09 7:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.