标签:
1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Windows.Forms; 9 10 namespace 动态生成RGB 11 { 12 public partial class Form1 : Form 13 { 14 public Form1() 15 { 16 InitializeComponent(); 17 } 18 19 private void Form1_Load(object sender, EventArgs e) 20 { 21 } 22 int i = 0; 23 int j = 0; 24 int k = 0; 25 int x = 255, y = 255, z = 255; 26 int a = 255, b = 0,c=0; 27 private void timer1_Tick(object sender, EventArgs e) 28 { 29 if (i != 255) 30 { 31 i++; 32 this.BackColor = Color.FromArgb(i, 0, 0); 33 } 34 else 35 { 36 if (j != 255) 37 { 38 j++; 39 this.BackColor = Color.FromArgb(i, j, 0); 40 } 41 else 42 { 43 if (k != 255) 44 { 45 k++; 46 this.BackColor = Color.FromArgb(i, j, k); 47 } 48 else 49 { 50 if (i == 255 && k == 255) 51 { 52 if (a != 0) 53 { 54 a--; 55 this.BackColor = Color.FromArgb(i, a, k); 56 } 57 else 58 { 59 if (x!=0) 60 { 61 if (c!=255) 62 { 63 x--; 64 this.BackColor = Color.FromArgb(x, y, z); 65 c++; 66 this.BackColor = Color.FromArgb(x, c, z); 67 } 68 } 69 else 70 { 71 if (y!=0) 72 { 73 y--; 74 this.BackColor = Color.FromArgb(x, y, z); 75 } 76 else 77 { 78 79 if (z!=0) 80 { 81 z--; 82 this.BackColor = Color.FromArgb(x, y, z); 83 } 84 else 85 { 86 if (x == 0 && z == 0) 87 { 88 if (b!=255) 89 { 90 b++; 91 this.BackColor = Color.FromArgb(x, b, z); 92 } 93 } 94 } 95 } 96 } 97 } 98 99 } 100 } 101 } 102 } 103 } 104 } 105 }
鄙人做了一个颜色RGB的代码,颜色过渡,不知道高手是怎么做的。求赐教
标签:
原文地址:http://www.cnblogs.com/jason-davis/p/4500442.html