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


C# Color.FromArgb方法代码示例

本文整理汇总了C#中Color.FromArgb方法的典型用法代码示例。如果您正苦于以下问题:C# Color.FromArgb方法的具体用法?C# Color.FromArgb怎么用?C# Color.FromArgb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Color的用法示例。


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

示例1: AllOneColor

        public void AllOneColor(Color Color)
        {
            pixelColors = new List<Color>();

            for (int i = 0; i < spi.PixelCount; i++) 
            {
                pixelColors.Add(Color.FromArgb(255, Color.R,Color.G,Color.B));
            }

            SPIclass.SendPixels(pixelColors);
        }
开发者ID:jenkinsroger,项目名称:RaspiAutomation,代码行数:11,代码来源:Apa102.cs

示例2: ColorPickerMenuItem

        public ColorPickerMenuItem(Color color)
        {
            Color = color;

            _fillBrush = new SolidBrush(Color);

            _borderPen = new Pen(
                Color.FromArgb(
                    (int)(color.R / 1.5f),
                    (int)(color.G / 1.5f),
                    (int)(color.B / 1.5f)
                )
            );
        }
开发者ID:schmich,项目名称:debuggernaut,代码行数:14,代码来源:ColorPickerMenu.cs

示例3: LightColor

		/// <summary>Lights up the provided color and returns it</summary>
		private Color LightColor(Color Color) {
			int A = Color.A;
			int R = (Convert.ToInt32(Color.R) + 1024)/5;
			int G = (Convert.ToInt32(Color.G) + 1024)/5;
			int B = (Convert.ToInt32(Color.B) + 1024)/5;

			return Color.FromArgb(A, R, G, B);
		}
开发者ID:Taipi88,项目名称:updateSystem.NET,代码行数:9,代码来源:updateStatisticChart.cs

示例4: Glassify

        private void Glassify(Rectangle Rectangle, PaintEventArgs e, Color Color, bool Pressed)
        {
            using (var gp = CreateRoundRectangle(Rectangle, 2))
            {
                var opacity = 0x7f;

                using (Brush brush = new SolidBrush(Color.FromArgb(opacity, Color)))
                {
                    e.Graphics.FillPath(brush, gp);
                }
            }

            using (var clip = CreateRoundRectangle(Rectangle, 2))
            {
                e.Graphics.SetClip(clip, CombineMode.Intersect);

                using (var gp = CreateBottomRadialPath(Rectangle))
                {
                    using (var brush = new PathGradientBrush(gp))
                    {
                        var opacity = (int) (0xB2*.99f + .5f);

                        var bounds = gp.GetBounds();

                        brush.CenterPoint = new PointF((bounds.Left + bounds.Right)/2f, (bounds.Top + bounds.Bottom)/2f);
                        brush.CenterColor = Color.FromArgb(opacity, Color.White);
                        brush.SurroundColors = new[] {Color.FromArgb(0, Color.White)};

                        e.Graphics.FillPath(brush, gp);
                    }
                }

                e.Graphics.ResetClip();
            }

            var newRect = Rectangle;
            newRect.Height >>= 1;

            if (newRect.Width > 0 && newRect.Height > 0)
            {
                newRect.Height++;

                using (var gp = CreateTopRoundRectangle(newRect, 2))
                {
                    var opacity = Pressed ? (int) (.4f*0x9 + .5f) : 0x99;

                    newRect.Height++;

                    using (
                        var brush = new LinearGradientBrush(newRect, Color.FromArgb(opacity, Color.White),
                            Color.FromArgb(opacity/3, Color.White), LinearGradientMode.Vertical))
                    {
                        e.Graphics.FillPath(brush, gp);
                    }
                }
            }

            var Y = Rectangle.Y + Rectangle.Height - 1;

            // e.Graphics.DrawLine(new Pen(Color.Black), Rectangle.Left, Y, Rectangle.Right, Y);
        }
开发者ID:CheesyKek,项目名称:ScpToolkit,代码行数:61,代码来源:ScpButton.cs

示例5: DrawFilledBox

 public static void DrawFilledBox(float x, float y, float w, float h, Color Color, int alpha = 255)
 {
     Vector2[] vertexList = new Vector2[2];
     DXLine.GLLines = true;
     DXLine.Antialias = false;
     DXLine.Width = w;
     vertexList[0].X = x + (w / 2f);
     vertexList[0].Y = y;
     vertexList[1].X = x + (w / 2f);
     vertexList[1].Y = y + h;
     DXLine.Begin();
     DXLine.Draw(vertexList, Color.FromArgb(alpha, Color.R, Color.G, Color.B));
     DXLine.End();
 }
开发者ID:FonograF,项目名称:Grenshot-modify,代码行数:14,代码来源:Main.cs

示例6: Update

 public void Update()
 {
     switch (Order.Status)
     {
         case OrderStatus.New:
             Color = Color.FromArgb(255, 255, 230);
             break;
         case OrderStatus.PartiallyFilled:
             Color = Color.SkyBlue;
             break;
         case OrderStatus.Filled:
             Color = Color.FromArgb(220, 255, 220);
             break;
         case OrderStatus.Cancelled:
             Color = Color.FromArgb(255, 230, 230);
             break;
     }
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:18,代码来源:OrderManagerWindow.cs

示例7: ColorSlide

        private void ColorSlide(object sender, MouseEventArgs e, ColorComponents colorComponent)
        {
            Control control = (sender as Control);

            int xLocation = e.X.Clamp(0, control.ClientRectangle.Width);
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                byte newValue = (byte)ScaleRange(xLocation, 0, control.ClientRectangle.Width, 0, 255);

                switch (colorComponent)
                {
                    case ColorComponents.Red:
                        Color = Color.FromArgb(color.A, newValue, color.G, color.B);
                        break;

                    case ColorComponents.Green:
                        Color = Color.FromArgb(color.A, color.R, newValue, color.B);
                        break;

                    case ColorComponents.Blue:
                        Color = Color.FromArgb(color.A, color.R, color.G, newValue);
                        break;

                    case ColorComponents.Alpha:
                        Color = Color.FromArgb(newValue, color.R, color.G, color.B);
                        break;
                }
            }
        }
开发者ID:kskjer,项目名称:SceneNavi,代码行数:29,代码来源:ColorPickerDialog.cs

示例8: LoadDetails

        public override void LoadDetails(XmlNode node, KmlRoot owner)
        {
            base.LoadDetails(node, owner);

            Color = GetColor(node);

            ColorMode = GetColorMode(node);

            if (ColorMode == KmlColorModes.Random)
            {
                byte red = (Byte)(Color.R * rnd.NextDouble());
                byte green = (Byte)(Color.G * rnd.NextDouble());
                byte blue = (Byte)(Color.B * rnd.NextDouble());
                byte alpha = (Byte)(Color.A * rnd.NextDouble());
                Color = Color.FromArgb(alpha, red, green, blue);
            }
        }
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:17,代码来源:KmlObject.cs

示例9: LoadFromJson

 /// <summary>
 /// Load the label from a github api json representation.
 /// </summary>
 /// <param name="json">The github api json representation</param>
 public override void LoadFromJson(JObject json)
 {
     Name = json["name"].Value<string>();
     Color = Color.Empty;
     var c = json["color"];
     int ic;
     if (Int32.TryParse(json["color"].Value<string>(), NumberStyles.HexNumber, null, out ic)) Color = Color.FromArgb(ic);
 }
开发者ID:oleholstandersen,项目名称:GitScrum,代码行数:12,代码来源:GitLabel.cs

示例10: EcuacionPhong


