Hi,
You have override the wm_ncpaint message to change the border of a
control. I wrote a class that uses native windows to change the border
of a control. Make sure the control has to have its borderstyle set to
anything other than none.
Public Class XpBorderChanger
Inherits NativeWindow
Declare Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal
hwnd As IntPtr) _
As IntPtr
Declare Function ReleaseDC Lib "user32" Alias "ReleaseDC" (ByVal
hwnd As IntPtr, _
ByVal hdc As IntPtr) As Integer
Private ctrl As Control
Public Sub New(ByVal ctrl As Control)
AssignHandle(ctrl.Handle)
Me.ctrl = ctrl
End Sub
Protected Overrides Sub WndProc(ByRef m As Message)
' Listen for operating system messages
Const WM_NCPAINT As Integer = &H85
If m.Msg = WM_NCPAINT Then
Dim hdc As IntPtr = GetWindowDC(m.HWnd)
Dim g As Graphics = Graphics.FromHdc(hdc)
Dim pXp As Pen = New Pen(Color.Blue, 3)
g.DrawRectangle(pXp, 0, 0, ctrl.Width - 1, ctrl.Height - 1)
ReleaseDC(Me.Handle, hdc)
Else
MyBase.WndProc(m)
End If
End Sub
Protected Overrides Sub Finalize()
ReleaseHandle()
MyBase.Finalize()
End Sub
End Class
http://www.onteorasoftware.com/downloads/borderchanger.zip
Ken
-----------------------