我遇到了一个问题,因为我希望将一个PictureBox放在一个面板上,该面板被绘制为钢琴五线谱。我遇到的问题是在使用.Transparent
时,它只是给了我一个控制颜色表单,这个表单是不正确的,有一个带有线条的五线谱。我该怎么办?
编辑:
如何编写代码以使所有内容成为Panel,Hans?代码:如何编写代码以使所有内容成为Panel,Hans?
代码:
class MusicNote : PictureBox
{
public string path = "ImagesName\\";
public string noteShape = "";
public int time = 0;
public MusicNote(int iTime, string iNoteShape, int x, int y) : base()
{
noteShape = iNoteShape;
time = iTime;
Enabled = true;
Location = new Point(x, y);
Size = new Size(35, 35);
Image NoteBmp = Image.FromFile(path + noteShape + ".png");
Image = NoteBmp;
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
}
}
答案 0 :(得分:0)
在主窗体中添加的唯一必须完成的事情是将PictureBox的控件添加到Panel中。
Staff.Controls.Add(this.MNote);