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