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 4611868
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:19:36+00:00 2026-05-22T01:19:36+00:00

Hey everyone, a new guy here in C#.Net. I’m trying to make an application

  • 0

Hey everyone, a new guy here in C#.Net.

I’m trying to make an application like Ms Paint, of course much simpler, and I’m stuck.

The problem is this.

In pictureBox, I’m drawing grid lines on the PictureBox, after that I’m reading a .map(A Mapper3 file) and want to draw onto grid lines, but When I draw the map, The grid lines disappers.

I think the problem is because of the PictureBox Image becomes null while I’m drawing the map. How can I overcome this, is there any tricks?

Thanks for the replies from now on, and sorry for my bad English…

My best Regards…

  • 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-22T01:19:36+00:00Added an answer on May 22, 2026 at 1:19 am

    Do you using winforms? If yes, you actually dont need picture box for working area. I think more appropriate would be Graphics class on form or panel. You have lost lines because of form repaint circle, put your drawing code into form paint handler and picture would be repainted when it needed. In some cases you can need to manual trigger repaint circle, for this purposes you should use Invalidate method of your form.

    For example, add this code to paint handler:

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            // Drawing vertical lines
            for (int x = 5; x < this.ClientRectangle.Width; x+=5)
            {
                e.Graphics.DrawLine(Pens.Gray, new Point(x, 0), new Point(x, this.ClientRectangle.Height));
            }
    
            // Drawing horisontal lines
            for (int y = 5; y < this.ClientRectangle.Width; y += 5)
            {
                e.Graphics.DrawLine(Pens.Gray, new Point(0, y), new Point(this.ClientRectangle.Width,y));
            }
        }
    

    You also may use Graphics in button click handler this way:

    Graphics g = Graphics.FromHwnd(this.Handle);
    
    g.FillEllipse(Brushes.Beige, new Rectangle(10, 10, 10, 10));
    

    But in this case all you have drawn would be erased during form’s repaint circle and you will have to repeint it in form paint handler

    [EDIT]
    Ok, for example you have pictureBox1 on your form, you can easly draw into it with help of Bitmap class in this way:

    // Draw into bitmap
    Bitmap bmp = new Bitmap(150, 150);
    Graphics g = Graphics.FromImage(bmp);
    g.FillRectangle(Brushes.Green, new Rectangle(25, 75, 10, 30));
    
    // Set bitmap into picture box
    pictureBox1.Image = bmp;
    

    In this case you have no need to redraw your paintings, picture box would do it for you. Dont forget to set BackColor ot picture box to Transparent if you prefer to show paintings from below of picture box.

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

Sidebar

Related Questions

Hey everyone. I'm trying to make a swing GUI with a button and a
Hey everyone. I'm fairly new to VB.NET and I'm looking to create a module
Hey everyone, I am trying to ( temporarily! ) do some ASP.NET and C#
Hey everyone, I am trying to run the following program, but am getting a
Hey everyone, I'm working on a PHP application that needs to parse a .tpl
Hey everyone. While I'm trying to learn some PHP and mySQL, I ran into
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey all, my Computational Science course this semester is entirely in Java. I was
Hey, I've been developing an application in the windows console with Java, and want
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my

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.