当前位置: 首页>>代码示例>>C#>>正文


C# Colors类代码示例

本文整理汇总了C#中Colors的典型用法代码示例。如果您正苦于以下问题:C# Colors类的具体用法?C# Colors怎么用?C# Colors使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Colors类属于命名空间,在下文中一共展示了Colors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateColorValue

        /// <summary>
        /// Sends command to arduino to change color value
        /// </summary>
        /// <param name="color">Color to be altered</param>
        /// <param name="value">New value, should be between 0 and 255</param>
        public void UpdateColorValue(Colors color, double value)
        {
            string[] portlist = SerialPort.GetPortNames();

            foreach (String s in portlist)
            {
                try
                {
                    if (_port == null || !_port.IsOpen)
                    {
                        _port = new SerialPort(s, 9600, Parity.None, 8, StopBits.One);
                        _port.DataReceived += OnReceived;

                        _port.Open();
                    }

                    // Todo: Before sending data, we should do some sort of handshake to make sure it's actually the our program

                    string toSend = string.Format("{0};{1}",
                        (char)((int)color),
                        ((int)value).ToString()
                    );

                    // Serialze the data for transmission
                    byte[] data = CommandMessage(toSend);
                    _port.Write(data, 0, data.Length);
                }
                catch (Exception ex)
                {
                    // todo error handling
                }
            }
        }
开发者ID:drewvance,项目名称:RGBLamp,代码行数:38,代码来源:ArduinoCommand.cs

示例2: hitColoredBuilding

    public void hitColoredBuilding(Colors color)
    {
        //Debug.Log (color + " hit me");
        if (color == getColorNeeded()) {
            // check box and move on
            //   if box is last in combo, move multiplier up and start new combo

            stars[onBoxNumber].GetComponent<Image>().enabled = true;
            onBoxNumber++;

            if (onBoxNumber == comboSetAmount) {
                // combo completed
                comboCompleted(comboSetAmount);
            }
        } else {
            // if current box is first move multiplier down, if not reset combo
            if (onBoxNumber == 0) {
                // delevel
                deMultiply();
            } else {
                // reset combo
                resetCombo();
            }
        }
    }
开发者ID:TheGamingProject,项目名称:ludumdare33,代码行数:25,代码来源:MultiplierManager.cs

示例3: Calculate

        public override void Calculate(int index)
        {
            int nuBar = MarketSeries.Close.Count - 1;
            double c = MarketSeries.Close[index] / Symbol.PipSize;
            double nu = (c - (c % pips)) * Symbol.PipSize;

            if (nu > vorige)
            {
                // stijging van minimaal pips
                rUP[index] = nu;
                rDOWN[index] = nu - (pips * Symbol.PipSize);
                vvorig(nu, nuBar);
            }
            else if (nu < vorige)
            {
                // daling van minimaal pips
                rUP[index] = nu + (pips * Symbol.PipSize);
                rDOWN[index] = nu;
                kleur = Colors.Tomato;
                vvorig(nu, nuBar);
            }
            else
            {
                // zelfde
                rUP[index] = rUP[index - 1];
                rDOWN[index] = rDOWN[index - 1];
            }
        }
开发者ID:Mikai47,项目名称:cAlgoBot,代码行数:28,代码来源:JeexSimplifiedRenko.cs

示例4: WriteTo

        public void WriteTo(Colors colors)
        {
            colors.FrameForeground = FrameForeground;
            colors.FrameBackground = FrameBackground;
            colors.FrameSecondary = FrameSecondary;

            colors.ContentForeground = ContentForeground;
            colors.ContentBackground = ContentBackground;
            colors.ContentSecondary = ContentSecondary;
            colors.ContentPopout = ContentPopout;
            colors.ContentEnabled = ContentEnabled;
            colors.ContentDisabled = ContentDisabled;

            colors.ContactListBackground = ContactListBackground;
            colors.ContactListForeground = ContactListForeground;
            colors.ContactListSelected = ContactListSelected;

            colors.HighlightForeground = HighlightForeground;
            colors.HighlightImportant = HighlightImportant;
            colors.HighlightWarning = HighlightWarning;
            colors.HighlightRequest = HighlightRequest;

            colors.StatusAvailable = StatusAvailable;
            colors.StatusAway = StatusAway;
            colors.StatusDnd = StatusDnd;
            colors.StatusOffline = StatusOffline;
        }
