1. There are SyntaxEditControl functions: void CollapseAll(); and void ExpandAll();
2. In VB sample Options control by VB own form - not a part of OCX. So you can implement one you like.
this is example of VB code from frmOptions - VB SyntaxEditSample:
Option Explicit
Public m_pSyntaxEdit As SyntaxEdit
Private m_pFont As New StdFont
Private Sub Apply(pSyntaxEdit As SyntaxEdit) pSyntaxEdit.Font.Bold = m_pFont.Bold pSyntaxEdit.Font.Italic = m_pFont.Italic pSyntaxEdit.Font.Name = m_pFont.Name pSyntaxEdit.Font.Size = m_pFont.Size pSyntaxEdit.Font.Strikethrough = m_pFont.Strikethrough pSyntaxEdit.Font.Underline = m_pFont.Underline pSyntaxEdit.ShowLineNumbers = IIf(chkLineNumbers.Value > 0, True, False) pSyntaxEdit.ShowSelectionMargin = IIf(chkSelMargin.Value > 0, True, False) pSyntaxEdit.ShowScrollBarVert = IIf(chkScrollVert.Value > 0, True, False) pSyntaxEdit.ShowScrollBarHorz = IIf(chkScrollHorz.Value > 0, True, False) pSyntaxEdit.EnableAutoIndent = IIf(chkAutoIndent.Value > 0, True, False) pSyntaxEdit.EnableVirtualSpace = IIf(chkVirtualSpace.Value > 0, True, False) pSyntaxEdit.EnableSyntaxColorization = IIf(chkSyntaxColorization.Value > 0, True, False) End Sub
Public Sub ApplyTo(pSEdest As SyntaxEdit, pSEsrc As SyntaxEdit) pSEdest.Font.Bold = pSEsrc.Font.Bold pSEdest.Font.Italic = pSEsrc.Font.Italic pSEdest.Font.Name = pSEsrc.Font.Name pSEdest.Font.Size = pSEsrc.Font.Size pSEdest.Font.Strikethrough = pSEsrc.Font.Strikethrough pSEdest.Font.Underline = pSEsrc.Font.Underline pSEdest.ShowLineNumbers = pSEsrc.ShowLineNumbers pSEdest.ShowSelectionMargin = pSEsrc.ShowSelectionMargin pSEdest.ShowScrollBarVert = pSEsrc.ShowScrollBarVert pSEdest.ShowScrollBarHorz = pSEsrc.ShowScrollBarHorz pSEdest.EnableAutoIndent = pSEsrc.EnableAutoIndent pSEdest.EnableVirtualSpace = pSEsrc.EnableVirtualSpace pSEdest.EnableSyntaxColorization = pSEsrc.EnableSyntaxColorization End Sub
Private Sub btnFont_Click() cmndlgFont.Flags = cdlCFBoth + cdlCFEffects + cdlCFForceFontExist + cdlCFFixedPitchOnly cmndlgFont.FontBold = m_pFont.Bold cmndlgFont.FontItalic = m_pFont.Italic cmndlgFont.FontName = m_pFont.Name cmndlgFont.FontSize = m_pFont.Size cmndlgFont.FontStrikethru = m_pFont.Strikethrough cmndlgFont.FontUnderline = m_pFont.Underline cmndlgFont.ShowFont m_pFont.Bold = cmndlgFont.FontBold m_pFont.Italic = cmndlgFont.FontItalic m_pFont.Name = cmndlgFont.FontName m_pFont.Size = cmndlgFont.FontSize m_pFont.Strikethrough = cmndlgFont.FontStrikethru m_pFont.Underline = cmndlgFont.FontUnderline
txtFont.Caption = CLng(m_pFont.Size) & " pt. " & m_pFont.Name txtFont.Font.Bold = m_pFont.Bold txtFont.Font.Italic = m_pFont.Italic txtFont.Font.Strikethrough = m_pFont.Strikethrough txtFont.Font.Underline = m_pFont.Underline
End Sub
Private Sub cmdApply_Click() Apply m_pSyntaxEdit End Sub
Private Sub cmdCancel_Click() Unload Me End Sub
Private Sub cmdOK_Click() cmdApply_Click Unload Me End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Dim i As Integer i = tbsOptions.SelectedItem.Index 'handle ctrl+tab to move to the next tab If (Shift And 3) = 2 And KeyCode = vbKeyTab Then If i = tbsOptions.Tabs.Count Then 'last tab so we need to wrap to tab 1 Set tbsOptions.SelectedItem = tbsOptions.Tabs(1) Else 'increment the tab Set tbsOptions.SelectedItem = tbsOptions.Tabs(i + 1) End If ElseIf (Shift And 3) = 3 And KeyCode = vbKeyTab Then If i = 1 Then 'last tab so we need to wrap to tab 1 Set tbsOptions.SelectedItem = tbsOptions.Tabs(tbsOptions.Tabs.Count) Else 'increment the tab Set tbsOptions.SelectedItem = tbsOptions.Tabs(i - 1) End If End If End Sub
Private Sub Form_Load() m_pFont.Bold = m_pSyntaxEdit.Font.Bold m_pFont.Italic = m_pSyntaxEdit.Font.Italic m_pFont.Name = m_pSyntaxEdit.Font.Name m_pFont.Size = m_pSyntaxEdit.Font.Size m_pFont.Strikethrough = m_pSyntaxEdit.Font.Strikethrough m_pFont.Underline = m_pSyntaxEdit.Font.Underline txtFont.Caption = CLng(m_pFont.Size) & " pt. " & m_pFont.Name txtFont.Font.Bold = m_pFont.Bold txtFont.Font.Italic = m_pFont.Italic txtFont.Font.Strikethrough = m_pFont.Strikethrough txtFont.Font.Underline = m_pFont.Underline chkLineNumbers.Value = IIf(m_pSyntaxEdit.ShowLineNumbers, 1, 0) chkSelMargin.Value = IIf(m_pSyntaxEdit.ShowSelectionMargin, 1, 0) chkScrollVert.Value = IIf(m_pSyntaxEdit.ShowScrollBarVert, 1, 0) chkScrollHorz.Value = IIf(m_pSyntaxEdit.ShowScrollBarHorz, 1, 0) chkAutoIndent.Value = IIf(m_pSyntaxEdit.EnableAutoIndent, 1, 0) chkVirtualSpace.Value = IIf(m_pSyntaxEdit.EnableVirtualSpace, 1, 0) chkSyntaxColorization.Value = IIf(m_pSyntaxEdit.EnableSyntaxColorization, 1, 0) End Sub
Private Sub Form_Unload(Cancel As Integer) Set m_pSyntaxEdit = Nothing End Sub
Private Sub tbsOptions_Click()
Dim i As Integer 'show and enable the selected tab's controls 'and hide and disable all others For i = 0 To tbsOptions.Tabs.Count - 1 If i = tbsOptions.SelectedItem.Index - 1 Then picOptions(i).Left = 210 picOptions(i).Enabled = True Else picOptions(i).Left = -20000 picOptions(i).Enabled = False End If Next
End Sub
------------- Mark Doubson, Ph.D.
|