Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Visual Studio addin - code color

Visual Studio addin - code color

Scheduled Pinned Locked Moved C#
csharpvisual-studiocomdebuggingtools
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LimitedAtonement
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • L LimitedAtonement

      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

      L Offline
      L Offline
      LimitedAtonement
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups