在splitcontainer控件得panel上怎么画图?

huangjianbo 2010-12-01 09:19:49
黄剑波(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
为什么咧?
...全文
165 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangjianbo 2010-12-01
  • 打赏
  • 举报
回复
呵呵。太好了
huangjianbo 2010-12-01
  • 打赏
  • 举报
回复
解决了

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