In my extension I'd like to be able to show some text in the VS status bar all the time, so I can't use "alert" part (the leftmost area), since anybody (VS/other extensions) can overwrite it.
It seems that IVsStatusbar doesn't have such a facility, it only has SetText(string) which sets the alert area. However, ReSharper is able to use rightmost area as well, it puts its code inspection info there.
Is there a way either to write to a different area of the status bar, or to hook up into process of setting the text of it (so I could append all the incoming text after my block)?
I had the same requirement which I asked in MSDN Forum. I was told it is not possible through SDK.
Related
I am currently working on a Windows Presentation Foundation app and I need to make use of Message boxes. I want to get few information from user inside Message Box popup.
But they appear always like this:
But I think the actual look of it should be like that:
Does anybody know, why this is, and how to solve it? I tried all everything listed
here
, but nothing worked.
I agree with Keithernet, build your own. Its more of an Input Dialog box. You may want to plan it to create a window, create it with ex: 4 parameters which you could override so you can apply them in the form including
The title,
The prompt you want the user to fill in
optional default button 1 text
optional default button 2 text.
have the input value stored into a public property in the window for the text to be bound to during entry.
If the user clicks the cancel button (or similar), clear the text entry and close the window. If ok button, just close the window.
Then, when you call it with a YourWindow.ShowDialog(), upon return, you can look at the public property for that input text value.
You could even do with a property / flag if the user cancelled directly or not. I have done similar in a couple of my WPF apps.
MessageBox is very limited. Based on your screenshot, you should just create your own child Window with your own XAML so you can get the user input.
You can find sample service implementations/NuGets for this on GitHub. Here is one I've created sometime ago: https://github.com/Dirkster99/MsgBox
Just create your own is an oversimplifying statement in my opinion because this is usually a dialog that you want to show in different parts of the application. Therefore, you have to settle for a software design pattern (I chose a service implementation as suggested here).
Likewise, there are other design decisions that should be taken. I have for instance made sure that the API has a compatible subset of Show API calls with the standard .Net MessageBox to make its application as flexible as possible. I also settled for light and dark themes hoping this will make its application easy in any other theme...
I have a program I created which amongst other things has 20+ buttons which link to various sites and programs I use for work. The program has started being used by other people and the buttons don't quite meet their need.
What I would like to do is allow the user to set the button up to direct to a specified URL at runtime, and maintain that information for future use (I'll work on that bit later) - Allowing every user to cater it to their own criteria.
To make this easier, the buttons already exist with a generic name, and no text, and are initially invisible. All of them when in use would direct to a particular URL, nothing else. I would like the user to be able to click an "Add" button, set the button Text, text colour (I can do this bit) and fill in a text box to set the url for the browser (Default browser, not webBrowser.), which they would save, making the button visible, and usable.
I've had a look around, but cannot for the life of me work out how to do this.
Some guidance on the issue would be fantastic
Thanks in advance
Anthony
You could accomplish this using a DataGridView with a DataGridViewButtonColumn.
Because I had a set number of available buttons, I was able to create them and hide them. Set it up so the user sets the variable that the Start.Process. is using for the url, as well as set the button text in real time.
They save this information in a text document that's stored in the programs home folder, and this is pulled back through when the program is re-opened. This will work well for my simple purposes.
I have C# add-in for Word and would like to implement an interactive tutorial like games usually have. I'd like to somehow highlight (maybe by circling) certain visual elements and display text boxes that describe what the element does. For example, say the add-in is a generic workflow editor. I'd like to show to the user, step by step, what needs to be done by visually selecting elements and explaining what they do and what options (s)he has. My first question is: can this be done in C#? My second question is how? :) I suppose I'd have to get the positions of said visual elements and then draw an image on top but I don't know how that could be done.
I'm a bit disappointed that not even a single member of the Stack Overflow community took the the time to at least give a hint about this. But such is life and I'm just going to share my findings here because I'm certain someone else will benefit from them.
To be able to do an interactive tutorial you need three things:
a method to find where a control is located in terms of screen coordinates
a method to point the user to the control by highlighting it or
surrounding it with a red line for example.
a method to do its default action (ie: click a button).
In other words, the idea is to have some sort of window with text describing a control and some graphical way of indicating the control in the app. Optionally, the window could provide something like a ShowMe button which shows the user how to use the control by taking control of the mouse and keyboard.
This is trivial when the controls are made by yourself and thus have source code access. However, when doing such a thing for a black box app such as Word you can use the Windows IAccessible interface. Searching for that with your favorite search engine will yield everything you need to understand it and use it. IAccessible allows one to do many things but most importantly it can get a control's position and can also do the default action.
Having sorted out these things the next step is to figure out how to graphically point out the control. There are many ways to do this but in my case I chose to surround it with a red rectangle. I did this by creating an invisible, borderless form with an empty red rectangle on it. Having the control's position and size, I had no problems placing the aforesaid form over the control.
So there you have it. I laid out the building blocks that one needs to make an interactive tutorial for any app.
Reading lots of characters and updating a textbox was suggested to me when I created this question, and it was exactly what I was looking for (couldn't find it by just searching). However a couple of points need clarifying.
I am looking to upgrade to a ListBox or even RichTextBox. For now I want to be able to replace as little of the onscreen (and off, as an added bonus) text as possible.
In the first link Guffa wrote:
If the data is line based, use a list instead of a text box, so that you only have to update the last line when you add a character.
I have a split pane where updates to one TextBox are translated and shown on the other side, and vice-versa. I've briefly toyed with a ListBox but it doesn't provide the intrinsic text-editing funcionality of a TextBox so I went back.
What component should I be using? I wouldn't have thought that with all of .NET available I should have to consider Win32.
Ok, no one else has offered an answer so I will propose a solution which is the last one open to me short of refactoring back to Win32 API calls.
The solution is to use two textboxes. Instead of replacing the text element of the on-screen one you replace that of its dupe, which at the time is hidden, you then toggle the visible flags of both.
I'll let you know how it goes but it is major work for not much advantage, I'll prolly just live with a bit of flicker for now.
I am creating a NotifyIcon and then calling this to show a balloon-tip from the system tray:
_trayIcon.ShowBalloonTip(100000, notifierTitle, notifierText, ToolTipIcon.Info);
Everything works fine but I wondered: is there any way to format the text in a system tray tooltip? (In my case, notifierText)
Obviously, I am adding newline characters etc. but I would like certain parts to be bold or italic and maybe even add blue hyperlinked text to separate lines in the tooltip.
I am aware of the events that are available and they don't cover this sort of thing.
I'm sure I've seen it done elsewhere...
So is it possible, and if so, how do I do it??
There's a ever so slight hint that this might be possible if you run on Vista or higher. From the documentation of NOTIFYICONDATA:
When uVersion is set to
NOTIFYICON_VERSION_4, the standard
ToolTip is replaced by the
application-drawn pop-up user
interface (UI)
But with any hints whatsoever how to actually make this work. Googling for +NOTIFYICON_VERSION_4 +ToolTip doesn't produce anything relevant. It also isn't wrapped by the Windows API Code Pack. I'm guessing that it takes listening for callback notifications.
At any rate, you will have to completely replace the NotifyIcon class to make this work. Maybe your google fu can get you a better hit.