110,533
社区成员
发帖
与我相关
我的任务
分享
public static void FanZhuan_ZuoYou(Bitmap MyBitmap, Control picBox)
{
//以左右反转方式显示图像
try
{
int width = MyBitmap.Width; //图像宽度
int height = MyBitmap.Height; //图像高度
Graphics g = picBox.CreateGraphics();
int ia = 0;
for (int j = -height / 2; j <= height / 2; j++)
{
ia++;
g.Clear(Color.White);
int i = Convert.ToInt32(j * (Convert.ToSingle(width) / Convert.ToSingle(height)));
Rectangle DestRect = new Rectangle(width / 2 - i, 0, 2 * i, height);
Rectangle SrcRect = new Rectangle(0, 0, MyBitmap.Width, MyBitmap.Height);
g.DrawImage(MyBitmap, DestRect, SrcRect, GraphicsUnit.Pixel);
System.Threading.Thread.Sleep(10);
}
Console.WriteLine(ia);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "信息提示");
}
}public static void FanZhuan_ZuoYou(Bitmap MyBitmap, Control picBox)
{
//以左右反转方式显示图像
try
{
int width = MyBitmap.Width; //图像宽度
int height = MyBitmap.Height; //图像高度
Graphics g = picBox.CreateGraphics();
int ia = 0;
for (int j = -height / 2; j <= height / 2; j++)
{
ia++;
g.Clear(Color.White);
int i = Convert.ToInt32(j * (Convert.ToSingle(width) / Convert.ToSingle(height)));
Rectangle DestRect = new Rectangle(width / 2 - i, 0, 2 * i, height);
Rectangle SrcRect = new Rectangle(0, 0, MyBitmap.Width, MyBitmap.Height);
g.DrawImage(MyBitmap, DestRect, SrcRect, GraphicsUnit.Pixel);
System.Threading.Thread.Sleep(10);
}
Console.WriteLine(ia);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "信息提示");
}
}
public static void FanZhuan_ZuoYou(Bitmap MyBitmap, Control picBox)
{
//以左右反转方式显示图像
try
{
int width = MyBitmap.Width; //图像宽度
int height = MyBitmap.Height; //图像高度
Graphics g = picBox.CreateGraphics();
BufferedGraphics bufferGfx = BufferedGraphicsManager.Current.Allocate(g, picBox.ClientRectangle);
Graphics gfx = bufferGfx.Graphics;
int ia = 0;
for (int j = -height / 2; j <= height / 2; j++)
{
ia++;
gfx.Clear(Color.White);
int i = Convert.ToInt32(j * (Convert.ToSingle(width) / Convert.ToSingle(height)));
Rectangle DestRect = new Rectangle(width / 2 - i, 0, 2 * i, height);
Rectangle SrcRect = new Rectangle(0, 0, MyBitmap.Width, MyBitmap.Height);
gfx.DrawImage(MyBitmap, DestRect, SrcRect, GraphicsUnit.Pixel);
bufferGfx.Render(g);
System.Threading.Thread.Sleep(10);
}
gfx.Dispose();
bufferGfx.Dispose();
Console.WriteLine(ia);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "信息提示");
}
}