當前位置: 首頁>>代碼示例>>C#>>正文


C# Color.SelectMany方法代碼示例

本文整理匯總了C#中Color.SelectMany方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.SelectMany方法的具體用法?C# Color.SelectMany怎麽用?C# Color.SelectMany使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Color的用法示例。


在下文中一共展示了Color.SelectMany方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ColorSortedSecuenceWrite

        public static OperationMessage ColorSortedSecuenceWrite(ushort homeDeviceAddress, byte seconds, Color[] colors)
        {
            List<byte> args = new List<byte>();
            args.Add(seconds);
            args.AddRange(colors.SelectMany(c => new byte[] { c.R, c.G, c.B }));

            return BaseMessage(OPCodes.ColorSortedSecuenceWrite, homeDeviceAddress, args.ToArray());
        }
開發者ID:caiodossantos,項目名稱:wireless-network,代碼行數:8,代碼來源:ProtocolMessages.cs

示例2: FromPixels

        /// <summary>
        ///     Constructs an image from a 2d list of pixels.
        /// </summary>
        /// <param name="colors">2d rectangular list of colors representing the pixels.</param>
        public static Bitmap FromPixels(Color[][] colors)
        {
            var height = colors.Length;
            var width = colors[0].Length;

            var rgbVals = colors.SelectMany(row => row);

            return FromPixelsHelper(rgbVals, width, height);
        }
開發者ID:whztt07,項目名稱:Dynamo,代碼行數:13,代碼來源:Files.cs

示例3: Main

        static void Main(string[] args)
        {
            try
            {
                const string uriText = "net.pipe://localhost/mailnotifier/sign";

                NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);

                EndpointAddress endpointAddress = new EndpointAddress(uriText);

                MailNotifierServiceClient client = new MailNotifierServiceClient(binding, endpointAddress);

                if (args.Length == 1 && args[0] == "rainbow")
                {
                    var colors = new Color []
                    {
                        Color.Red,
                        Color.Yellow,
                        Color.Green,
                        Color.Blue,
                        Color.Purple
                    };
                    var colorBytes = colors
                        .SelectMany(c => new byte[] { c.R, c.G, c.B })
                        .ToArray();

                    Console.WriteLine("Rainbow...");
                    client.FadeToMultiRgb(colorBytes);
                }
                else if (args.Length == 3)
                {
                    byte red = byte.Parse(args[0]);
                    byte green = byte.Parse(args[1]);
                    byte blue = byte.Parse(args[2]);

                    Color color = Color.FromArgb(red, green, blue);
                    client.SetColorRgb(color.R, color.G, color.B);

                    Console.WriteLine("Color set to " + color.Name);

                }
                else if (args.Length == 4 && args[0] == "fade")
                {
                    byte red = byte.Parse(args[1]);
                    byte green = byte.Parse(args[2]);
                    byte blue = byte.Parse(args[3]);

                    Console.WriteLine("Fading...");
                    client.FadeToRgb(red, green, blue);
                }

                else if (args.Length != 1)
                {
                    return;
                }
                else
                {
                    Color color = Color.FromName(args[0]);
                    byte red = RoundToNotifierColorValue(color.R);
                    byte green = RoundToNotifierColorValue(color.G);
                    byte blue = RoundToNotifierColorValue(color.B);

                    client.SetColorRgb(red, green, blue);

                    var notifierColor = Color.FromArgb(red, green, blue);
                    Console.WriteLine("Color set to " + notifierColor.Name);
                }

                client.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("She broke. :(" + e);
                Console.ReadLine();
            }
        }
開發者ID:rpwjanzen,項目名稱:blinken,代碼行數:76,代碼來源:Program.cs


注:本文中的Color.SelectMany方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。