C# 随机生成颜色

 private Color RanDomColor()
        {
            int iSeed = 10; Random ro = new Random(10); long tick = DateTime.Now.Ticks;
            Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));

            int R = ran.Next(255);
            int G = ran.Next(255);
            int B = ran.Next(255);
            B = (R + G > 400) ? R + G - 400 : B;//0 : 380 - R - G;
            B = (B > 255) ? 255 : B;
            return Color.FromArgb(R, G, B);
        }

 

posted @ 2021-11-18 11:04  后跳  阅读(351)  评论(0编辑  收藏  举报