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


C# ImageAttributes.SetColorKey方法代码示例

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


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

示例1: Tasklist

        // ctor
        public Tasklist()
        {
            // init colors
            this.BackColor = Const.BackColor;
            this.ForeColor = Const.CaptionColor;

            // gdi objects
            CreateGdiObjects();

            // state icons
            m_icons = new Bitmap[5];
            m_icons[0] = LoadImage("new.bmp");
            m_icons[1] = LoadImage("inProcess.bmp");
            m_icons[2] = LoadImage("complete.bmp");
            m_icons[3] = LoadImage("fail.bmp");
            m_icons[4] = LoadImage("cancelled.bmp");

            // need to draw transparent
            m_iconAttributes = new ImageAttributes();
            m_iconAttributes.SetColorKey(Color.Yellow, Color.Yellow);

            // store list of task items
            m_list = new ArrayList();

            // scroll bar
            m_scrollBar = new VScrollBar();
            m_scrollBar.Bounds = new Rectangle(0, 0, 4, 100);
            m_scrollBar.ValueChanged += new System.EventHandler(this.scrollBar_ValueChanged);
            this.Controls.Add(m_scrollBar);
        }
开发者ID:matthiase,项目名称:odeo-mobile,代码行数:31,代码来源:Tasklist.cs

示例2: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     ImageAttributes attributes = new ImageAttributes();
     Color clr = ((Bitmap)this.Image).GetPixel(0, 0);
     attributes.SetColorKey(clr, clr);
     e.Graphics.DrawImage(this.Image, new Rectangle((this.Width - this.Image.Width) / 2, (this.Height - this.Image.Height) / 2, this.Image.Width, this.Image.Height), 0, 0, this.Image.Width, this.Image.Height, GraphicsUnit.Pixel, attributes);
 }
开发者ID:nbclark,项目名称:mobile-remote,代码行数:7,代码来源:SplashScreen.cs

示例3: Draw

        public override void Draw()
        {
            Bitmap DropImage = new Bitmap(GameResources.Instance.DropImage);

            ImageAttributes attr = new ImageAttributes();
            attr.SetColorKey(DropImage.GetPixel(0, 0), DropImage.GetPixel(0, 0));

            Game.Instance.Canvas.DrawImage(DropImage, new Rectangle(left, top, width, height), 0, 0, DropImage.Width, DropImage.Height, GraphicsUnit.Pixel, attr);
        }
开发者ID:paulvancoller,项目名称:Dodge_Paul,代码行数:9,代码来源:Drop.cs

示例4: BigButton

        static BigButton()
        {
            _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              _Font = new Font(
            FontFamily.GenericSansSerif, 12, FontStyle.Bold
              );
        }
开发者ID:dada,项目名称:theresa,代码行数:9,代码来源:BigButton.cs

示例5: drawIcon

 private void drawIcon(Graphics g)
 {
     // set image attributes
     ImageAttributes attrs = new ImageAttributes();
     //attrs.SetColorKey(icon.GetPixel(0, 0), icon.GetPixel(0, 0));
     attrs.SetColorKey(Color.Transparent, Color.Transparent);
     Rectangle rDest = new Rectangle(0, 0, icon.Width, icon.Height);
     // Draws the image
     g.DrawImage(icon, rDest, 0, 0, icon.Width, icon.Height, GraphicsUnit.Pixel, attrs);
 }
开发者ID:misiek,项目名称:foo,代码行数:10,代码来源:PoiPanel.cs

示例6: RuntimeImageProcessor

 public RuntimeImageProcessor(BookRenamedEvent bookRenamedEvent)
 {
     _bookRenamedEvent = bookRenamedEvent;
     _originalPathToProcessedVersionPath = new ConcurrentDictionary<string, string>();
     _imageFilesToReturnUnprocessed = new ConcurrentDictionary<string, bool>();
     _cacheFolder = Path.Combine(Path.GetTempPath(), "Bloom");
     _bookRenamedEvent.Subscribe(OnBookRenamed);
     _convertWhiteToTransparent = new ImageAttributes();
     _convertWhiteToTransparent.SetColorKey(Color.FromArgb(253, 253, 253), Color.White);
 }
