C sharp draw table

hii,
 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
madmareAsked:
Who is Participating?
 
existenz2Commented:
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.
0
 
existenz2Commented:
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.
0
 
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
0
 
existenz2Commented:
Correction, it is the same question from the same person.
0
 
KeirGordonCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.