Drawing Issue
-
I'm trying to draw a single black border around my dialog using the following code:
Private Sub LogInDialog_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim Rect As New Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 1)
e.Graphics.DrawRectangle(Pens.Black, Rect)
End SubI have a ComboBox control on the page along with some text fields and such. When I drop the ComboBox's List control, then contract it again, there are marks from where the listbox was (I can see it behind the other controls on the page below the ComboBox). I tried bringing the control to the front, but that didn't help. Any ideas? Thanks in advance for any help. Jamie Nordmeyer Portland, Oregon, USA
-
I'm trying to draw a single black border around my dialog using the following code:
Private Sub LogInDialog_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim Rect As New Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 1)
e.Graphics.DrawRectangle(Pens.Black, Rect)
End SubI have a ComboBox control on the page along with some text fields and such. When I drop the ComboBox's List control, then contract it again, there are marks from where the listbox was (I can see it behind the other controls on the page below the ComboBox). I tried bringing the control to the front, but that didn't help. Any ideas? Thanks in advance for any help. Jamie Nordmeyer Portland, Oregon, USA
Jamie Nordmeyer wrote: Any ideas? Yep, but I know there is a better solution, however this will work for you as I just tried it. :)
Private Sub ComboBox1\_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Me.Refresh() End Sub
Let me know, hope it helps. Nick Parker
May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
-
Jamie Nordmeyer wrote: Any ideas? Yep, but I know there is a better solution, however this will work for you as I just tried it. :)
Private Sub ComboBox1\_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Me.Refresh() End Sub
Let me know, hope it helps. Nick Parker
May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
Hey there, Nick. Thanks for the reply. Actually, I figured it out at the end of the day yesterday, then promptly kicked myself. I was using the clipping rectange (e.ClipRectangle), which only specifies the area that needs updating, not the whole dialog (been doing ASP.NET stuff for the last year, so I forgot a few of my 'Windows programming rules'). Anyway, I changed all the e.ClipRectangle parts to DisplayRectangle (e.ClipRectangle.X to Me.DisplayRectangle.X), and it works great. Again, thanks for thought. :) Jamie Nordmeyer Portland, Oregon, USA
-
I'm trying to draw a single black border around my dialog using the following code:
Private Sub LogInDialog_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim Rect As New Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 1)
e.Graphics.DrawRectangle(Pens.Black, Rect)
End SubI have a ComboBox control on the page along with some text fields and such. When I drop the ComboBox's List control, then contract it again, there are marks from where the listbox was (I can see it behind the other controls on the page below the ComboBox). I tried bringing the control to the front, but that didn't help. Any ideas? Thanks in advance for any help. Jamie Nordmeyer Portland, Oregon, USA
Hello Jamie: I am trying to do the similar thing. i need to draw a rectangle and fill with white color. Any idea? Thanks:confused: Zulfikar Ali
-
Hello Jamie: I am trying to do the similar thing. i need to draw a rectangle and fill with white color. Any idea? Thanks:confused: Zulfikar Ali
From with a paint event handler, you can use
e.Graphics.FillRectangle(Color.White, Rect)
replacing Rect with the rectangle you want to fill. Did that answer your question? Jamie. Jamie Nordmeyer Portland, Oregon, USA