• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Colors类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnClick

 	public void OnClick() {
		int color = (int)ObjectColor;
		color++;
		if (color > (int)Colors.Blue) {
			color = (int)Colors.Red;
		}
		
		ObjectColor = ( Colors )color;
		renderer.sharedMaterial = SaveStateSample.instance.Materials[ ( int )ObjectColor ];
	}
开发者ID:iveos,项目名称:SIG-ET-2015-OR,代码行数:10,代码来源:ToggleColor.cs


示例17: InsertColor

 public string InsertColor(string name)
 {
     Colors c = new Colors();
     c.ColorName = name;
     bool rs = cd.InsertColor(c);
     string s = "New row has been added";
     if (!rs)
         s = "Adding failed";
     return s;
 }
开发者ID:faksam,项目名称:My_FPT_C-Sharp,代码行数:10,代码来源:ColorsBLL.cs


示例18: ResolveColors

 internal static void ResolveColors()
 {
     if (isProSkin)
     {
         colors = new DarkColors();
     }
     else
     {
         colors = new LightColors();
     }
 }
开发者ID:mswf,项目名称:game-a-week,代码行数:11,代码来源:EditorSkin.cs


示例19: BestMoveForColor

        public short BestMoveForColor(System.Collections.BitArray possibleMoves, Colors color, Board.Board board)
        {
            List<int> boardMoveLocations = new List<int>();

            for (int i=0; i<possibleMoves.Count; i++)
            {
                if (possibleMoves[i]) { boardMoveLocations.Add(i); }
            }
            Random r = new Random();
            int randomIndex = r.Next() % (boardMoveLocations.Count - 1);
            return (short)boardMoveLocations[randomIndex];
        }
开发者ID:thinrichs,项目名称:Othello,代码行数:12,代码来源:RandomMoveSelector.cs


示例20: Initialize

        protected override void Initialize()
        {
            try
            {
                // Get the 1 min timeframe series of data
                minuteSeries = MarketData.GetSeries(Symbol, TimeFrame.Minute);
                warningTextColor = (Colors)Enum.Parse(typeof(Colors), WarningColor, true);
                spreadTextColor = (Colors)Enum.Parse(typeof(Colors), SpreadColor, true);
            } catch (Exception e)
            {
                errorOccured = true;
                Print("Scalpers Buddy: " + e.Message);
            }

            // position alert message on screen
            switch (WarningPostion)
            {
                case 1:
                    position = StaticPosition.TopLeft;
                    break;
                case 2:
                    position = StaticPosition.TopCenter;
                    break;
                case 3:
                    position = StaticPosition.TopRight;
                    //lowerPosition = "\n\n";
                    break;
                case 4:
                    position = StaticPosition.Right;
                    lowerPosition = "\n\n";
                    break;
                case 5:
                    position = StaticPosition.BottomRight;
                    lowerPosition = "\n\n";
                    break;
                case 6:
                    position = StaticPosition.BottomCenter;
                    lowerPosition = "\n\n";
                    break;
                case 7:
                    position = StaticPosition.BottomLeft;
                    lowerPosition = "\n\n";
                    break;
                case 8:
                    position = StaticPosition.Left;
                    lowerPosition = "\n\n";
                    break;
                default:
                    position = StaticPosition.TopLeft;
                    break;
            }
        }
开发者ID:Mikai47,项目名称:cAlgoBot,代码行数:52,代码来源:Scalpers+Buddy.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Colour类代码示例发布时间:2022-05-24
下一篇:
C# ColorValue类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap