Five yellow squares with different alpha values(Transparensy) : Color « 2D Graphics « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » 2D Graphics » ColorScreenshots 
Five yellow squares with different alpha values(Transparensy)
  

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

public class Form1 : System.Windows.Forms.Form
{
  [STAThread]
  static void Main() 
  {
    Application.Run(new Form1());
  }
  protected override void OnPaint(PaintEventArgs e)
  {
    Graphics g;
    g = Graphics.FromHwnd(this.Handle);

    g.FillRectangle(new SolidBrush(Color.Red)101021050);

    // 
    Rectangle r = new Rectangle(40203030);
    Color c = Color.FromArgb(2552552550);
    g.FillRectangle(new SolidBrush(c), r);

    r.Offset(300);
    c = Color.FromArgb(2002552550);
    g.FillRectangle(new SolidBrush(c), r);

    r.Offset(300);
    c = Color.FromArgb(1502552550);
    g.FillRectangle(new SolidBrush(c), r);

    r.Offset(300);
    c = Color.FromArgb(1002552550);
    g.FillRectangle(new SolidBrush(c), r);

    r.Offset(300);
    c = Color.FromArgb(502552550);
    g.FillRectangle(new SolidBrush(c), r);

    g.Dispose();    
  }
}

   
  
Related examples in the same category
1.Transparent colorTransparent color
2.List all known color in a systemList all known color in a system
3.Draw each of 100 cells with randomly chosen colorsDraw each of 100 cells with randomly chosen colors
4.Filled with the semi transparent and transparent colorFilled with the semi transparent and transparent color
5.All the colors that are supported in C# according
6.Color ChangerColor Changer
7.Known ColorsKnown Colors
8.Create two color instances with different alpha components
9.Color.Chocolate
10.Use Color.FromArgb to create Color
11.Get all known color
12.Color representation in r,g,b with values [0.0 - 1.0].
13.Color representation in h,s,v with h = [0 - 360], s,v = [0.0 - 1.0].
14.Return a randomly-generated color
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.