(1)我现在在datalist里面做放了一个图片 图片的框架是固定大小,可是图片大小是不固定的,怎样让其显示为缩小后的 没有失真的图片
(2)AspNetPager这个控件谁用过 指点下,我连接培植都可以了,可是工具条就是不出现,为什么???
具体见:http://cpd.gm-apparel.com/Men_tee.aspx?type=1
(2)AspNetPager这个控件谁用过 指点下,我连接培植都可以了,可是工具条就是不出现,为什么???
具体见:http://cpd.gm-apparel.com/Men_tee.aspx?type=1
or
<img src="sex.jpg" width ="123px">
图片会自动按比列缩小的
樓主可以這樣:不要設置<img>的高和寬,讓<img>自動取得圖片的高和寬,但把存放<img>的單元格固定大小。
/// 图像尺寸调节
/// </summary>
/// <param name="b">原始图像</param>
/// <param name="dstWidth">目标宽度</param>
/// <param name="dstHeight">目标高度</param>
/// <returns></returns>
public Bitmap ResizeBitmap(Bitmap b, int dstWidth, int dstHeight)
{
Bitmap dstImage = new Bitmap(dstWidth, dstHeight);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dstImage); // 设置插值模式
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear; // 设置平滑模式
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; g.DrawImage(b,
new System.Drawing.Rectangle(0, 0, dstImage.Width, dstImage.Height),
new System.Drawing.Rectangle(0, 0, b.Width, b.Height),
System.Drawing.GraphicsUnit.Pixel);
g.Save();
g.Dispose(); return dstImage;
} // end of Resize
private void reSizeProcess()
{
string pathStrSelText;
int n = 0;
this.label1.Text="";
//string pathStrResize="";
//MessageBox.Show(NewWidth.ToString());
foreach (ListViewItem SelItems in this.listView1.Items)
{
pathStrSelText = SelItems.Text;
Bitmap zc = new Bitmap(SelItems.Text); zc = ResizeBitmap(zc, NewHeight, NewWidth);
EncoderParameters ep = new EncoderParameters();
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders(); //find the encoder with the image/jpeg mime-type
ImageCodecInfo ici = null;
foreach (ImageCodecInfo codec in codecs)
{
if (codec.MimeType == "image/jpeg")
ici = codec;
} //We'll save images with 25%, 50%, 75% and 100% quality as compared with the original
//for (int x = 25; x < 101; x += 25)
//{
//Create an encoder parameter for quality with an appropriate level setting
ep.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)50);
//}
// zc.Save(@"d:\1.jpg");
Directory.CreateDirectory(Path.GetDirectoryName(pathStrSelText) + @"\" + "bakPhoto" + @"\" + "reSize");
zc.Save((Path.GetDirectoryName(pathStrSelText) + @"\" + "bakPhoto" + @"\" + "reSize" + @"\" + Path.GetFileNameWithoutExtension(pathStrSelText) + Path.GetExtension(pathStrSelText)), ici, ep);
//Directory.CreateDirectory(Application.StartupPath + @"\bakPhoto");
//zc.Save(Application.StartupPath + @"\bakPhoto\" + Path.GetFileName(pathStrSelText), ici, ep);
if (n < 20)
{
this.label1.Text += "\n";
this.label1.Text += Path.GetFileName(SelItems.Text);
n++;
}
else
{
n = 0;
this.label1.Text = "";
}
}
this.label1.Text += "\n";
this.label1.Text += "工作完成.. 累死我了...";
}
{
string pathStrSelText;
int n = 0;
foreach (ListViewItem SelItems in this.listView1.Items)
{
pathStrSelText = SelItems.Text;
Bitmap zc = new Bitmap(SelItems.Text);我对应的这个地方是 bitmap zc = new bitmap("1.jpg") 而且1.jpg就在当前目录下
为什么提示说参数无效
{
string pathStrSelText;
int n = 0;
foreach (ListViewItem SelItems in this.listView1.Items)
{
pathStrSelText = SelItems.Text;
Bitmap zc = new Bitmap(SelItems.Text);我对应的这个地方是 bitmap zc = new bitmap("1.jpg") 而且1.jpg就在当前目录下
为什么提示说参数无效
http://cpd.gm-apparel.com
具体就是这个上面的演示
如何把变形的图片给处理的好点