After executing this macro, a form will pop up. Enter the type and name in the two Textbox, and the form will be automatically added in the editing area.
Private Int Typeid;
Public Int Typeid
{
Get {Return This. Typeid ;}
Set {This. Typeid=Value ;}
}
Such a property, such as a complete macro, is super depressing why the macro cannot be written in C.
Sub propertygenerator () Sub Propertygenerator ()
Dim Form As Form
Form = New Form
Form. topmost = True
Form. Controls. Add ( New Textbox)
Form. Controls. Add ( New Textbox)
Form. Controls ( 0 ). Text = " Type"
Form. Controls ( 1 ). Text = " Name"
Form. Controls ( 0 ). Dock = Dockstyle. Bottom
Form. Controls ( 1 ). Dock = Dockstyle. Bottom
Form. showdialog ()
Dim Type As String
Dim Name As String
Dim Capitaledname As String
Type = Form. Controls ( 0 ). Text
Name = Form. Controls ( 1 ). Text
Capitaledname = Char . Toupper (name. Chars ( 0 )) & Name. substring ( 1 )
Form = Nothing
DTE. activedocument. selection. Text = " Private " & Type & " " & Name & " ;"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " Public " & Type & " " & Capitaledname & " "
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " {"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " Get {return this. " & Name & " ;}"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " Set {This. " & Name & " = Value ;}"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " }"
DTE. activedocument. selection. newline ()
End sub Dim Line As String
With DTE. activedocument. Selection
Line = . Text
End With
Dim Parts As String ()
Parts = Line. Split ( " " )
If Not Parts. Length = 3 Then
Exit sub
End If
Dim Type As String
Dim Name As String
Dim Capitaledname As String
Type = Parts ( 1 )
Name = Parts ( 2 ). Replace ( " ; " , "" )
Capitaledname = Char . Toupper (name. Chars ( 0 )) & Name. substring ( 1 )
DTE. activedocument. selection. Text = " Private " & Type & " " & Name & " ;"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " Public " & Type & " " & Capitaledname & " "
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " {"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " Get {return this. " & Name & " ;}"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " Set {This. " & Name & " = Value ;}"
DTE. activedocument. selection. newline ()
DTE. activedocument. selection. Text = " }"
DTE. activedocument. selection. newline ()