Visual Studio addin - code color
-
Dear Sirs, I would like to learn how to create Visual Studio (2008) addins. I thought I would start by making one that changes the color of the current line. This has proved to be very difficult. First, there are very few examples, so I go to the SDK. Second, it seems that the MSDN isn't consistent here. I don't know what I'm missing, but I see
DTE.get_Properties(String category, String page);
in code, but DTE properties[^] lists it differently, as
DTE.Properties {get;}
Whatever, I got past that, and now I use
get_Properties(string, string)
. So, I found out how to get general color properties:Properties ps = DTE.get_Properties("FontsAndColors", "TextEditor");
Property fC = ps.Item("FontsAndColorsItems");
FontsAndColorsItems fcs = fC.Object as FontsAndColorsItems;
foreach (ColorableItems a in fcs)
Debug.WriteLine(a.Name);(the above listing gives all the different properties in
Tools > Options > Environment > Fonts and Colors > Display items:
)****GETTING TO THE POINT****
But, what I need is to be able to access LOCAL color properties. A start might be to be able to set the font color or background color, or whatever, of the current selection:
Document doc = DTE.ActiveDocument;
TextSelection sel = doc.Selection as TextSelection;Or something like that. Any suggestions?
In Christ, Aaron Laws http://ProCure.com
-
Dear Sirs, I would like to learn how to create Visual Studio (2008) addins. I thought I would start by making one that changes the color of the current line. This has proved to be very difficult. First, there are very few examples, so I go to the SDK. Second, it seems that the MSDN isn't consistent here. I don't know what I'm missing, but I see
DTE.get_Properties(String category, String page);
in code, but DTE properties[^] lists it differently, as
DTE.Properties {get;}
Whatever, I got past that, and now I use
get_Properties(string, string)
. So, I found out how to get general color properties:Properties ps = DTE.get_Properties("FontsAndColors", "TextEditor");
Property fC = ps.Item("FontsAndColorsItems");
FontsAndColorsItems fcs = fC.Object as FontsAndColorsItems;
foreach (ColorableItems a in fcs)
Debug.WriteLine(a.Name);(the above listing gives all the different properties in
Tools > Options > Environment > Fonts and Colors > Display items:
)****GETTING TO THE POINT****
But, what I need is to be able to access LOCAL color properties. A start might be to be able to set the font color or background color, or whatever, of the current selection:
Document doc = DTE.ActiveDocument;
TextSelection sel = doc.Selection as TextSelection;Or something like that. Any suggestions?
In Christ, Aaron Laws http://ProCure.com
Maybe the way to do it is by painting on the code window with alpha colors??? get the top point and the bottom point, and paint the following color onto the code window between those points for the width of the form:
255,255,255,200
(r,g,b,a)??In Christ, Aaron Laws http://ProCure.com