Image Scaling

Scaling an image to cover custom control

Page 1 of 1

0 Replies - 623 Views - Last Post: 26 August 2009 - 02:41 PM Rate Topic: -----

#1 mager1794  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 133
  • Joined: 23-March 09

Image Scaling

Posted 26 August 2009 - 02:41 PM

I'm developing a custom panel control for my project, problem is i wanted it to be transparent because the background image of the form will be covered if not, but i have an image that resembles the group box, and i want it to scale to the size of the tool here is my code

this isn't working as its supposed to unforunately
can someone please help me

 public System.Drawing.Image Back = ProGFXToolsLibrary.Resource1.account;

		public MainPanel()
		{
		}

		protected override void OnPaint(PaintEventArgs e)
		{
			Graphics pGraphics = e.Graphics;
			pGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
			pGraphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;

			pGraphics.DrawImage(Back,new Rectangle(this.Location, this.Size),0,0, this.Width, this.Height,GraphicsUnit.Pixel);
			base.OnPaint(e);
		}

		protected override CreateParams CreateParams
		{
			get
			{
				CreateParams cp = base.CreateParams;
				cp.ExStyle |= 0x20;
				return cp;
			}
		}

		protected override void OnPaintBackground(PaintEventArgs e)
		{
		   // base.OnPaintBackground(e);
		}



Is This A Good Question/Topic? 0
  • +

Page 1 of 1