Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Drawing Issue

Drawing Issue

Scheduled Pinned Locked Moved Visual Basic
graphicshelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jamie Nordmeyer
    wrote on last edited by
    #1

    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 Sub

    I 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

    N Z 2 Replies Last reply
    0
    • J Jamie Nordmeyer

      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 Sub

      I 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

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      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


      J 1 Reply Last reply
      0
      • N Nick Parker

        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


        J Offline
        J Offline
        Jamie Nordmeyer
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • J Jamie Nordmeyer

          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 Sub

          I 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

          Z Offline
          Z Offline
          Zulfikar Ali
          wrote on last edited by
          #4

          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

          J 1 Reply Last reply
          0
          • Z 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

            J Offline
            J Offline
            Jamie Nordmeyer
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups