Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With the caveat that I've never used it, just ran across it once, thought "neat!" and moved on...</p> <p>Look into <a href="http://msdn.microsoft.com/en-us/library/fbkz3sfb%28v=VS.100%29.aspx" rel="nofollow noreferrer">System.Drawing.Drawing2D.GraphicsPath</a> and setting the form's <code>Region</code> property. I added two buttons to the basic Windows forms application: </p> <pre><code>public Form1() { InitializeComponent(); Rectangle r1 = new Rectangle(button1.Location, button1.Size); Rectangle r2 = new Rectangle(button2.Location, button2.Size); GraphicsPath gp = new GraphicsPath(); gp.AddRectangle(r1); gp.AddRectangle(r2); this.Region = new Region(gp); } </code></pre> <p>I've approximated the shape of the button with a rectangle; with this code, you can see the form background color at the buttons' corners. You'll need to work out the enclosing path for each of your controls and add them to the path individually. You'll need to take into account any offset introduced by the form title bar or border style.</p> <p>Update: I did some investigation and have a couple of possible approaches for the problem:</p> <ul> <li>Using the <code>GraphicsPath</code> method, set <code>pictureBox.Visible</code> to <code>False</code> if there is no image loaded.</li> <li>When you load an image into the picture box, analyze the image to get a list of all the colors in it, then randomly generate one that isn't. Set the form's <code>BackColor</code> and <code>TransparencyKey</code> properties to match this new color, <a href="https://stackoverflow.com/questions/2792321/how-do-i-make-a-form-transparent-while-keeping-the-controls-fully-visible/2795062#2795062">Hans Passant's</a> answer.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload