Windows Develop Bookmark and Share   
 index > Windows Forms General > Zooming chart in splash Screen
 

Zooming chart in splash Screen

Hi friends,


I have started building a application which will display some data from access and plot the graph of them..
I have plotted it on one form, but i need zoom that graph runtime if user wants so..I am planning to create a splashscreen where i can show chart object in bit large view..but i dont know how to pass a object from one from to other ..
I have a doubt that do i need to recreat chart on splashscreen? or there is any method where i can call the graph from main form to my new form( splashscreen)?
Any clue would be appreciated...
Thanks in Advance
  • Moved byeryangMSFTWednesday, October 07, 2009 8:01 AMwinform issue. (From:.NET Base Class Library)
  •  
Suresh Deoda  Monday, October 05, 2009 6:49 AM

Hi Suresh,

There are two methods to zoom an image.

1.    Set the background image of a panel and set the image layout. For example, we can drag and drop a panel onto the form. Set its BackgroundImage property to the image and set its BackgroundImageLayout property to Stretch.

2.    Draw the image with a source rectangle and a destination rectangle as parameters. This is a code snippet:

    protected override void OnPaint(PaintEventArgs e)
    {
        base.OnPaint(e);
        //Get image.
        Image img = Properties.Resources.untitled;
        //Zoom factor.
        float zoomFactor = 4.0f;
        //The rect of the image which would be draw.
        Rectangle imgRect = new Rectangle();
        imgRect.Location = Point.Empty;
        imgRect.Size = img.Size;
        //The rect of the form where we would draw the image.
        Rectangle drawRect = new Rectangle();
        //This is the location where you want to draw the image.
        drawRect.Location = new Point(5,5);
        //Change the size according to the zoom factor.
        drawRect.Size = new Size((int)(img.Size.Width * zoomFactor), (int)(img.Size.Height * zoomFactor));
        //Draw the image.
        e.Graphics.DrawImage(img, drawRect, imgRect, GraphicsUnit.Pixel);
    }



You can get more about DrawImage method from:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawimage.aspx

 

Regards,
Aland Li



Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  6 hours 53 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• Catch Combination Keys
• Error in "How to create a thread by using Visual C#" Article ID : 815804
• form hangs when trying to thread
• Plotting CLR console values on Windows Form
• Threaded Progress Status Bar
• Trusted_connection=true
• Progressbar WinForm popup
• datagrid view and display format
• ByVal acts as byRef?
• Attempted Read or Write Protected Memory while running a third party dll