开发者ID:BloomBooks,项目名称:BloomDesktop,代码行数:10,代码来源:RuntimeImageProcessor.cs

示例7: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     g.Clear(BackColor);
     // set image attributes
     ImageAttributes attrs = new ImageAttributes();
     attrs.SetColorKey(Color.Transparent, Color.Transparent);
     Rectangle rDest = new Rectangle(0, 0, Image.Width, Image.Height);
     // Draws the image
     g.DrawImage(Image, rDest, 0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel, attrs);
 }
开发者ID:misiek,项目名称:foo,代码行数:11,代码来源:TransparentPictureBox.cs

示例8: Sprite

        /// <summary>
        /// Instanciates a new Sprite class.
        /// </summary>
        public Sprite()
        {
            x = 0;
            y = 0;
            spriteSize = new Size(0, 0);
            collitionPoint = new Point(0, 0);
            collitionRectangle = new Rectangle(x, y, spriteSize.Width, spriteSize.Height);

            imgAttribs = new ImageAttributes();
            imgAttribs.SetColorKey(Color.FromArgb(0, 66, 173), Color.FromArgb(0, 66, 173));
        }
开发者ID:timdetering,项目名称:Pocket1945,代码行数:14,代码来源:Sprite.cs

示例9: DrawContent

 protected override void DrawContent(ControlGraphicsInfoArgs info)
 {
     info.Graphics.FillRectangle(info.Cache.GetSolidBrush(Color.White), info.ViewInfo.ClientRect);
     var icon = ((QuickHideEditViewInfo)info.ViewInfo).GetIcon;
     if (icon.Image == null)
     {
         icon.Image = Resources.Customization;
     }
     var attr = new ImageAttributes();
     attr.SetColorKey(icon.TransperentColor, icon.TransperentColor);
     info.Graphics.DrawImageUnscaled(icon.Image, info.ViewInfo.ClientRect);
 }
开发者ID:Demotron,项目名称:AdminTools,代码行数:12,代码来源:QuickHideEditPainter.cs

示例10: XyPad

        public XyPad(Skin skin)
            : base(skin)
        {
            AdditionalProperty propSpeed = new AdditionalProperty();
              propSpeed.Name = "speed";
              propSpeed.Label = "Speed";
              propSpeed.Min = 0;
              propSpeed.Max = 10;
              propSpeed.Value = 0;
              _Config.AdditionalProperties.Add(propSpeed);

              AdditionalProperty propRestX = new AdditionalProperty();
              propRestX.Name = "restx";
              propRestX.Label = "Rest X";
              propRestX.Min = 0;
              propRestX.Max = 127;
              propRestX.Value = 64;
              _Config.AdditionalProperties.Add(propRestX);

              AdditionalProperty propRestY = new AdditionalProperty();
              propRestY.Name = "resty";
              propRestY.Label = "Rest Y";
              propRestY.Min = 0;
              propRestY.Max = 127;
              propRestY.Value = 64;
              _Config.AdditionalProperties.Add(propRestY);

              _Config.CCMeaning = "X";
              _Config.CC2Meaning = "Y";

              BackToRest = new Timer();
              BackToRest.Interval = 20;
              BackToRest.Tick += new EventHandler(BackToRest_Tick);

              Width = 138;
              Height = 138;

              _BackBrush = new SolidBrush(Color.Black);
              _SelBrush = new SolidBrush(Color.Red);
              _BackRect = new Rectangle(1, 11, Width-2, 127);
              _SelRect = new Rectangle(1, 30, 34, 30);
              _Value = 64;
              _Value2 = 64;
              CalcSelRect();

              _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              this.MouseDown += new MouseEventHandler(OnMouseDown);
              this.MouseMove += new MouseEventHandler(OnMouseMove);
              this.MouseUp += new MouseEventHandler(OnMouseUp);
              CalcSelRect();
        }