开发者ID:peterluo0822,项目名称:Chat,代码行数:27,代码来源:AppColors.cs

示例5: ReadFrom

        public void ReadFrom(Colors colors)
        {
            if (colors == null)
                return;

            FrameForeground = colors.FrameForeground;
            FrameBackground = colors.FrameBackground;
            FrameSecondary = colors.FrameSecondary;

            ContentForeground = colors.ContentForeground;
            ContentBackground = colors.ContentBackground;
            ContentSecondary = colors.ContentSecondary;
            ContentPopout = colors.ContentPopout;
            ContentEnabled = colors.ContentEnabled;
            ContentDisabled = colors.ContentDisabled;

            ContactListBackground = colors.ContactListBackground;
            ContactListForeground = colors.ContactListForeground;
            ContactListSelected = colors.ContactListSelected;

            HighlightForeground = colors.HighlightForeground;
            HighlightImportant = colors.HighlightImportant;
            HighlightWarning = colors.HighlightWarning;
            HighlightRequest = colors.HighlightRequest;

            StatusAvailable = colors.StatusAvailable;
            StatusAway = colors.StatusAway;
            StatusDnd = colors.StatusDnd;
            StatusOffline = colors.StatusOffline;
        }
开发者ID:peterluo0822,项目名称:Chat,代码行数:30,代码来源:AppColors.cs

示例6: Calculate

        public override void Calculate(int index)
        {
            if (_incorrectColors)
            {
                var errorColor = _random.Next(2) == 0 ? Colors.Red : Colors.White;
                ChartObjects.DrawText("Error", "Incorrect colors", StaticPosition.Center, errorColor);
                return;
            }

            var open = MarketSeries.Open[index];
            var high = MarketSeries.High[index];
            var low = MarketSeries.Low[index];
            var close = MarketSeries.Close[index];

            var MA = _ma.Result[index];
            MaResult[index] = MA;

            if (MA < close)
                color = open > close ? _AboveDownColor : _AboveUpColor;

            if (MA >= close)
                color = open > close ? _BelowDownColor : _BelowUpColor;

            ChartObjects.DrawLine("candle" + index, index, open, index, close, color, CandleWidth, LineStyle.Solid);
            ChartObjects.DrawLine("line" + index, index, high, index, low, color, WickWidth, LineStyle.Solid);



        }
开发者ID:Mikai47,项目名称:cAlgoBot,代码行数:29,代码来源:Moving+Average+Color+Candles.cs

示例7: SetStatus

        public static void SetStatus(string text, Colors color)
        {
            try
            {
                Bitmap theColor = new Bitmap(P2PVpn.Properties.Resources.Stop_red2);
                if (color == Colors.Green)
                {
                    theColor = P2PVpn.Properties.Resources.Accept2;
                }
                else if (color == Colors.Red)
                {
                    theColor = P2PVpn.Properties.Resources.Stop_red2;
                }
                else if (color == Colors.Yellow)
                {
                    theColor = P2PVpn.Properties.Resources.Prohibit2;
                }
                if (_statusBar.InvokeRequired)
                {
                    _statusBar.BeginInvoke(new Action(() => _lblStatusText.Text = text));
                    _statusBar.BeginInvoke(new Action(() => _lblStatusText.Image = theColor));

                }
                else
                {
                    _lblStatusText.Text = text;
                    _lblStatusText.Image = theColor;
                }

            }
            catch (ObjectDisposedException ex)
            {

            }
        }
开发者ID:mloispro,项目名称:P2PVpn,代码行数:35,代码来源:Logging.cs

示例8: getColorBinKey

        private String getColorBinKey(int color, Colors type)
        {
            int bin = color / 25;
            String key;
            if (type == Colors.R) {
                key = "R";
            }
            else if (type == Colors.G)
            {
                key = "G";
            }
            else if (type == Colors.B)
            {
                key = "B";
            }
            else {
                return null;
            }

            if (color < 250)
            {
                return key + bin.ToString();
            }
            else {
                return key + "9";
            }
        }
开发者ID:Buddhima,项目名称:MPEG7-FeatureExtractor,代码行数:27,代码来源:RGBHistogramQuantizer.cs

示例9: Nest

        public Nest(Colors color, Piece[] pieces)
        {
            this.pieces = new Stack<Piece>();
            this.color = color;

            foreach (var piece in pieces)
            {  pushPiece(piece); }
        }
开发者ID:hannahborje,项目名称:Ludo,代码行数:8,代码来源:Nest.cs

示例10: SetColor

 /// <summary>
 /// �F���w��� LED ��_������
 /// </summary>
 /// <param name="color"></param>
 public void SetColor(Colors color)
 {
     int redFlag = (int)color & (int)Colors.Red;
     int greenFlag = (int)color & (int)Colors.Green;
     int blueFlag = (int)color & (int)Colors.Blue;
     portRed.Write(redFlag != 0);
     portGreen.Write(greenFlag != 0);
     portBlue.Write(blueFlag != 0);
 }
开发者ID:ms-iotkithol-jp,项目名称:IoTKitHoLV3,代码行数:13,代码来源:BoardFullColorLED.cs

示例11: Piece

 public Piece(Colors color, int ID)
 {
     Color = color;
     PieceID = ID;
     Alive = true;
     Active = false;
     Steps = 0;
     Position = -1;
 }
开发者ID:perjo927,项目名称:Frukt-med-knuff,代码行数:9,代码来源:Piece.cs

示例12: Calculate

        public override void Calculate(int index)
        {

            LineBold = L1;

            if (SetBlue)
            {
                LineColor = Colors.DodgerBlue;
            }


            if (SetRed)
            {
                LineColor = Colors.Red;
            }
            if (SetWhite)
            {
                LineColor = Colors.White;
            }
            if (SetBlack)
            {
                LineColor = Colors.Black;
            }
            if (SetGreen)
            {
                LineColor = Colors.YellowGreen;
            }


            if (Set100Levels && MinLevel < MaxLevel)
            {
                for (int i = MinLevel; i < MaxLevel; i++)
                {
                    ChartObjects.DrawHorizontalLine("Level" + i, i * 100 * Symbol.PipSize, LineColor, LineBold, LineStyle.Solid);
                }
            }

            if (Set25Levels && MinLevel < MaxLevel)
            {
                for (int i = MinLevel; i < MaxLevel; i++)
                {
                    ChartObjects.DrawHorizontalLine("Lh1" + i, i * 100 * Symbol.PipSize + 25 * Symbol.PipSize, Colors.Red, 1, LineStyle.DotsRare);
                    ChartObjects.DrawHorizontalLine("Lh3" + i, i * 100 * Symbol.PipSize + 75 * Symbol.PipSize, Colors.Red, 1, LineStyle.DotsRare);
                }
            }

            if (Set50Levels && MinLevel < MaxLevel)
            {
                for (int i = MinLevel; i < MaxLevel; i++)
                {
                    ChartObjects.DrawHorizontalLine("Lh2" + i, i * 100 * Symbol.PipSize + 50 * Symbol.PipSize, Colors.YellowGreen, 1, LineStyle.Lines);
                }
            }



        }
开发者ID:Mikai47,项目名称:cAlgoBot,代码行数:57,代码来源:_100Pips.cs

示例13: GetExclusionRandomColor

 public Color GetExclusionRandomColor(Colors excColor, out Colors color)
 {
     int index = getRandomColorIndex();
     while ((Colors)index == excColor)
     {
         index = getRandomColorIndex();
     }
     color = (Colors)index;
     return colors[index];
 }
开发者ID:novic77,项目名称:Flat-Puzzle-unity,代码行数:10,代码来源:Palette.cs

示例14: Player

		public Player (string name, Colors color)
		{
			Name = name;

			Color = color;

			MoveLimit = (Color == Colors.Black) ? 0 : 9;

			Direction = (Color == Colors.Black) ? 1 : -1;
		}
开发者ID:rdcm,项目名称:CheckersMustFlow,代码行数:10,代码来源:Player.cs

示例15: SaveFile

 public SaveFile(Lingo lingoGame, WordManager wordManager, Colors[] result,
     Colors[] foundLetters, Colors[,] earlierResult, String[,] earlierLetters)
 {
     this.lingoGame = lingoGame;
     this.wordManager = wordManager;
     this.result = result;
     this.foundLetters = foundLetters;
     this.earlierLetters = earlierLetters;
     this.earlierResult = earlierResult;
 }
开发者ID:korsback,项目名称:lingo,代码行数:10,代码来源:SaveFile.cs


注:本文中的Colors类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。