|
|
|
The General Winforms Interview Questions consists the most frequently
asked questions in Winforms. This list of 100+ questions guage your familiarity
with the Winforms platform. The q&a have been collected over a period
of time from various blogs, forums and other similar Winforms sites
|
39. GDI+ Paths & Regions
|
| 39.1 What is a
GraphicsPath?
|
| 39.2 How can I create
non-rectangular windows?
|
| 39.3 Is there a imagemap like
control in Windows Forms?
|
39.1 What is a GraphicsPath?
|
|
The GraphicsPath class represents a series of connected lines and curves.
|
39.2 How can I create non-rectangular windows?
|
There are 2 ways to create non-rectangular windows:
1) The Control.Region property (Form inherits this of course):
|
[CS]
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(0,0,100,100);
gp.AddRectangle(50,50,100,100);
this.Region = new Region(gp);
[VB.NET]
Dim gp As New GraphicsPath()
gp.AddEllipse(0, 0, 100, 100)
gp.AddRectangle(50, 50, 100, 100)
Me.Region = New [Region](gp)
|
|
2) Use the Form.TransparencyKey property. This tells the form not to paint any
pixels that match the color of the TransparencyKey. So you can make your fancy
skin bitmap, then set the TransparencyKey to be, say Color.Red, then all the
pixels that are RGB(255,0,0) will be transparent.
|
39.3 Is there a imagemap like control in Windows Forms?
|
|
There isn't one out of the box. But check out this codeproject article for a
control that provides this functionality.
|
|