Note that there are some explanatory texts on larger screens.

plurals
  1. POSet overlapping two PictureBox
    primarykey
    data
    text
    <p>I have problem with creating two overlapping <code>PictureBox</code>es. I write my code like everyone told me but I have some problem:</p> <p>First: background is black (why?) Second: why tree appears two times?</p> <p>EDIT: Image <a href="http://i48.tinypic.com/2llnfrq.png" rel="nofollow">http://i48.tinypic.com/2llnfrq.png</a> (stack overflow had problem)</p> <p>This is sample code for test.</p> <pre><code>public partial class Form1 : Form { public Form1() { InitializeComponent(); this.AllowTransparency = true; MyPictureBox pb1 = new MyPictureBox(); MyPictureBox pb2 = new MyPictureBox(); pb1.Size = new Size(64, 64); pb1.Location = new Point(20, 20); pb1.BackColor = Color.Transparent; //pb1.SizeMode = PictureBoxSizeMode.Zoom; pb2.Size = new Size(64, 64); pb2.Location = new Point(52, 20); pb2.BackColor = Color.Transparent; pb1.Image = Image.FromFile("D:\\...\\Graphics\\Grounds\\woda1.png"); pb2.Image = Image.FromFile("D:\\...\\Graphics\\Objects\\tree1.png"); panel1.Controls.Add(pb2); panel1.Controls.Add(pb1); } private void panel1_Paint(object sender, PaintEventArgs e) { } } class MyPanel : Panel { protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.ExStyle |= 0x20; return cp; } } protected override void OnPaintBackground(PaintEventArgs e) { // Do Nothing } public MyPanel() { } } class MyPictureBox : PictureBox { protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.ExStyle |= 0x20; return cp; } } protected override void OnPaintBackground(PaintEventArgs e) { // Do Nothing } public MyPictureBox() { } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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