using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class InformationPixel : Form { protected override void OnPaint(PaintEventArgs e) { Graphics graphique = e.Graphics; graphique.FillRectangle(Brushes.White, this.ClientRectangle); Bitmap bmp = new Bitmap(6, 6); Graphics gBmp = Graphics.FromImage(bmp); gBmp.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height); gBmp.DrawLine(Pens.Red, 0, 0, 5, 5); graphique.DrawImage(bmp, 20, 20, bmp.Width, bmp.Height); for (int y = 0; y < bmp.Height; ++y) { for (int x = 0; x < bmp.Width; ++x) { Color c = bmp.GetPixel(x, y); Console.Write("{0,2:x}{1,2:x}{2,2:x}{3,2:x} ",c.A, c.R, c.G, c.G); } Console.WriteLine(); } bmp.Dispose(); } public static void Main() { Application.Run(new InformationPixel()); } } |
0