[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 526
  • Last Modified:

C# tool tip

hii,
  i wrote a function that draw a table on my form, the problem is when a toolTip Display on any line of the table Rows or Column, in this place the toolTip erase the table line.

how do i draw a table & when a toolTip is showed on it's line, the toolTip will not erase the line on this place

this is the "Draw Table Function"

private void Draw_Dises_matrix(System.EventArgs pe)
            {
                  toolTip1.Active = false;
                  Graphics g = CreateGraphics();
                  Pen PnDises = new Pen( Color.Black, 1 );
                  
                  float x = CircleX;

                  while (  x <= CircleX + CircleWidth + DisesX )
                  {
                        float y = CircleY;

                        while ( y <= CircleY + CircleHeight)
                        {
                              g.DrawRectangle(PnDises , x  , y, DisesX ,DisesY );
                              y = y +DisesY;
                        }

                         x = x + DisesX;
                  }
                              }

thank you
0
madmare
Asked:
madmare
  • 2
1 Solution
 
Bob LearnedCommented:
When you use the CreateGraphics method, then it creates a non-persistent graphics handle, so that the display doesn't get updated when the tooltip disappears.  You will need to get the Graphics object from the Paint event for persistent graphics.

Bob
0
 
Bob LearnedCommented:
Example of painting on a PictureBox control:

    private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
   
    {
      toolTip1.Active = false;
               
      float x = CircleX;

      while (  x <= CircleX + CircleWidth + DisesX )
      {
        float y = CircleY;

        while ( y <= CircleY + CircleHeight)
        {
          e.Graphics.DrawRectangle(Pens.Black, x  , y, DisesX ,DisesY );
          y += DisesY;
        }

        x += DisesX;
      }
    }


Bob
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now