日期:2014-05-17  浏览次数:20918 次

用消息来进行重绘后,其他控件的BackColor = Color.Transparent不起作用了。怎么解决这个问题。
用消息来进行重绘后,其他控件的BackColor = Color.Transparent不起作用了。怎么解决这个问题。


this.BackgroundImage = Resource.test;
this.BackgroundImageLayout = ImageLayout.Stretch;
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
来解决背景的问题是不错的,但是我可能要更复杂的动作,应该怎么解决。



public partial class Form1 : Form {
public oForm() {
Label aLabel = new Label();
aLabel.AutoSize = true;
aLabel.BackColor = Color.Transparent;
aLabel.Location = new Point(67, 84);
aLabel.Size = new Size(137, 48);
aLabel.Text = "label1aaaaaaaaaa\r\ndsdddddddddddd\ndddddddd\r\nddddddddd";
this.Controls.Add(aLabel);
}

protected override void WndProc(ref Message m) {
if (m.Msg == 13) {
using (Graphics g = this.CreateGraphics()) {
g.DrawImage(Resource.test, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height);
}
return;
}
base.WndProc(ref m);
}
}

------最佳解决方案--------------------
来捧个场,
------其他解决方案--------------------
该回复于2012-12-09 13:50:18被管理员删除
------其他解决方案--------------------
该回复于2012-12-02 10:48:36被管理员删除
------其他解决方案--------------------
我勒个靠啊,围观群众都没有吗
------其他解决方案--------------------
回复一下啦,好结贴
------其他解决方案--------------------
null