Hi All

I want the form look like image.
I mean that the form should be shaped as the image.

for example when you click on skin mode in windows mediaplayer you will find the window like head shaped.

i want my form look like that

Pls any one help me please

Dani AI

Generated

Quick summary and practical advice building on 's request and the two suggestions already posted by and .

There are three practical ways to get a non-rectangular window:

  • easiest: color-key transparency (what hinted at) — set a single background color as the form's transparency key;
  • managed-shape: set the form's Region (GraphicsPath) or call the native SetWindowRgn (what pointed to) for a true shaped window;
  • best visual quality: use a layered window with per-pixel alpha (UpdateLayeredWindow) for anti-aliased edges and semi-transparent pixels (this is what real media-player skins typically use).

Which to pick:

  • Use TransparencyKey for a quick prototype or very simple, hard-edged shapes. It is easy but fragile: anti-aliased PNG edges will get fringes, and the key color must not appear inside the art.
  • Use Form.Region (managed) or SetWindowRgn for crisp cutouts and correct hit-testing: mouse clicks outside the region are ignored. Regions are binary — no semi-transparency or smooth blended edges.
  • Use a layered window (UpdateLayeredWindow) when you need smooth edges, shadows or semi-transparency. It requires drawing your window into a bitmap and is a bit more work (you usually draw the whole window yourself).

Practical notes and gotchas:

  • Remove the border (FormBorderStyle = None) and position the image so the transparent areas match the region/key.
  • If using TransparencyKey, pick a color not present in the artwork and avoid anti-aliased borders.
  • If you go layered, be prepared to render child controls yourself (layered windows are typically composited from a single bitmap).
  • For managed code, the Form.Region property is the simplest managed API; the native SetWindowRgn and UpdateLayeredWindow are in the Win32 API if you need lower-level control (Form.TransparencyKey, , SetWindowRgn, UpdateLayeredWindow).

Recommended Answers

All 2 Replies

You could probably accomplish this, at least in a basic format, using the transparency color key for the form itself. (i.e. lime green is transparent, and having the background of the image/skin be the lime green). I'm sure there is a better method though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.