简单的问题如何简单化(如何使PictureBox控件透明显示)?
有一个PictureBox控件上动态加载了两个PictureBox子控件(大小和位置都相同),在两个子控件上分别画了一条直线,如何让这两条直线同时显示呢?
目前只能看到上面的那条直线
简单代码示例如下:
Dim Line_G As Graphics
Dim Line_p As New Pen(Color.Black) '默认线的颜色
'第一个控件绘图
Dim Tmp_Picture1 As New PictureBox
Tmp_Picture1.Location = New System.Drawing.Point(5, 5)
Tmp_Picture1.Size = New System.Drawing.Size(60, 30)
Dim Tmp_B As New Bitmap(60, 30)
Line_G = Graphics.FromImage(Tmp_B)
Line_G.DrawRectangle(Line_p, 0, 0, 59, 29) '画矩形框
Line_G.DrawLine(Line_p, 5, 5, 55, 5) '画线
Tmp_Picture1.Image = Tmp_B
PictureBox1.Controls.Add(Tmp_Picture1) '加载控件
'第二个控件绘图
Dim Tmp_Picture2 As New PictureBox
Dim Line_p1 As New Pen(Color.Red) '默认线的颜色
Tmp_Picture2.Location = New System.Drawing.Point(5, 5)
Tmp_Picture2.Size = New System.Drawing.Size(60, 30)
Dim Tmp_B1 As New Bitmap(60, 30)
Line_G = Graphics.FromImage(Tmp_B1)
Line_G.DrawRectangle(Line_p, 0, 0, 59, 29) '画矩形框
Line_G.DrawLine(Line_p1, 5, 10, 55, 10) '画线
Tmp_Picture2.Image = Tmp_B1
PictureBox1.Controls.Add(Tmp_Picture2) '加载控件
'如何设置才能同时看到第一个控件和第二个控件中画的直线呢?