开发者ID:dada,项目名称:theresa,代码行数:53,代码来源:XyPad.cs

示例11: testForm

        public testForm()
        {
            InitializeComponent();

            noise = new NoiseGenerator((int)DateTime.Now.Ticks);

            planetGfx = panel1.CreateGraphics();
            surfaceGfx = panel2.CreateGraphics();

            imageAttributes = new ImageAttributes();
            imageAttributes.SetColorKey(Color.FromArgb(255, 0, 255), Color.FromArgb(255, 0, 255));
        }
开发者ID:ngaspar,项目名称:Planets,代码行数:12,代码来源:testForm.cs

示例12: DrawPanelPaint

		private void DrawPanelPaint(object sender, System.Windows.Forms.PaintEventArgs e)
		{

			Graphics g = e.Graphics;
			Brush b = null;
			Pen p = null;

			try			// never want to die in here
			{
				b = new SolidBrush(this.Enabled? this.BackColor: Color.LightGray);
				g.FillRectangle(b, e.ClipRectangle);
				if (bIn && this.Enabled)
					g.DrawRectangle(Pens.Blue, 0, 0, this.Width-1, this.Height-1);

				if (this.Image != null)
				{
					int x = (this.Width - this.Image.Width) / 2;
					int y = (this.Height - this.Image.Height) / 2;
					if (bDown && bIn)
					{
						x += 1;
						y += 1;
					}

					// Draw System.Drawing.Image using the transparency color
					ImageAttributes imageAttr = new ImageAttributes();
					imageAttr.SetColorKey(_Transparency, _Transparency,
						ColorAdjustType.Default);

					g.DrawImage(this.Image,         // System.Drawing.Image
						new System.Drawing.Rectangle(x, y, this.Image.Width, this.Image.Height),    // Dest. rect.
						0,							// srcX
						0,							// srcY
						this.Image.Width,           // srcWidth
						this.Image.Height,          // srcHeight
						GraphicsUnit.Pixel,			// srcUnit
						imageAttr);					// ImageAttributes
				}
				else
				{
					StringFormat format = new StringFormat(StringFormatFlags.NoWrap);
					g.DrawString(this.Text, this.Font, Brushes.Black, new System.Drawing.Rectangle(2, 2, this.Width, this.Height), format);
				}
			}
			catch {}	// todo draw the error message
			finally
			{
				if (b != null)
					b.Dispose();
				if (p != null)
					p.Dispose();
			}
		}
开发者ID:JackWangCUMT,项目名称:rdlc.report.engine,代码行数:53,代码来源:SimpleButton.cs

示例13: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (e != null)
            {
                e.Graphics.FillRectangle(SystemBrushes.Control, e.ClipRectangle);
                if (arrowsImage != null)
                    e.Graphics.DrawImage(arrowsImage, e.ClipRectangle,
                        new Rectangle(e.ClipRectangle.X * scale_coeff,
                            e.ClipRectangle.Y * scale_coeff,
                            e.ClipRectangle.Width * scale_coeff,
                            e.ClipRectangle.Height * scale_coeff), GraphicsUnit.Pixel);

                if (graph != null)

                    for (int i = graph.VertexCount - 1; i >= 0; i--)
                        if (/*i != movingIndex &&*/
                            chargesScaled[i].y - Charge.radius <= e.ClipRectangle.Bottom &&
                            chargesScaled[i].y + Charge.radius >= e.ClipRectangle.Top &&
                            chargesScaled[i].x - Charge.radius <= e.ClipRectangle.Right &&
                            chargesScaled[i].x + Charge.radius >= e.ClipRectangle.Left
                            )
                        {
                        //if (VertexLayers[i].UseTransparentcy)
                        //{
                            using (ImageAttributes imageAttributes = new ImageAttributes())
                            {
                                imageAttributes.SetColorKey(TransparentColor, TransparentColor);
                                e.Graphics.DrawImage(
                                    vertexImage[i],
                                    new Rectangle(chargesScaled[i].x - Charge.radius,
                                                  chargesScaled[i].y - Charge.radius,
                                                  Charge.radius * 2,
                                                  Charge.radius * 2),
                                    0, 0, Charge.radius * 2 * scale_coeff + 4, Charge.radius * 2 * scale_coeff + 4,
                                    GraphicsUnit.Pixel,
                                    imageAttributes
                                    );
                            }
                        //}
                        //else
                        //{
                        //e.Graphics.DrawImage(vertexImage[i],
                        //    chargesScaled[i].x - Charge.radius,
                        //    chargesScaled[i].y - Charge.radius,
                        //    Charge.radius * 2,
                        //    Charge.radius * 2);
                        ////}
                    }
            }
        }
