Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6553333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:34:08+00:00 2026-05-25T12:34:08+00:00

I am developing zoo simulator project. It contains three thing types to draw: a

  • 0

I am developing zoo simulator project. It contains three thing types to draw: a map, animal environments and the animals themselves. The map is too big to fit on screen, player needs to move screen to see other parts of it. I am using a timer to draw. On its tick, it calls Invalidate() for the form being drawing on. In ZooForm_Paint method, I first draw every thing in the map on mapBuffer Bitmap. Since mapBuffer is too big to fit on screen, I draw (on screen) the part of mapBuffer the player is where.

Unfortunately, it seems that drawing everything in the map (although it may not be viewed) on mapBuffer slows the game. Can I draw my evironments and animals without need to draw entire map first?
How?

My code:

public void DrawGame(Graphics g, ref Point locationOnMap)
{
this.drawBufferMap();
this.drawMapLocation(g, ref locationOnMap);
}


private void drawBufferMap()
{
    Bitmap buffer = new Bitmap(this.map.Size.Width, this.map.Size.Height);
    using (Graphics graphics = Graphics.FromImage(buffer))
    {
        graphics.DrawImageUnscaled(this.map.Picture, new Point()); // draw entire map

        foreach (var item in this.zoo.Environments) // draw all env.
        {
            graphics.DrawImageUnscaled(item.Picture, item.Bounds.Location);
        }
        foreach (var item in this.zoo.ILocatables) // draw all ILocatables
        {
            graphics.DrawImageUnscaled(item.Picture, item.Location);
        }
    }

    if (this.mapBuffer != null)
    {
        this.mapBuffer.Dispose();
    }
    this.mapBuffer = buffer;
}

private void drawMapLocation(Graphics g, ref Point location)
{
    g.DrawImage(this.mapBuffer, new Rectangle(0, 0, viewSize.Width, viewSize.Height),
        new Rectangle(location.X, location.Y, viewSize.Width, viewSize.Height), GraphicsUnit.Pixel);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:34:09+00:00Added an answer on May 25, 2026 at 12:34 pm

    I don’t think you are going to get any easy solutions. I can offer a few tips and opinions:

    • You seem to be creating a new BitMap every time you paint the screen. This is definitely not a good idea, as large bitmaps are absolutely huge in terms of memory. What you probably want to do is create one when your game loads, and then simply clear it and repaint it at every frame. I think this is probably one of the bigger performance issues you have.
    • There are a number of optimisations you could make afterwards. E.g. you are “rendering” the image that you will end up painting to the screen on the user interface thread. If the rendering process takes long, this will be noticeable. Typically this work happens on a background thread, and then the UI thread just checks if it can repaint using the new image. (I am simplifying things greatly here).
    • For graphics intensive applications, WinForms is not a particularly good environment, as others have pointed out. You will not get any hardware acceleration at all. Moving to XNA is one option, but if your application is also quite rich in terms of standard WinForms screens and controls, this is probably not an easy option. Another suggested alternative might be WPF, where you might be able to get away with using transformations to move things around, which are hardware accelerated, and are not too dissimilar to a WinForms application (well, you don’t need to implement your own buttons, etc).

    Hope this helps a bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing a project of mine I realize I have a need for some level
Developing iphone application using makkit framework. I have got the map view integrated in
Developing a Django app and decided to ditch the Linode for Heroku. Just too
When developing WebForms web site, I start my project once, Cassini loads and stays
Developing a series of POCOs on my project, and just realized that some of
After developing mini project with WCF duplex (Chat Service | Sms Service), I got
Developing sample download application,My application contains 3 activities.When the first activity starts, the download
When developing for Android, is there any point to having a test project as
Developing websites are time-consuming. To improve productivity, I would code a prototype to show
Developing a .NET WinForms application: how can I check if the window is in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.