Friday, February 4, 2011

Upload a Picture in WPF UI

 Uploading Picture in UI is very Important It is Quite Easy. On upload button Event Write down The following code:

                OpenFileDialog dlg;
                FileStream fs;
               byte[] data;

              dlg = new Microsoft.Win32.OpenFileDialog();

               if (dlg.FileName == "")
                MessageBox.Show("Picture is not selected......");
                fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);

                data = new byte[fs.Length];
                fs.Read(data, 0, System.Convert.ToInt32(fs.Length));

                ImageSourceConverter imgs = new ImageSourceConverter();
                SupplierLogoimage.SetValue(Image.SourceProperty, imgs.ConvertFromString(dlg.FileName.ToString()));

EnJoy....... !!

C# print file on LAN Printer

If you want to print any file on network printer then you can try with this code block // Change Default Printer System.Ma...