Posts

Showing posts from March, 2014

How to implement Folder Browser Dialogbox (FolderBrowserDialog) in c#

C# Code:
string folder=””; using (FolderBrowserDialog dialog = newFolderBrowserDialog()) {     dialog.Description = "Open a folder which contains your files”;     dialog.ShowNewFolderButton = false;     dialog.RootFolder = Environment.SpecialFolder.MyComputer; if (dialog.ShowDialog() == DialogResult.OK)     {         folder = dialog.SelectedPath;     }
}

How to implement open filedialogbox in c#

C# Code:
String ImagePath=””; OpenFileDialog OpenFileDialog1 = newOpenFileDialog(); OpenFileDialog1.InitialDirectory = Convert.ToString(Environment.SpecialFolder.MyDocuments); OpenFileDialog1.Filter = "(*.png)|*.png|All Files (*.*)|*.*"; OpenFileDialog1.FilterIndex = 1;
if (OpenFileDialog1.ShowDialog() == DialogResult.OK) {     ImagePath= OpenFileDialog1.FileName;
}

How to get Filename with extension from path in c#

C# Code:
stringFilePath ="D:\\images\\1.png";
string Extention = Path.GetFileName(FilePath);

How to get only File extension from path in c#

C# Code:
stringFilePath ="D:\\images\\1.png";
string Extention = Path.GetExtension(FilePath);

How to get Filename without extension from path in c#

C # Code:
stringFilePath ="D:\\images\\1.png";
string Filename = Path.GetFileNameWithoutExtension(FilePath);

How to resizeImage and save using c#.Net

C# Code:
privateBitmap SetResizeImage(string strImg, string FileName, int Imagewidth, int ImageHeight) { int nnx = Imagewidth; int nny = ImageHeight;     System.Drawing.Image img = System.Drawing.Image.FromFile(strImg); Bitmap cpy = null;     cpy = newBitmap(nnx, nny); using (Graphics gr = Graphics.FromImage(cpy))     {         gr.Clear(Color.Transparent);         gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;         gr.DrawImage(img, newRectangle(0, 0, nnx, nny), newRectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel);     } return cpy;
} ------------------------------------------------------------------------------------------------------------

How to insert a list (Data) in google spreadsheet in c# ?

Image
Before coding, create uri for your spreadsheet, see below setpes:
1.login to google drive and open your spreadsheet
2.Download spreadsheet through (File -> Dowanload as -> Webpage) then new page will be oped