Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Drawing a semi-transparent bar over a datagridview problem

I am trying to draw a vertical bar over a dgv with mixed success.  Here is what I am doing:

            Dim rec1 As Rectangle
            rec1 = dgvMainGrid.GetCellDisplayRectangle(0, 6, True)
            Dim rec2 As Rectangle
            rec2 = dgvMainGrid.GetCellDisplayRectangle(0, 43, True)
            Dim tpen As New Pen(Color.FromArgb(128, 0, 0, 0), 100)
            Dim grap As Graphics = dgvMainGrid.CreateGraphics
            Dim lint As Point
            Dim linf As Point
            linf.X = rec2.Width / 2
            linf.Y = rec2.Bottom
            lint.X = rec1.Width / 2
            lint.Y = rec1.Bottom + 10
            grap.DrawLine(tpen, linf.X, linf.Y, lint.X, lint.Y)
            grap.Dispose()

What I get are gray lines in between rows all the way up to where the bar should end.  It's like the drawing of the dgv cell is taking over and not letting me draw the bar.  Is this what is happening?  Is there a way to draw something on top of a dgv?
0
ddepuemd
Asked:
ddepuemd
  • 3
  • 3
1 Solution
 
Bob LearnedCommented:
What are you trying to do, and where are you trying to do it?
0
 
ddepuemdAuthor Commented:
I found some code that creates a transparent progress bar that I simply overlay on top of the grid.  Seems to work fine and actually looks quite nice.
0
 
Bob LearnedCommented:
Does that mean that my work is done here?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ddepuemdAuthor Commented:
Well, it is a solution I can use, but why does the datagrid prevent me from drawing a rectangle over the top of it and filling it in?  
0
 
Bob LearnedCommented:
"It's like the drawing of the dgv cell is taking over and not letting me draw the bar."
Yes, that is what is happening.
0
 
ddepuemdAuthor Commented:
ok thanks - drawing the transparent bar is working...
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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