加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

实现推拉效果显示图片

发布时间:2020-12-14 05:15:17 所属栏目:大数据 来源:网络整理
导读:实现效果: 知识运用: Bitmap类的Clone方法复制图像 实现代码: private void button1_Click(object sender,EventArgs e) { Bitmap myBitmap =(Bitmap)this.BackgroundImage.Clone(); Graphics myGraphics = this.CreateGraphics(); myGraphics.Clear(Color

实现效果:

  

知识运用:

  Bitmap类的Clone方法复制图像

实现代码:

        private void button1_Click(object sender,EventArgs e)
        {
            Bitmap myBitmap =(Bitmap)this.BackgroundImage.Clone();
            Graphics myGraphics = this.CreateGraphics();
            myGraphics.Clear(Color.Black);                                           //以指定颜色清除
            for (int i = 0; i < this.Height;i++ )                                    //从上到下遍历图片
            {
                Rectangle rectangle1 = new Rectangle(0,this.Width,i);           //获取图片指定行的像素
                Rectangle rectangle2 = new Rectangle(0,this.Height-i,i+1);//获取图片当前行的一下区域
                Bitmap bitmap = myBitmap.Clone(rectangle2,PixelFormat.DontCare);
                myGraphics.DrawImage(bitmap,rectangle1);                             //绘制指定大小的图片
                this.Show();
            }
        }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读