//.........这里部分代码省略.........
			byte g = 0;
			byte b = 0;
			long rr = 0;
			long gg = 0;
			long bb = 0;
			long trr = 0;
			long tgg = 0;
			long tbb = 0;
			double Escalar = 0;
			double Ambiente = 0;
			double Difusa = 0;
			double Especular = 0;

			double AmbienteR = 0;
			double DifusaR = 0;
			double EspecularR = 0;
			double AmbienteG = 0;
			double DifusaG = 0;
			double EspecularG = 0;
			double AmbienteB = 0;
			double DifusaB = 0;
			double EspecularB = 0;

			trr = 0;
			tgg = 0;
			tbb = 0;

			Vista = new Vector3D(Camara.Posicion, PuntoSUR);
			Vista.Normalizar();

			Ambiente = Constantes.Ambiente;
			NormalSUR.Normalizar();

			for (long i = 0; i <= Focos.GetUpperBound(0); i++) {
				Rayo = new Vector3D(Focos[i].Coordenadas, PuntoSUR);
				Rayo = !Rayo.VectorUnitario;
				Salida = (((2 * (NormalSUR * Rayo)) * NormalSUR) - Rayo).VectorUnitario;

				Difusa = Focos[i].Intensidad * (Constantes.Difusa * (NormalSUR * Rayo));
				Escalar = (Salida * Vista);
				if (Escalar < 0) {
					Especular = Math.Abs((Constantes.Especular * Math.Pow(Escalar, Constantes.ExponenteEspecular)));
				} else {
					Especular = 0;
				}

				AmbienteR = Ambiente * (Focos[i].Color.R / 255);
				DifusaR = Difusa * (Focos[i].Color.R / 255);
				EspecularR = Especular * (Focos[i].Color.R / 255);

				AmbienteG = Ambiente * (Focos[i].Color.G / 255);
				DifusaG = Difusa * (Focos[i].Color.G / 255);
				EspecularG = Especular * (Focos[i].Color.G / 255);

				AmbienteB = Ambiente * (Focos[i].Color.B / 255);
				DifusaB = Difusa * (Focos[i].Color.B / 255);
				EspecularB = Especular * (Focos[i].Color.B / 255);

				rr = Color.R * (AmbienteR + DifusaR);
				rr = rr + ((Focos[i].Color.R - rr) * EspecularR);

				gg = Color.G * (AmbienteG + DifusaG);
				gg = gg + ((Focos[i].Color.G - gg) * EspecularG);

				bb = Color.B * (AmbienteB + DifusaB);
				bb = bb + ((Focos[i].Color.B - bb) * EspecularB);

				if (rr < 0)
					rr = 0;
				if (gg < 0)
					gg = 0;
				if (bb < 0)
					bb = 0;

				trr += rr;
				tgg += gg;
				tbb += bb;
			}

			if (trr > 255)
				trr = 255;
			if (trr < 0)
				trr = 0;

			if (tgg > 255)
				tgg = 255;
			if (tgg < 0)
				tgg = 0;

			if (tbb > 255)
				tbb = 255;
			if (tbb < 0)
				tbb = 0;

			r = trr;
			g = tgg;
			b = tbb;

			return Color.FromArgb(255, r, g, b);
		}
开发者ID:Manu343726,项目名称:Motor3D_2.0,代码行数:101,代码来源:PhongShader.cs

示例11: Fusionar

		public Color Fusionar()
		{
			if (mHijos == null) {
				return mColor;
			} else {
				long r = 0;
				long g = 0;
				long b = 0;
				Color Color = default(Color);

				r = 0;
				g = 0;
				b = 0;

				for (int i = 0; i <= 7; i++) {
					Color = mHijos[i].Fusionar();
					r += Color.R;
					g += Color.G;
					b += Color.B;
				}

				return Color.FromArgb(255, r / 8, g / 8, b / 8);
			}
		}
开发者ID:Manu343726,项目名称:Motor3D_2.0,代码行数:24,代码来源:SectorOctreeGrafico.cs


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