Is it possible to display custom icon in Visual Studio status bar - visual-studio

I am aware of displaying custom text in Visual Studio status bar using IVSStatusBar interface. I have even blogged about it.
However, I have requirement to display custom icon on the Visual Studio status bar. Similar to what Resharper does to display solution errors. On clicking the icon, it also pops-up a context menu.
So, How can I display a custom icon in Visual Studio status bar, and if possible display a menu also on clicking it?. An example will help.
The Animation method of IVSStatusBar already display icons, but uses predefined icons defined in Constants. Is it possible to have custom icons and pass to Animation method?
On exploring the SDK, I found that IVSStatusBarUser interface can be used to display custom information when the window implementing that interface is displayed. But I am not sure whether that interface can be used to display custom icon.

There is no published API for that kind of status bar extensibility. In one of my own extensions (PerfWatson Monitor), I locate the status bar element by searching the WPF visual tree, using a recursive search and VisualTreeHelper, descending from Application.Current.MainWindow looking for the resize gripper in the bottom right - a child element with the Name property set to
"ResizeGripControl". When I've found the gripper, I look at its parent (it should be a DockPanel) and insert my control in there. Note that, as your screenshot shows, Resharper is known to employ a similar trick, so you'll have to come up with a strategy that works with and without Resharper installed. Also note that some pieces of the status bar (the text, the line/col information and any animations) run in their own UI thread, so be careful if your control ends up there.
I notice you also ask about extending the existing animations. Yes, you can supply your own animations via a bitmap strip of 16x16 frames. See http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/fef208e7-b79d-4a0c-94fe-e6861196e1f5/#ba47b61c-77a8-46c8-aa10-a04211312e6c for an example. Unfortunately, this won't allow a clickable menu.

Related

Activereports (under VB6) issue

I have to modify an old VB6 program that uses ActiveReports 2.0 at work and I am having some problems (BTW I have never used this program before and only have a basic knowledge of VB6)...
I have to make some text boxes biggers which is pretty easy to do but as soon as I move them a whole section of text (and not simply the content of that text box) disappear.
I have noticed that it was in some sort of section (sorry, I don't know how they call that) which englobed those text boxes so I made it bigger and that made no difference.
What could be causing this?
Thank you!
Nick
It sounds like the TextBox is inside a UserControl. A UserControl is created by a developer, and is basically one control with any number of other controls in it. You can check to see if there are any User Controls in your project in the Project Explorer (Ctrl+R).
One way to know exactly what class the control belongs to is to open your form in design mode (Shift+F7), click on the control, and look at the Properties window (F4). The drop-down list should show the currently selected control's class name in bold, then the name of the object.
What is the control's class? If it is anything other than TextBox, then this would explain the unexpected behavior you experienced.

How can I create a custom menu/navigation screen in Visual Studio 2012 LightSwitch?

Visual Studio 2012 LightSwitch gives you a default of 5 or 6 screens such as: search, create new, etc..
I would like to create a very basic custom navigation/main menu screen. All this screen would contain is literally 6 vertical buttons in a maximized window (For starters and for simplicity of the question) and each button would pop up another screen.
Is there anything resembling the drag-and-drop of a regular Visual Studio 2012 application? I would basically like to create a new Screen Template called: "Navigation Menu" or something similar.
Thanks, DM.
You can only create a new Screen Template by creating a LightSwitch Screen Template Extension.
However it's not really a job for the faint hearted. I've created a number of extensions over the past couple of years, & I regard the Screen Template Extension to be the hardest to do. I understand what goes into designing a Screen Template. It can be quite code-intensive, depending on what you want the template to create for you. I have a couple of screen templates that I want to create for my own needs, but I keep putting them off.
I don't want to put you off, just give you a heads up about what you're in for, if you do decide to create your own screen template extension.
One question though. Are you wanting to reuse this screen, either in the same application, or in other applications? If ther answer is "no", then creating a screen template extension would be overkill.
If you're only wanting one of these screens, to do what you described, all you have to do is add a RowsLayout control to a screen, then add one RowsLayout controlfor each navigation "button" that you want on the screen. Use the Add Button context menu option (right-click the RowsLayout control) to add a button. Set the size etc to what you want, & set the RowsLayout controls Horizontal Alignment setting to Center.
The buttons won't be all that "sexy", they'll just be larger versions of the same buttons that you'll see anywhere else in the application (except for size, if you decide to change that). The main advantage is that you can do it, quickly, & out of the box.
Or you could do something like in this article, Course Manager VS 2012 Sample Part 6 – Home Screen, if you want to improve the look of the screen.

where is the specific button on design mode?

how can i find the specific button on design mode where i have several buttons ie: hundered of buttons so that they all like spaghetti and one button may be under another button or a groupbox (i might be playing with the visibilities ) and i want to see my button number 83 on the design. how can i see him? where is he hiding? :) i use visual studio as an IDE. thanks.
MessageBox.Show(" where is the specific button? i know that he is somewhere on the form but cant distinguish it on the design since its somewhere under something i cant find it");
Use Document Outline (View - Other Windows - Document Outline)
Just pick the button from the tree and voila.
PS: this works for other types of designers (WPF/Silverlight, ASP.NET)
You can access it via the Properties Window. There is a drop-down that will list all of the items in your form in design mode.
Then use the drop-down. The drop-down will list all of the items on your form so you will scroll through the list to find Button number 83.
Images were pulled from MS Visual Studio: The properties Window which contains an explanation of the window.
Have you tried using the properties window?

VSPackage Builder search dialogue

I'd like to add a search dialogue popup, really just a text box or something at the top right of the current document. I've messed around with the VSPackage builder and it's easy enough, but I'm having trouble finding out which UI elements I should be looking at.
A ToolWindow doesn't quite fit I don't think -- I'd like what I'm doing to be borderless. I tried just using a custom WPF window by itself but that doesn't play well with the IDE.
It sounds what you're after is an editor viewport adornment.
This is a type of extension that has a class inherited from Microsoft.VisualStudio.Text.Editor.IWpfTextViewCreationListener
To create an adornment, you can use the Editor Viewport Adornment project template under Visual C#\Extensibility.
Try this example:
http://www.codeproject.com/Articles/55196/Code-InfoBox-Visual-Studio-Extension-VSX-2010

How to use the color picker dialog to set color properties in the property editor?

This sounds like a trivial question, but it's proved quite hard to google anything about this.
When editing Color-typed properties through the property editor (when designing WinForms), a little editor pops up with three tabs: Custom, Web and System. I want to set a custom color by using the standard color picker dialog because none of the listed Custom colors are suitable.
I am sure that this used to be possible by double-clicking a blank color on the Custom tab, but this just picks the color being double-clicked and closes the drop-down in my VS2008. Am I imagining this, or did it really use to be possible? Can I do this in VS2008 somehow?
Right click on a blank colour in the palette shown by the custom tab. Brings up the "Define Color" dialog (in VS2008 C# Express, and I imagine the same in other versions).
EDIT - Having discovered this by experimentation, the MSDN library describes it here.
Interestingly, no keyboard-only interface is described.

Resources