المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Visual Studio addin - code color



C# Programming
12-05-2009, 05:31 PM
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 (http://msdn.microsoft.com/en-us/library/envdte.dte_properties.aspx)[^ (http://msdn.microsoft.com/en-us/library/envdte.dte_properties.aspx)] 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