C sharp draw table

 i had drawed a table i want to fill a color in some cells in this table by clicking with the mouse pointer, but the problem i want to be attached to the mouse pointer a square that when i click on the mouse button all the cells under this square will be filled by this color, i tried to do this but in my program where the square was going over the table it was erasing these places in the table.

how do i let the sqaure not to erase places on the table where it go over the table (it erase all the line between the coloumn & rows an the data in the cells)

thank you alot
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could you paste the code you are using? WE can't really help you with this if we don't know what kind of structure you use to draw the table.
madmareAuthor Commented:
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
                  Graphics g = CreateGraphics();
                  Pen PnDises = new Pen( Color.Black, 1 );
                  g.DrawRectangle(PnDises, e.X,e.Y,50,50);
                  panel1.BackColor = Color.Transparent;
                  panel1.Left = Cursor.Position.X;
                  panel1.Top = Cursor.Position.Y;


in each time i move the mouse it draw a square but i want this square to move with the muse pointer
Your problem sounds very similair to http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21395766.html

That link might help you out.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Correction, it is the same question from the same person.
How are you doing the drawing? Drawing the table in onpaint event? or just onload?  how are you drawing the item under the mouse cursor, via mousemove event?  Are you doing any invalidation of the drawing space?  Do you have autoredraw set to true for the form properties?

Are you maybe trying to change the color only behind lines you have drawn on the form? if thats the case you need to redraw the lines after you draw the square.  Draw your table in the onpaint event perhaps.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.