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. Can some one tell difference between 2 lines of code?

Can some one tell difference between 2 lines of code?

Scheduled Pinned Locked Moved Visual Basic
graphicsquestion
1 Posts 1 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.
  • E Offline
    E Offline
    Eric_Franz
    wrote on last edited by
    #1

    Hello, I've got these 2 lines of code, they each do the same thing, but one produces VERY different results. Can someone please tell me what is going on. It is simple painting code. In a user control, I overrided the onpaint event. The 2 drawing calls inside are practically the same, and produce the same effect on the control. HOWEVER, when you resize the form so the form border clips half of the usercontrol, it creates speckles on the control when you move the form off the control slowly. Take a look: BTW, my usercontrol is inherited from system.windows.forms.button **Protected Overrides Sub** OnPaint(**ByVal** pevent **As** System.Windows.Forms.PaintEventArgs) **MyBase.OnPaint**(pevent) **Dim** p **As New** Pen(Color.Navy) p.DashStyle = Drawing.Drawing2D.DashStyle.Dot **With Me** 'THIS CODE SPECLES FUNNY pevent.Graphics.DrawRectangle(p, 4, 4, .Width - 10, .Height - 10) ' - OR - 'THIS CODE WORKS JUST FINE 'ControlPaint.DrawFocusRectangle(pevent.Graphics, **New** Rectangle(4, 4, .Width - 10, .Height - 10)) **End With** **End Sub** Can Someone Please Please let me know, because I am trying to implement a "focus rectangle", but I don't want to use ControlPaint.Draw.... because I need color customization and ControlPaint.Draw... Doesn't have working color customization. Thanks, ERIC FRANZ

    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