如何制作图片浏览器VB的

要求图片能缩小18090度旋转... 要求图片能缩小 180 90 度旋转 展开
 我来答
百度网友cc2f160de
2010-05-27 · 超过77用户采纳过TA的回答
知道小有建树答主
回答量:359
采纳率:0%
帮助的人:219万
展开全部
private void timer1_Tick(object sender, EventArgs e)
{

DirectoryInfo dir = new DirectoryInfo(@"..\..\picture");
FileInfo[] files = dir.GetFiles("*.jpg");
int length = files.Length;
Bitmap srcBitmap = new Bitmap(files[i].FullName);
myBitmap = new Bitmap(srcBitmap, this.pictureBox.Width, this.pictureBox.Height);
this.pictureBox.Image = srcBitmap;
i++;
Random r = new Random();
switch (r.Next(9))
{
case 0:
MiddletoSide();
break;
case 1:
Reversal();
break;
case 2:
Expand();
break;
case 3:
buttup();
break;
case 4:
buttleft();
}
if (i > files.Length - 1)
{
i = 0;
} break;
}
private void LeftoRight()
{
//左到右拉伸
g = this.pictureBox.CreateGraphics();
g.Clear(pictureBox.BackColor);
for (int x = 0; x <= width; x += 2)
{
Rectangle RectSrc = new Rectangle(0, 0, x, height);
g.DrawImage(myBitmap, RectSrc);
Thread.Sleep(30);
g.ResetTransform();
}

}

private void UptoDown()
{
//上到下拉伸
g = this.pictureBox.CreateGraphics();
g.Clear(pictureBox.BackColor);
for (int y = 0; y <= height; y += 2)
{
Rectangle RectSrc = new Rectangle(0, 0, width, y);
g.DrawImage(myBitmap, RectSrc);
Thread.Sleep(30);
g.ResetTransform();
}

}

private void MiddletoSide()
{
//中间向两边拉伸
g = this.pictureBox.CreateGraphics();
g.Clear(pictureBox.BackColor);
for (int y = 0; y <= width / 2; y += 10)
{
Rectangle RectDest = new Rectangle(width / 2 - y, 0, 2 * y, height);
Rectangle RectSrc = new Rectangle(0, 0, myBitmap.Width, myBitmap.Height);
g.DrawImage(myBitmap, RectDest, RectSrc, GraphicsUnit.Pixel);
Thread.Sleep(30);
g.ResetTransform();
}

}

private void Reversal()
{
//反转
g = this.pictureBox.CreateGraphics();
g.Clear(pictureBox.BackColor);
for (int x = -width / 2; x <= width / 2; x += 10)
{
Rectangle RectDest = new Rectangle(0, height / 2 - x, width, 2 * x);
Rectangle RectSrc = new Rectangle(0, 0, myBitmap.Width, myBitmap.Height);
g.DrawImage(myBitmap, RectDest, RectSrc, GraphicsUnit.Pixel);
Thread.Sleep(30);
g.ResetTransform();
}
}

private void Expand()
{
// 中间向四周扩散
g = this.pictureBox.CreateGraphics();
g.Clear(pictureBox.BackColor);
for (int i = 0; i < 361; i += 5)
{
RectangleF picRect = new RectangleF(0, 0, width * (i + 1) / 360, height * (i + 1) / 360);
PointF Pcenter = new PointF(picRect.Width / 2, picRect.Height / 2);
g.TranslateTransform(this.pictureBox.Width / 2, this.pictureBox.Height / 2);
g.TranslateTransform(-Pcenter.X, -Pcenter.Y);
g.DrawImage(myBitmap, picRect);
Thread.Sleep(10);
g.ResetTransform();
}
}

这是我写的其中四个浏览图片的形式, 还有其他的, 要的话加190912896
博思aippt
2024-07-20 广告
博思AIPPT是基于ai制作PPT的智能在线工具,它提供了4种AI制作PPT的方式,包括AI生成大纲、AI直接生成PPT、文本生成PPT、AI提炼文档生成PPT,一站式集成多种AI生成PPT的方式,可满足办公用户的不同需求和使用场景。ai生... 点击进入详情页
本回答由博思aippt提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式