如何让WinForm界面换背景换图 现在我要达到这么个效果:换背景图时不是直接闪一下就替换了,要有点效果,比如图片从左到右移动,慢慢覆盖原来的背景。谁能给点思路,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 哈哈^要用到GUI吧我也不会,帮不到你 把一个控件最大化,做背景。在控件上画,这个例子是在pictureBox上画的 /// <summary> /// 垂直百叶窗 /// </summary> /// <param name="bmp">Bitmap 对象,要画的图片</param> /// <param name="picBox">PictureBox 对象</param> public static void BaiYeChuang1(Bitmap bmp, PictureBox picBox) { //垂直百叶窗显示图像 try { Bitmap MyBitmap =(Bitmap) bmp.Clone(); int dw = MyBitmap.Width / 30; int dh = MyBitmap.Height; Graphics g = picBox.CreateGraphics(); g.Clear(Color.Gray); Point[] MyPoint = new Point[30]; for (int x = 0; x < 30; x++) { MyPoint[x].Y = 0; MyPoint[x].X = x * dw; } Bitmap bitmap = new Bitmap(MyBitmap.Width, MyBitmap.Height); for (int i = 0; i < dw; i++) { for (int j = 0; j < 30; j++) { for (int k = 0; k < dh; k++) { bitmap.SetPixel(MyPoint[j].X + i, MyPoint[j].Y + k, MyBitmap.GetPixel(MyPoint[j].X + i, MyPoint[j].Y + k)); } } picBox.Refresh(); picBox.Image = bitmap; System.Threading.Thread.Sleep(120); } } catch (Exception ex) { MessageBox.Show(ex.Message, "信息提示"); } } 左右拉伸 效果,用法同上 /// <summary> /// 左右拉伸效果 /// </summary> /// <param name="bmp">Bitmap 对象</param> /// <param name="picBox">PictureBox 对象</param> public static void LaShen_ZuoDaoYou(Bitmap bmp, PictureBox picBox) { //以从左向右拉伸方式显示图像 try { int width = bmp.Width; //图像宽度 int height = bmp.Height; //图像高度 Graphics g = picBox.CreateGraphics(); g.Clear(Color.Gray); //初始为全灰色 for (int x = 1; x <= width; x++) { Bitmap bitmap = bmp.Clone(new Rectangle(0, 0, x, height), System.Drawing.Imaging.PixelFormat.Format24bppRgb); g.DrawImage(bitmap, 0, 0); System.Threading.Thread.Sleep(10); } } catch (Exception ex) { MessageBox.Show(ex.Message, "信息提示"); } }还没有在窗体上直接画过,怕效果不好。 C#画箭头程序,不知咋把图保存起来! 哪儿有MSDN的中文下载?? socket停止监听时报错 各位,可不可以自己做一个在网站上即时聊天的东西,请大哥帮忙,救救不弟,要不然我就完了,求求各位了。 c# 获取硬盘与盘符信息的问题 c语言实训 想学习EXTJS求推荐基本书看看 这些函数怎么用呀? 怎样判断当前操作系统是9x还是xp/2000/nt? 请教各位:c#默认继承级别为什么这么奇怪 构造函数与this的问题,求教!在线等! 五彩色连珠游戏,帮提建议.
我也不会,帮不到你
/// 垂直百叶窗
/// </summary>
/// <param name="bmp">Bitmap 对象,要画的图片</param>
/// <param name="picBox">PictureBox 对象</param>
public static void BaiYeChuang1(Bitmap bmp, PictureBox picBox)
{
//垂直百叶窗显示图像
try
{
Bitmap MyBitmap =(Bitmap) bmp.Clone();
int dw = MyBitmap.Width / 30;
int dh = MyBitmap.Height;
Graphics g = picBox.CreateGraphics();
g.Clear(Color.Gray);
Point[] MyPoint = new Point[30];
for (int x = 0; x < 30; x++)
{
MyPoint[x].Y = 0;
MyPoint[x].X = x * dw;
}
Bitmap bitmap = new Bitmap(MyBitmap.Width, MyBitmap.Height);
for (int i = 0; i < dw; i++)
{
for (int j = 0; j < 30; j++)
{
for (int k = 0; k < dh; k++)
{
bitmap.SetPixel(MyPoint[j].X + i, MyPoint[j].Y + k, MyBitmap.GetPixel(MyPoint[j].X + i, MyPoint[j].Y + k));
}
}
picBox.Refresh();
picBox.Image = bitmap;
System.Threading.Thread.Sleep(120);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "信息提示");
} }
/// <summary>
/// 左右拉伸效果
/// </summary>
/// <param name="bmp">Bitmap 对象</param>
/// <param name="picBox">PictureBox 对象</param>
public static void LaShen_ZuoDaoYou(Bitmap bmp, PictureBox picBox)
{
//以从左向右拉伸方式显示图像
try
{
int width = bmp.Width; //图像宽度
int height = bmp.Height; //图像高度
Graphics g = picBox.CreateGraphics();
g.Clear(Color.Gray); //初始为全灰色
for (int x = 1; x <= width; x++)
{
Bitmap bitmap = bmp.Clone(new Rectangle(0, 0, x, height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
g.DrawImage(bitmap, 0, 0);
System.Threading.Thread.Sleep(10);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "信息提示");
}
}还没有在窗体上直接画过,怕效果不好。