scrolling map

Posted on 2005-05-13
Last Modified: 2010-04-16
Please see this diagram:

What I want is to create a windows application in C#.  On the Form I will have a PictureBox control that shows PART of a map at any given time.  But the map will be so big that you have to scroll to see the rest of the map.

I want to use GDI+   ....   no DirectX.
Question by:knowlton
    1 Comment
    LVL 13

    Accepted Solution

    I did this in (actually for the .net compact framework), but it should be straightforward to translate (here's hoping I did it the "correct" way, at least it works :)), it's not GDI+ but maybe it will give you some ideas; it was/is part of a moving map display:
                Dim rectDest, rectSrc As Rectangle
                ' source + destination rectangle, note: it can stretch as well...
                rectDest = New Rectangle(intSX1, intSY1, intSX2 - intSX1, intSY2 - intSY1)
                rectSrc = New Rectangle(intOX1, intOY1, intOX2 - intOX1, intOY2 - intOY1)
                If Not p_Map.BmpLoaded Then ' p_Map is a global variable, *gasp*, used to cache the map so that I don't need to reload it each time
                        p_Map.BmpMap = New Bitmap(p_Map.Filename)
                             ' p_Map.BmpMap is of type System.Drawing.Bitmap
                        p_Map.BmpLoaded = True
                    Catch ex As Exception
                        ' no file found or other problem ...!! abort!
                        MsgBox("Error loading file " & p_Map.Filename & ": error=" & ex.ToString)
                    End Try
                End If
                If Not p_Map.BmpMap Is Nothing Then
                    p_Graph.DrawImage(p_Map.BmpMap, rectDest, rectSrc, GraphicsUnit.Pixel)
                    ' p_Graph is of type System.Drawing.Graphics
                End If

    Hope it gives you some ideas :)

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now