本文目录一览

1,VS2013 网页制作如何插图

直接写标记最简单:<IMG SRC="1.jpg" WIDTH="100" HEIGHT="100" BORDER="0" ALT="图片">也可以工具栏中找到image控制拖放入页面,再指定图片路径,当然也可以加入服务器控件中的image控件,如果仅仅是在页面显示一张图片,最好使用HTML控件,这样不会回传服务器,不占用服务器资源。

VS2013 网页制作如何插图

2,怎么在vs2005 设计的对话框中添加图片求方法和源代码C风格

CBitmap bitmap; bitmap.LoadBitmap(IDB_BITMAP1); BITMAP bmp; bitmap.GetBitmap(&bmp); CDC dc; dc.CreateCompatibleDC(pDC); dc.SelectObject(&bitmap); CRect rect; GetClientRect(&rect);// pDC->BitBlt(0,0,rect.Width(),rect.Height(),&dc,0,0,SRCCOPY); pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&dc,0,0 ,bmp.bmWidth,bmp.bmHeight,SRCCOPY);在对话框类的onCreate()里写上如上代码就行了。当然你先要加载图片资源。 其中被注释掉的那句是原图显示,下面那句是根据对话框大小来压缩图片。

怎么在vs2005 设计的对话框中添加图片求方法和源代码C风格

3,VS里可以修改图片大小吗

可以。有很多方法,常见的,如果要把图片放到picturebox 或者label上,只要将该控件的大小设置成你预设的大小即可。 当然,visual studio 还提供专门的图片制作功能,可以精确到每一个显像点!
//参数分别为图片源文件,处理完图片存放目录,生成的图片宽,国片长,填充背景颜色,边框 public static void MakePic(string sourceImg, string toPath, int width, int height, string backColor, string borderColor) { System.Drawing.Image originalImage = System.Drawing.Image.FromFile(sourceImg); int towidth = width; int toheight = height; int x = 0; int y = 0; int ow = originalImage.Width; int oh = originalImage.Height; string mode; if (ow < towidth && oh < toheight) { towidth = ow; toheight = oh; } else { if (originalImage.Width / originalImage.Height >= width / height) { mode = "W"; } else { mode = "H"; } switch (mode) { case "W"://指定宽,高按比例 toheight = originalImage.Height * width / originalImage.Width; break; case "H"://指定高,宽按比例 towidth = originalImage.Width * height / originalImage.Height; break; default: break; } } //新建一个bmp图片 System.Drawing.Image bitmap = new System.Drawing.Bitmap(width, height); //新建一个画板 System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap); //设置高质量插值法 g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量,低速度呈现平滑程度 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //清空画布并以指定颜色填充 g.Clear(ColorTranslator.FromHtml(backColor)); //在指定位置并且按指定大小绘制原图片的指定部分 int top = (height - toheight) / 2; int left = (width - towidth) / 2; g.DrawImage(originalImage, new System.Drawing.Rectangle(left, top, towidth, toheight), new System.Drawing.Rectangle(x, y, ow, oh), System.Drawing.GraphicsUnit.Pixel); Pen pen = new Pen(ColorTranslator.FromHtml(borderColor)); g.DrawRectangle(pen, 0, 0, width - 1, height - 1); try { //以jpg格式保存缩略图 bitmap.Save(toPath, System.Drawing.Imaging.ImageFormat.Jpeg); } catch (System.Exception e) { throw e; } finally { originalImage.Dispose(); bitmap.Dispose(); g.Dispose(); } }
如果你是指显示大小,我可以明确告诉你可以,如果你想改变图片本身,只要你够牛,你可以用vs自己做一个图片编辑器来改变图片

VS里可以修改图片大小吗


文章TAG:怎么  编辑  图片  图片素材  vs怎么编辑图片素材  网页制作如何插图  
下一篇