⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 note.dsm

📁 MFC程序开发参考大全 【明日科技】宋坤 刘锐宁 李伟明 【丛 书 名】 软件工程师典藏 【出 版 社】 人民邮电出版社 本书详细介绍了MFC框架中所有常用类及控件的应用
💻 DSM
字号:
'------------------------------------------------------------------------------
'FILE DESCRIPTION: 为开发环境添加批量注释或取消注释
'------------------------------------------------------------------------------

Sub SetSelNote()'Sun DESCRIPTION: 过程SetSelNote用于将选中的文本成为注释
	dim CurWin '当前获得的窗口
	set CurWin = ActiveWindow

	if CurWin.type<>"Text" Then '判断当前窗口是否是文本窗口
		MsgBox "当前窗口不是代码窗口"
	else
		NoteType = "//"
		
		 BeginLine = ActiveDocument.Selection.TopLine
		 EndLine   = ActiveDocument.Selection.BottomLine
		
		if EndLine < BeginLine then 
			Line = BeginLine
			BeginLine = EndLine
			EndLine = Line
		else
			for  row = BeginLine To EndLine 
				ActiveDocument.Selection.GoToLine row
				ActiveDocument.Selection.SelectLine '选中当前行
				ActiveDocument.Selection = NoteType+ActiveDocument.Selection
			Next
		End if
	End if

End Sub

Sub CancelSelNote()
	dim CurWin '当前获得的窗口
	set CurWin = ActiveWindow

	if CurWin.type<>"Text" Then '判断当前窗口是否是文本窗口
		MsgBox "当前窗口不是代码窗口"
	else
		
		 BeginLine = ActiveDocument.Selection.TopLine
		 EndLine   = ActiveDocument.Selection.BottomLine
		
		if EndLine < BeginLine then 
			Line = BeginLine
			BeginLine = EndLine
			EndLine = Line
		else
			for  row = BeginLine To EndLine 
				ActiveDocument.Selection.GoToLine row
				ActiveDocument.Selection.SelectLine '选中当前行
				SelBlock =  ActiveDocument.Selection

				Trim(SelBock)
				pos =  instr(SelBlock,"//")
				if pos <>0 then
					RightBlock = Right(SelBlock,Len(SelBlock)-2)
					ActiveDocument.Selection = RightBlock
				 End If
			Next
		End if
	End if

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -