Drawing Colors in a picturebox?

后端 未结 3 1220
醉梦人生
醉梦人生 2021-01-25 18:22

In C# i have a picturebox. i would like to draw 4 colors. The default will be white, red, green, blue. How do i draw these 4 colors stritched in this picbox? or should i have 4

3条回答
  •  时光取名叫无心
    2021-01-25 18:48

    If you want to use non-predefined colors, then you need to get a Color object from the static method Color.FromArgb().

    int r = 100;
    int g = 200;
    int b = 50;
    
    Color c = Color.FromArgb(r, g, b);
    
    Brush brush = new SolidBrush(c);
    //...
    

    Best Regards
    Oliver Hanappi

提交回复
热议问题