>
c# code to add photoframe to picture
Welcome, Guest

by Nitin on Tuesday, 13 April 2010
c# code to add photoframe to picture


XAML:

         <Image Margin="0,0,0,0" Width="288" Height="432" Name="image1" Stretch="Fill" ImageFailed="image1_ImageFailed" Loaded="image1_Loaded" />

        <Button Height="45" HorizontalAlignment="Right" Margin="0,0,6,4" Name="button1" VerticalAlignment="Top" Click="button1_Click">Button</Button>

Code Behind :

        private void button1_Click(object sender, RoutedEventArgs e)

        {

            try

            {

                BitmapImage bmp = null;

                string framepath = @"C:Dataframe.gif";

                string path = @"C:Datamain.JPG";

                Bitmap myBitmap = new Bitmap(path);

                Bitmap bm1 = (Bitmap)Bitmap.FromFile(framepath);

                Graphics graphicsObj = Graphics.FromImage(myBitmap);

                graphicsObj.DrawImage(bm1, 0, 0, myBitmap.Width, myBitmap.Height);

                //Bitmap final = new Bitmap(100, 100, graphicsObj);

                byte[] bytes = this.imageToByteArray(myBitmap);

                MemoryStream strm = new MemoryStream(bytes);

                strm.Seek(0, SeekOrigin.Begin);

                BitmapImage bi = new BitmapImage();

                // Read the image into the bitmap object

                bi.CacheOption = BitmapCacheOption.OnLoad;

                bi.BeginInit();

                bi.StreamSource = strm;

                bi.EndInit();

                //strm.Close();

                // Set the Image with the Bitmap

                this.image1.Source = bi;

            }

            catch (Exception ex) { MessageBox.Show(ex.ToString()); }

        } 



Blogger Image
My Blog Title

Product Engineering, software engineering company, Product Development, Product Migration, Product Re-engineering, Product Maintenance, Product Testing Commercial Application Development, Business Software development, commercial software for startups, Application Support and Maintenance, software testing Product Maintenance, Outsource product maintenance, product support and maintenance Product Migration, Product Re-engineering, product re-engineering services Product Research, Product Engineering, UI Prototyping Services Software Testing Services, Quality Assurance services, professional software testers, Load Testing, Functional Testing, Cross Platform, Browser Testing, Test Automation, Testing Tools, software quality analysis Functional Testing Services, software quality analysis, Software Testing Services, Application Testing Services, Functional Testing Types Automated Testing, Automated Testing Services, automation testing, test script development, Automation Test Tools, outsource automation testing Load Testing, Performance Testing Services, Load Testing Tools Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Benefits of IT Outsourcing, Offshore Software Development companies, offshore software development firms Outsource planning, IT outsourcing, IT development services, offshore IT companies, offshore software development Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering