水平交错效果显示图像
发布时间:2020-12-14 05:15:12 所属栏目:大数据 来源:网络整理
导读:实现效果: 知识运用: Bitmap类的GetPixel和SetPixel方法 实现代码: private void button1_Click(object sender,EventArgs e) { int intWidth = this.BackgroundImage.Width; int intHeight = this.BackgroundImage.Height; Graphics myGraphics = this.Cr
实现效果: 知识运用: Bitmap类的GetPixel和SetPixel方法 实现代码: private void button1_Click(object sender,EventArgs e) { int intWidth = this.BackgroundImage.Width; int intHeight = this.BackgroundImage.Height; Graphics myGraphics = this.CreateGraphics(); Bitmap myBitmap=(Bitmap)this.BackgroundImage.Clone(); Bitmap bitmap = new Bitmap(intWidth,intHeight); myGraphics.Clear(Color.WhiteSmoke); int i=0; while(i<=intWidth/2) { for (int m = 0; m <= intHeight-1; m++) { bitmap.SetPixel(i,m,myBitmap.GetPixel(i,m)); } for (int m = 0; m <=intHeight-1; m++) { bitmap.SetPixel(intWidth - i-1,myBitmap.GetPixel(intWidth - i-1,m)); } i++; this.Refresh(); this.BackgroundImage = bitmap; System.Threading.Thread.Sleep(10); } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |