在splitcontainer控件得panel上怎么画图?
黄剑波(853964811) 8:44:20
在splitcontainer的panel中画图,结果成这样了,为什么?
黄剑波(853964811) 8:44:59
黄剑波(853964811) 8:45:22
只有边框画了一点
黄剑波(853964811) 8:46:06
private void 管柱力学_Load(object sender, EventArgs e)
{
int left = this.splitContainer1.Panel2.Left;
int top = this.splitContainer1.Panel2.Top;
int bottom = this.splitContainer1.Panel2.Bottom;
int right = this.splitContainer1.Panel2.Right;
int S_huipinjuli =right-left ;
int C_huizhi=bottom -top ;
Size Size1=new Size(S_huipinjuli ,C_huizhi );
Point lefttop =new Point(left, top);
Point righttop =new Point(right ,top);
Point leftbottom =new Point(left,bottom );
Point rightbottom = new Point(right, bottom);
Rectangle rect = new Rectangle(lefttop,Size1);
string path = " F:\\TDDOWNLOAD\\中国地图电子版 jpg高清晰版\\中华人民共和国地图.jpg ";
FileStream fileStream = new FileStream(path, FileMode.Open);
BinaryReader br = null;
byte[] byteBuffer = null;
br = new BinaryReader(fileStream);
byteBuffer = br.ReadBytes((int)fileStream.Length);
img = Image.FromStream(new MemoryStream(byteBuffer));//
Point [] point1Dui=new Point [3];
point1Dui[0] = lefttop;
point1Dui[1] = righttop;
point1Dui[2] = rightbottom;
GraphicsUnit D_liangdanwei = GraphicsUnit.Pixel ;
Graphics g1 = CreateGraphics();
g1.DrawImage(img, point1Dui, rect, D_liangdanwei);
fileStream.Close();
}
private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e)
{
int left = this.splitContainer1.Panel2.Left;
int top = this.splitContainer1.Panel2.Top;
int bottom = this.splitContainer1.Panel2.Bottom;
int right = this.splitContainer1.Panel2.Right;
int S_huipinjuli = right - left;
int C_huizhi = bottom - top;
Size Size1 = new Size(S_huipinjuli, C_huizhi);
Point lefttop = new Point(left, top);
Point righttop = new Point(right, top);
Point leftbottom = new Point(left, bottom);
Point rightbottom = new Point(right, bottom);
Rectangle rect = new Rectangle(lefttop, Size1);
string path = " F:\\TDDOWNLOAD\\中国地图电子版 jpg高清晰版\\中华人民共和国地图.jpg ";
BinaryReader br = null;
byte[] byteBuffer = null;
Point[] point1Dui = new Point[3];
point1Dui[0] = lefttop;
point1Dui[1] = righttop;
point1Dui[2] = rightbottom;
GraphicsUnit D_liangdanwei = GraphicsUnit.Pixel;
Graphics g1 = CreateGraphics();
g1.DrawImage(img, point1Dui, rect, D_liangdanwei);
}
黄剑波(853964811) 8:46:50
好像panel2把图挡住了
黄剑波(853964811) 8:46:58
为什么咧?