C sharp draw table

Posted on 2005-04-24
Medium Priority
Last Modified: 2008-03-17
 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
Question by:madmare
  • 3
LVL 14

Expert Comment

ID: 13853095
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.

Author Comment

ID: 13856768
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
LVL 14

Accepted Solution

existenz2 earned 1500 total points
ID: 13859379
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.
LVL 14

Expert Comment

ID: 13859390
Correction, it is the same question from the same person.

Expert Comment

ID: 13878907
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.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This video teaches viewers about errors in exception handling.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

864 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