zoukankan      html  css  js  c++  java
  • VsAddIn "Region this"

    顺手给vs2008写了个Region this插件,设置个快捷键后,还真爽!
     1        private bool Proc()
     2        {
     3            string selectedText;
     4            string name = "成员变量";
     5            EditPoint startPoint = ((TextSelection)_applicationObject.ActiveDocument.Selection).TopPoint.CreateEditPoint();
     6            EditPoint endPoint = ((TextSelection)_applicationObject.ActiveDocument.Selection).BottomPoint.CreateEditPoint();
     7
     8            if (startPoint.EqualTo(endPoint)) return false;
     9            if (!startPoint.AtStartOfLine) startPoint.StartOfLine();
    10
    11            _applicationObject.UndoContext.Open("Insert a region"true);
    12            try
    13            {
    14                selectedText = startPoint.GetText(startPoint.LineLength);
    15                startPoint.Insert(String.Concat("\r\n #region ", name, "\r\n\r\n"));
    16                endPoint.Insert("\r\n\r\n #endregion");
    17            }

    18            catch (Exception ex)
    19            {
    20                Debug.WriteLine(ex.Message);
    21            }

    22            finally
    23            {
    24                _applicationObject.UndoContext.Close();
    25            }

    26
    27            return true;
    28        }
  • 相关阅读:
    Java1:Chapter2
    Java1:Chapter1
    Java1:Chapter11
    Java1:Chapter8
    Java1:Chapter6
    Android day 03
    Android day02
    Android day01
    二进制文件的读写
    字符流
  • 原文地址:https://www.cnblogs.com/xiaowy/p/923347.html
Copyright © 2011-2022 走看看