【发布时间】:2016-12-09 16:19:06
【问题描述】:
我目前正在尝试将注释放在五线谱图像之上。但是,注释背景被设置为如图所示的表单背景。 使用的图像类型是 png。
//class music staff
public MusicStaff(int xLoc, int yLoc, int xSize, int ySize)
{
this.SetBounds(xLoc, yLoc, xSize, ySize);
this.Visible = true;
ResourceManager rm = Resources.ResourceManager;
Bitmap bmp = (Bitmap)rm.GetObject("Staff1");
this.BackgroundImage = bmp;
this.BackgroundImageLayout = ImageLayout.Stretch;
this.BackColor = Color.White;
//adding the background pic
panel4 = new MusicStaff(3, 62, 927, 150);
//adding a note
MusicNote p = new MusicNote(pitch, duration, shape, s);
p.SizeMode = PictureBoxSizeMode.StretchImage;
p.BackColor = Color.Transparent;
p.Size = new Size(50, 75);
p.Location = new Point(xCounter + starterX, NoteLocations.c0.mainPoint);
Bitmap myImage = (Bitmap)rm.GetObject(shape);
p.Image = myImage;
【问题讨论】:
-
发布您拥有的任何代码,以便每个人都知道从哪里开始提供帮助
-
ok 添加代码
-
代码看起来有点被截断,一般来说这很好,但在这种情况下,我需要更多的时间来获得更多的上下文,看看到底发生了什么。
-
要透明,您的位图需要有一个 Alpha 通道。可以在构造函数中使用正确的 PixelFormat 或调用 MakeTransparent() 方法来创建它。
-
您的问题解决了吗?