Create a red color with an alpha component then draw a red circle to the bitmap in memory : Bitmap : Graphics C# Source Code


Custom Search

C# Source Code » Graphics » Bitmap »

 

Create a red color with an alpha component then draw a red circle to the bitmap in memory








    
 


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form {

    protected override void OnPaint(PaintEventArgs e) {
    Graphics gForm = e.Graphics;
    gForm.FillRectangle(Brushes.White, this.ClientRectangle);
    for (int i = 1; i <= 7; ++i)
    {
      Rectangle r = new Rectangle(i * 40 - 15, 0, 15,this.ClientRectangle.Height);
      gForm.FillRectangle(Brushes.Orange, r);
    }

    Bitmap bmp = new Bitmap(260, 260,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    Graphics gBmp = Graphics.FromImage(bmp);


    Color red = Color.FromArgb(0x60, 0xff, 0, 0);
    Brush redBrush = new SolidBrush(red);
    gBmp.FillEllipse(redBrush, 70, 70, 160, 160);

    gForm.DrawImage(bmp, 20, 20, bmp.Width, bmp.Height);

    bmp.Dispose();
    gBmp.Dispose();
    redBrush.Dispose();

    }
    public static void Main() {
        Application.Run(new Form1());
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Graphics
» Bitmap