Results 1 to 6 of 6

Thread: How to Load/Display images with C#?

  1. #1
    Join Date
    Aug 2006
    Posts
    122

    How to Load/Display images with C#?

    I have recently started with the C# programming language. I want to Load the Images in C# . I want to complete my project sooner. So please try to guide me soon as possible. Any suggestions or advice are mostly welcomed. Also if possible provide me some coding so that I can use that in my project. Extremely Thanks In Advance.!!!
    In the end, we will remember not the words of our enemies, but the silence of our friends.
    -Martin Luther King Jr.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to Load/Display images with C#?

    If you want to load the images in C#, then you will have to use the System.Drawing.Graphics.DrawImage(...). There are many methods of this class. DrawImage() is a method of the Graphics class. You need to create a Graphics object before using DrawImage() straightaway. You can use this Graphics object on the form for drawing an image onto it. But you will have to create this object in the Paint Handler of the form. I have provided you an example for a Paint Handler :
    Code:
    private void MainForm_Paint(object sender, 
                               System.Windows.Forms.PaintEventArgs e)
    {
        ...
    }
    When you call a form's paint handler, some data regarding the form's graphics stuff is passed to it. The object used to held has a property Graphics, you can initialize your own Graphics object using this
    Code:
    Graphics g = e.Graphics;

  3. #3
    Join Date
    Mar 2008
    Posts
    672

    Re: How to Load/Display images with C#?

    If you want to draw the flow-charts, vector drawings, etc. you can make use of the UCCDraw Flow Component. UCCDraw Flow Component is an ActiveX control that allows creation and editing of Visio-style charts from within your application. This application also allows you to create raster images and more with the ability to include hyperlinks and various shading and coloring effects. You can also group objects together, include images and text, link them together and apply custom drawing effects to create charts similar to Microsoft Visio by using the UCCDraw Flow Component.

  4. #4
    Join Date
    Nov 2008
    Posts
    996

    Re: How to Load/Display images with C#?

    If you are looking for some software I would recommend you to go for the WebMagick. WebMagick provides a means of easily putting image collections on the Web. It allows the user to navigate through collections of thumbnail images. Also it recurses through directory trees, building HTML pages and imagemap. You can select the images for viewing them just by single clicking with the mouse. Hope that, the WebMagick will help you to upload the images in your project.

  5. #5
    Join Date
    Nov 2008
    Posts
    1,185

    Re: How to Load/Display images with C#?

    For loading the images in C# you will have to know about the System.Drawing.Image. System.Drawing.Image is an abstract class, which acts as a base for System.Drawing.Imaging.Metafile and System.Drawing.Bitmap. You can also create an Image Object by using the Bitmap class. The following code shows how to use that :
    Code:
    MyBitmap = new Bitmap(...);
    There are many overloads for the constructor of the Bitmap. Here is one :
    Code:
    public Bitmap(
      string filename
    );
    After doing this code, you just have to pass the path to the image file you want to load and after that you will have to initialize an Image Object.

  6. #6
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to Load/Display images with C#?

    I tried to provide you the code used for Loading the Images with C#. You should be able to load your image using this code.
    Code:
    private void MainForm_Paint(object sender, 
                                System.Windows.Forms.PaintEventArgs e)
    {
        ...
            ...
        Graphics g = e.Graphics;
            MyBitmap = new Bitmap("c:\\image.bmp");
        g.DrawImage( MyBitmap, new RectangleF(MyPoint.X, MyPoint.Y, 
                     MyBitmap.Width*(fScale), MyBitmap.Height*(fScale)) );
        ...br>    ...
    }

Similar Threads

  1. Unable to load complete Images in Opera 11.50
    By ADELYN in forum Technology & Internet
    Replies: 4
    Last Post: 26-08-2011, 10:24 PM
  2. Nokia N8 Social App doesn't load images
    By Innis in forum Portable Devices
    Replies: 5
    Last Post: 11-02-2011, 10:27 PM
  3. Unable To Load Small Images Directly In MSIE
    By Adrina_g in forum Technology & Internet
    Replies: 5
    Last Post: 04-01-2010, 08:42 AM
  4. Firefox don't load images!
    By Drogbaa in forum Windows Software
    Replies: 4
    Last Post: 30-03-2009, 05:50 PM
  5. Unable to load Dynamic Images Everytime
    By Nihar Khan in forum Software Development
    Replies: 3
    Last Post: 18-03-2009, 10:03 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,630,138.55290 seconds with 17 queries