Click here to Skip to main content
15,891,951 members

Comments by shriti 3 (Top 26 by date)

shriti 3 18-Dec-13 6:14am View    
Thanks for the help.I resolved by writing below code

grd.Gridlines=Gridlines.None;
grd.RowStyle.BorderStyle = BorderStyle.None;
grd.RowStyle.BorderWidth = Unit.Pixel(0);
shriti 3 16-Dec-13 7:32am View    
I already reviewed this url ,but it is using [DllImport("advapi32.dll", SetLastError = true)]
which i dont want in my code.Without using any dll how to use impersonation
shriti 3 16-Dec-13 2:17am View    
Yes im disposing objects in my code


FileInfo FI = null;
System.IO.FileStream FS = null;
FI = new System.IO.FileInfo(networkPath);
FS = FI.Create();
FS.Write(objDoc.DocBytes, 0, objDoc.DocBytes.Length);
FS.Close();
FS.Dispose();
shriti 3 4-Dec-13 7:14am View    
by mistake my issue was posted in solution
shriti 3 4-Dec-13 7:09am View    
if i will remove aspect ratio then resulting image i get will be distorted


Using Aspect Ratio->

if (image.Width > image.Height)
{
srcWidth = (int)(Math.Round(image.Height * croppedWidthToHeight));
if (srcWidth < image.Width)
{
srcHeight = image.Height;
left = (image.Width - srcWidth) / 2;
}
else
{
srcHeight = (int)Math.Round(image.Height * ((double)image.Width / srcWidth));
srcWidth = image.Width;
top = (image.Height - srcHeight) / 2;
}
}
else
{
srcHeight = (int)(Math.Round(image.Width * croppedHeightToWidth));
if (srcHeight < image.Height)
{
srcWidth = image.Width;
top = (image.Height - srcHeight) / 2;
}
else
{
srcWidth = (int)Math.Round(image.Width * ((double)image.Height / srcHeight));
srcHeight = image.Height;
left = (image.Width - srcWidth) / 2;
}
}
using (Graphics g = Graphics.FromImage(bitmap))
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(image, new Rectangle(0, 0, bitmap.Width, bitmap.Height), new Rectangle(left, top, srcWidth, srcHeight), GraphicsUnit.Pixel);
}
finalImage = bitmap;
}


Without Aspect ratio-
Bitmap bmp = new Bitmap(targetWidth, targetHeight);
Graphics grp = Graphics.FromImage(bmp);
grp.DrawImage(image, new Rectangle(0, 0, bmp.Width, bmp.Height), new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
// return (Image)bmp;
bmp.Save(filePath);

return false;