请教老师,参照论坛中的关于使用RichTextBox控件设置行距的代码,生成后,Panel的边框是Fixed3D的,
我在窗口afterload,设置了 rtxt.BorderStyle = BorderStyle.FixedSingle 无效 但参数设置为None就有效
问题,想实现Panel的边框为单线,边框颜色设置为Silver,应该怎样写代码
全局里面的代码好像是用C#改的,对这个不太懂,不知道怎样修改
Public Class UtilsSetLineSpace
Public Const WM_USER As Integer = &H400
Public Const EM_GETPARAFORMAT As Integer = WM_USER + 61
Public Const EM_SETPARAFORMAT As Integer = WM_USER + 71
Public Const MAX_TAB_STOPS As Long = 32
Public Const PFM_LINESPACING As UInteger = &H100
<StructLayout(LayoutKind.Sequential)> _
Private Structure PARAFORMAT2
Public cbSize As Integer
Public dwMask As UInteger
Public wNumbering As Short
Public wReserved As Short
Public dxStartIndent As Integer
Public dxRightIndent As Integer
Public dxOffset As Integer
Public wAlignment As Short
Public cTabCount As Short
<MarshalAs(UnmanagedType.ByValArray, SizeConst := 32)> _
Public rgxTabs As Integer()
Public dySpaceBefore As Integer
Public dySpaceAfter As Integer
Public dyLineSpacing As Integer
Public sStyle As Short
Public bLineSpacingRule As Byte
Public bOutlineLevel As Byte
Public wShadingWeight As Short
Public wShadingStyle As Short
Public wNumberingStart As Short
Public wNumberingStyle As Short
Public wNumberingTab As Short
Public wBorderSpace As Short
Public wBorderWidth As Short
Public wBorders As Short
End Structure
<DllImport("user32", CharSet := CharSet.Auto)> _
Private Shared Function SendMessage(hWnd As HandleRef, msg As Integer, wParam As Integer, ByRef lParam As PARAFORMAT2) As IntPtr
End Function
''' <summary>
''' 设置行距
''' </summary>
''' <param name="ctl">控件</param>
''' <param name="dyLineSpacing">间距</param>
Public Shared Sub SetLineSpace(ctl As Windows.Forms.Control, dyLineSpacing As Integer)
Dim fmt As New PARAFORMAT2()
fmt.cbSize = Marshal.SizeOf(fmt)
fmt.bLineSpacingRule = 4
' bLineSpacingRule;
fmt.dyLineSpacing = dyLineSpacing
fmt.dwMask = PFM_LINESPACING
Try
SendMessage(New HandleRef(ctl, ctl.Handle), EM_SETPARAFORMAT, 0, fmt)
Catch
End Try
End Sub
End Class
Public Sub mytxt_TextChanged(sender As Object, e As EventArgs)
Functions.Execute("mytxt_TextChanged", sender, e)
End Sub