开发者ID:svtz,项目名称:GraphLabs,代码行数:51,代码来源:GraphDraw.cs

示例14: PushButton

        public PushButton(Skin skin)
            : base(skin)
        {
            Width = 36;
              Height = 45;

              _BlackBrush = new SolidBrush(Color.Black);

              _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              this.MouseDown += new MouseEventHandler(OnMouseDown);
              InitGraphics();
        }
开发者ID:dada,项目名称:theresa,代码行数:14,代码来源:PushButton.cs

示例15: Chart1_PostPaint

        private void Chart1_PostPaint(object sender, ChartPaintEventArgs e)
        {
            // Painting series object
            if(e.ChartElement is Series)
            {
                // Add custom painting only to the series with name "Series2"
                Series series = (Series)e.ChartElement;
                if(series.Name == "Series2" && series.Tag == null)
                {
                    // Find data point with maximum Y value
                    DataPoint	dataPoint = series.Points.FindMaxByValue();

                    // Load bitmap from file
                    System.Drawing.Image bitmap = Bitmap.FromFile(this.Page.MapPath("money.png"));

                    // Set White color as transparent
                    ImageAttributes attrib = new ImageAttributes();
                    attrib.SetColorKey(Color.White, Color.White, ColorAdjustType.Default);

                    // Calculates marker position depending on the data point X and Y values
                    RectangleF	imagePosition = RectangleF.Empty;
                    imagePosition.X = (float)e.ChartGraphics.GetPositionFromAxis(
                        "Chart Area 1", AxisName.X, dataPoint.XValue);
                    imagePosition.Y = (float)e.ChartGraphics.GetPositionFromAxis(
                        "Chart Area 1", AxisName.Y, dataPoint.YValues[0]);
                    imagePosition = e.ChartGraphics.GetAbsoluteRectangle(imagePosition);
                    imagePosition.Width = bitmap.Width;
                    imagePosition.Height = bitmap.Height;
                    imagePosition.Y -= bitmap.Height;
                    imagePosition.X -= bitmap.Width /2;

                    // Draw image
                    e.ChartGraphics.Graphics.DrawImage(bitmap,
                        Rectangle.Round(imagePosition),
                        0, 0, bitmap.Width, bitmap.Height,
                        GraphicsUnit.Pixel,
                        attrib);

                    // Add a custom map area in the coordinates of the image
                    RectangleF	rect = e.ChartGraphics.GetRelativeRectangle(imagePosition);

                    MapArea area = new MapArea("Maximum Y value marker. Y = " + dataPoint.YValues[0], "money.htm", "target=\"_blank\"", String.Empty, rect, null);
                    Chart1.MapAreas.Add(area);
                    // Dispose image object
                    bitmap.Dispose();

                    series.Tag = true;
                }
            }
        }
开发者ID:samuellin124,项目名称:cms,代码行数:50,代码来源:ImageMapCustom.aspx.cs


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