VSTO: How to implement Office Standard Custom Task Pane TabContainer - controls

I'm looking for a simple way to implement the standard office custom Task pane TabContainer which looks like this one:
Standard Office TabContainer
(1) is easy to implement
(2) with the TabContainer there is a way to use Icons also - but they don't look so nice like in this one with mouse over effect etc.
(3) I didn't found in the standard TabContainer a setting to enable such a line with a marker
Is this a separate component or does anybody has an example what all is needed to have such a control?

Office has a history of using controls that it doesn't expose to third party devs. The recent files lists for example, are not re-usable, among others.
But maybe they didn't do that this time, maybe they did make it available. They'd probably include it in some release notes, right? But it's not listed in What's new for developers for either Word 2013 or Office 2013 in general.
Okay, maybe they just forgot to include it there? I also took a look through intellisense where I might expect to find it but did not. A bit of googling isn't coming up with anything either.
I don't think this is something you can re-use.
You can of course re-create it. It might be easiest with WPF, but only relatively speaking, It's probably not going to be easy, overall. Also, if you go this route, you need separate and more specific questions than "How do I do this?" Go try to do it, and ask questions related to the roadblocks you run into.

Related

Custom Intellisense Extension

I am wanting to write an addition to intellisense in Visual Studio.
Is it possible to extend at all, from my research I haven't found any samples or documentation on intellisense extensions.
How can I get intellisense to show a simple HelloWorld message like the following (where hello world is added at run time to the intellisense for String):
So in Visual Studio 2010 and later, the extensibility APIs you want to at are under the Microsoft.VisualStudio.Languages.IntelliSense namespace. At a high level, you want to MEF export a ICompletionSourceProvider which will provide the items you need. There are two good blog posts here and here that demonstrate the basic technique.
There are two problems that you'll run into if you wanted to make your screenshot be a reality. (This is why I asked for the scenario, as my advice here would change.) First, this method doesn't legally let you append to an existing completion set, but rather provide a new one. In the UI this appears as two tabs, like the Common/All tabs in the Visual Basic editor. This is a limitation of the current API. You could try to modify one of the existing completion sets in your AugmentCompletionSource but I have no idea if that'd work. It's definitely unsupported, in any case.
Second, it's really hard to know when and where to recommend things. In your example, you said "the IntelliSense for string". Sadly, there aren't any APIs (currently) in VS that let you know what the thing before the dot is. You could do some simple heuristics or try implementing some parser that is Good Enoughâ„¢ for your scenario, but you'll have to accept for now that you won't have perfect results.
The Roslyn project aims to fix the second issue, so you may find it useful to explore a bit further. Since we expect that lots of people will want to extend completion, we're also thinking about offering other extensibility APIs so you don't have to roll a ICompletionSourceProvider from scratch, but such APIs are not in the current CTP.
[Disclaimer: I'm a member of the Roslyn team who works on IntelliSense.]

Quickly sharing temporary snippets between developers

I am looking for a quick way to share code snippets between developers. Visual studio allows you to use a file share as a repository for snippets, but the VS Snippet manager seems more oriented towards "permanent" snippets you want to keep around. I'm just looking for a good way to send a block of code to another developer to look at, or copy into their code.
Instant messengers tend to have character limits and don't really retain formatting well. I could use something like pastebin, but I really don't want to expose this code to others potentially for non-disclosure reasons (regardless of how much those snippets may or may not be sensitive, still have to maintain NDA). I know, Pastebin has a private mode, but it would still be a grey area to my bosses. They would argue that you can forget to mark it private and then the code is out there public.
I could save the snippets to a file, and then send them via IM or file share, but that's just a lot of hassle.
Ideally, i'm looking for something free.. open source or not doesn't matter. And i'm looking for something that's very fast to use without a lot of hassle for each snippit transfer, and is privateish between the sharer and sharee.
I was thinking about writing such a plug-in for VS, but if there's already something out there, i'd rather use that. So if you have any suggestions, i'd love to hear them.
EDIT:
I'm having a hard time believing something like this doesn't exist. It seems all the snippit managers are designed for long term storage and retrieval. Ideally, I'd like something like OneNote's "Side Note" that pops up a quick window, i can past something in it, then send it to a co-worker, then have that pop up in their screen. No storage, no archival, no keystroke integration to paste it into your code..
How about a shared Google Docs document?
If you are using GIT, you can easily email a patch or share to a common branch. One of the many benefits of using GIT :)

How create custom user interface for Windows?

There are many applications for Windows these days that don't use native windows controls, don't have standard window frames and generally look different. What are some recommended techniques for creating such interfaces?
There are good reasons not to. Like that you will most likely not do a better job than Windows does. (Maybe it will look better (in your opinion), but will it behave?). Or that it's not what most users expect. Or that it will look like s**** on Windows 2011.
That said, it's not hard. You simply handle the WM_NC* events like WM_NCPAINT or WM_NCHITTEST. NC stands for Non Client (window area). And of course, there is a trick on Vista/Win7 (you have to announce it to the DWM).
From an implementation aspect, you could employ WPF (Windows Presentation Foundation) assuming you code for .NET :) It has pretty bunch of skinnable controls, that may look like native and may not.
From a design aspect, if your interface isn't going to follow documented standards (like the Windows UI guidelines), it has to be intuitive. I think the new generation of Windows applications will go through a growing phase in a manner similar to the early days of the Web. After a time, some standards or common themes will evolve.
Can you give us some sample applications? Some apps that don't use native windows controls use cross-platform GUI libraries, like Qt for C++ or Tkinker. These maintain the same look across different platforms.
I wouldn't really recommend making your user interface different deliberately. You don't stand to gain much. Your controls are almost always going to be buggier than native controls, and you are requiring the user to learn something new. Now, if you're controls add a large enough value to be worth the users' time it can be okay. But making them get used to different looking buttons is rarely worth it.
I`m not sure if this answer your question.
You can use third party skinning controls like from Infragistics, or SkinSoft for example.
But like Bubba said I`d recommend going for WPF.
Model-View-Controller! It's as valuable here as in web apps or anywhere else. Be sure to keep the part of your program that generates the custom UI separate from the part of your program that flashes the BIOS.
I know this question is 10 years old but none of the answers mention using an option in visual studio, dont know if it existed at the time.
Theres an option to remove the border of the window in visual studio (called borderStyle). Thats the easiest way to do it, using C#. After removing the border, all you have to do is create a new interface. If you're looking to do it in C++, i think you need to use DWM. I will let an example i found here.
https://github.com/melak47/BorderlessWindow
Another example (maybe without DWM? didnt test):
https://social.msdn.microsoft.com/Forums/vstudio/en-US/b98c4c06-9581-44d3-8e5a-4adb2316e653/win32-about-styles-how-can-i-do-a-borderless-window?forum=vclanguage
There is a lot of people disencouraging to do it in this thread but there's no reason to not do it, if you know what you're doing your application can look great.

Native VB 6 Replacements for Sheridan 3d controls (like ssCommand, ssCheck, etc.)

I'm working on an VB6 app and I'd like to get rid of the old Sheridan controls and replace them with built in VB6 controls.
However, some of those controls have some nice properties, like the ForeGround on the ssCommand button. The standard VB6 command button doesn't have a foreground property.
I know that VB6 potentially has lots of other controls that I can enable but I'm not clear on which ones are fairly "standard" (i.e., not third party controls). I'd like to keep this app as plain vanilla as possible and not create dependencies. (Yes, I know that any components for VB6 have long sense become abandonware. I just anticipate a higher level of compatibility from a built in VB6 control since it was probably used more and thus "pounded on" more and it's flaws would be more known.
Any suggestions?
In my opinion threed32.ocx (the Sheridan SSControls) should be dropped because it has a number of problems. It's no longer supported, all the controls grab the focus when made visible including panels and frames (!), it's hard to upgrade to VB.NET - there are more. For my company these are strong enough to outweigh the extra functionality it gives - we're droppping it from all our programs.
Some of the discussion is too pessimistic IMHO. VB6 is not abandonware yet - we're not all doomed - though no doubt we will have to upgrade the code one day. Microsoft say:
The VB6 runtime is supported for the
full lifetime of Windows Vista,
Windows Server 2008 and Windows
7, which is five years of mainstream
support followed by five years of
extended support.
Microsoft are still supporting a number of their VB6 controls. Check the online list and only use the controls that they do support. These are the standard, tested, supported controls Clay is looking for in the original question. If you want to use third-party components, check whether they are still supported by the vendor. I would agree that you should always think hard about how much benefit you're getting before you introduce dependencies, which can be a support headache. If you use special components, try to wrap them in an abstraction layer. It might save some pain later if you need to replace them. You can hide all the fancy features except the ones you really need.
A final word - don't use the ForeColor property in the SSCommand. There's no corresponding BackColor property, so you have no guarantee that your special foreground colour will contrast with the system background "button face" colour. Just like Raymond says.
Sometimes a little ingenuity will go a long way. For instance, I wanted my VB6 command buttons to have custom background and foreground colors even though that violates the 'Windows standard look'; however, I wasn't ready to put out lots of bucks for that functionality since my projects are not commercial. So I tried a few things and finally settled on what, for me, is a very workable solution: I overlaid my buttons with label controls and now have multi-colored buttons that look absolutely authentic. I can control the button colors programatically to reflect various states of operation even going beyond a simple 'click / no-click' combination. One of my applications uses a group of five buttons which assume various colors depending on the combined button values.
I think keeping an app as 'plain vanilla' is a worthwhile goal. Certainly simplifies deployment.
I'd say the best way to find standard components for VB6 is to install VB6 (plus service packs) on a clean machine. All available components will be standard.
If you're unable to do this, for each checked Component or Reference in your project, research the file (dll, ocx, etc) referenced.
In this scenario, you're in for an uphill battle. Trying to eliminate dependencies on long-dead components is probably a good idea, but in a case like this, you're already on an abandoned technology. It's clear to me that rebuilding the app in more modern technology (EG, .NET) is not viable, so that leaves you with a limited set of options.
Replace the Sheridan controls with the existing VB6 controls which are a closest match, then update the code accordingly. This will be an intricate, difficult process, and you are correct in assuming that in many cases there won't be a match -- Sheridan (now Infragistics) built their business by providing UI capabilities which weren't in-box on VB6. In many cases, your UI will have to be seriously adapted to support this.
Consider writing "good enough" versions of the controls in VB6 yourself, or even .NET (the latter using advice from this StackOverflow question).
Consider replacing those controls with (likely long-since abandoned) open source VB6 controls. Google will be your friend here. The reason I recommend this route is that many UI elements have been represented in ActiveX over the years, as open source -- and if they're open source, you can at least "support yourself" on them.
I know you're going for a plain-vanilla out-of-box VB6 deployment, but for some UI elements, that may not be feasible. If you can rebuild your UI to #1 specs, then go for it, but you may have so much work cut out for you there that it might be time to consider going for the gusto and rebuilding on a modern, supported platform.
I've been through this, and you'll be long at it, and IMHO not very happy with the results.
VB6 can't be a long term solution anyway. Why not leave them in there? Yes they're abandoned, but I used them and never needed support anyway. (Plus it went to hell after the first time they were bought.) My experience was that they are pretty darn reliable. I'd just go with it, and if you have spot problems, provide spot workarounds.
I have to disagree with your reasoning. One might expect better support from someone whose living depends on you being a happy customer.
It's also likely to be the case that any vendor depending on VB6 sales is likely so go broke soon.
Why bother? If your product works then don't worry about it. I have found the Sheridan controls to be quite solid. If you're not experiencing any issues with them then leave them alone.

DevExpress Refactor Pro vs JetBrains ReSharper

In my department, we are currently using ReSharper 4.0 and deciding whether to upgrade to 4.5 upon its release next week. I personally am a huge fan of ReSharper however a number of my colleagues have pointed out that they have been using a plug in from DevExpress called Refactor Pro that performs similar functionality.
http://www.devexpress.com/Refactor
http://www.jetbrains.com/resharper/beta.html
Has anyone previously compared these tools and hold any strong views on which tool would give us the greatest increase in productivity and why?
In my department, we also use ReSharper. Today, I installed 4.5, but had already used 3.something, 4.0 and 4.1 before. It really offers many great refactoring and code-writing supporting functions, renaming methods and functions, reordering parameters...
What I really like is that according to your corporate code style, you can configure ReSharper to give you hints on style violations in different severity levels (and quickly apply according changes, like MS StyleCop, but much easier to configure and more subtle).
My absolute favorite feature is Class-Searching by entering only the CamelCases, i.e. you type TSHWLOV and ReSharper will know that you mean the class from some referenced library named 'TerrificSearchHelperWithLotsOfVoodoo'.
Last year I have tried the DevExPress CodeRush/RefactorThis-Alternative, after I was quite impressed by the things that Oliver Sturm did with it on BASTA Spring 08.
The interface catchier and more impressive than Resharper, there are huge arrows flipping around your IDE and things like that, though the core functionality is rather similar.
I had the feeling that CodeRush is more focussed on code creation than on refactoring, i.e. more shortcuts for tasks like creating variables etc.
My favorite feature there was a sidebar, which always shows you all keyboard-shortcuts available in your current context. This makes you learn those commands quickly, where in ReSharper you have to look up most of them in nested submenus.
Both suites are really powerful and it after months of using them you will probably still discover new functions, which you have always needed without knowing it.
However, I decided in favor of ReSharper mostly because of I was more familiar with it and DevExpress was using much resources on my notebook and occasionally even slowed it down. By now, I use a much more powerful machine again, maybe I will give it another try soon.
I personally prefer CodeRush.
I find R#'s interface drives my (admittedly minor) OCD tendencies crazy. The little lightbulb insists on appearing on the far left of the screen, even if it's advice pertains to something in the middle or on the right. I find it garish and distracting.
By contrast, CodeRush's equivalent smart tag is lower contrast and smaller. It is therefore capable of locating itself within the code without distracting from said code. I find I can ignore this SmartTag when I need to, and it is always right in front of me when I decided I need it.
It is mainly this, that has prevented me from wanting to explore R# any further.
As far as CodeRush's feature set: Code Analysis, Refactorings, CodeProviders, Templates, TabToNextReference, QuickNavigation and many more.
I especially like CodeRush's extensibility which has allowed myself and several others to create many plugins for use within it. (http://code.google.com/p/dxcorecommunityplugins/)
CodeRush also has some top quality support and a very active community of users.
Certainly neither R# or CodeRush will suit all users. Every one has their own preferences. However, if you've not tried both, you should certainly do so.
If you come from the R# side of the equation and are looking to test out CodeRush, then you may find the compatibility plugin useful (http://code.google.com/p/dxcorecommunityplugins/wiki/CR_ReSharperCompatibility)
In addition CodeRush has a Free edition 'CodeRush Xpress' which Microsoft commissioned DevExpress to create, and which they have licensed on behalf of every user of Visual Studio 2008. This partnership will continue into VS2010 upon it's release.
If you have any questions regarding CodeRush you can find details for contacting me at the bottom of my community wiki page.
I should say that I do not work for DevExpress. I am what you might call a DevExpress MVP. To maintain this position, I answer questions in the DevExpress forums (and nothing else).
Everything I say is my own honest opinion.
If you have any questions, feel free to contact me :)
I'm using DevExpress which has a lot of "hidden" functionality, so you need to read the manuals to know how to activate some of the functionality. I find it very passive and subtle.
I used ReSharper and found it buggy and very invasive in my coding style. Bracket-closing drove me nuts, it ignored my preferences and couldn't cope with how I write my lines of code - which may not be most efficient but it's one of those things that ain't gonna change!
I've tried both, and really didn't get along with ReSharper. I found it to be just too intrusive for my coding style. When I switched to CodeRush / Refactor! it was like I'd found the perfect aid to my productivity. The refactorings are, for the most part, exactly what I wanted to see from this kind of product.
It is, however, horses for courses and you may well find that you prefer ReSharper. The best advice I can give is to try the other products and see which you prefer.
The only correct answer is to use both, of course! I do. You need a beefy laptop though. If I had to choose only one, I'd choose ReSharper... I think the static code analysis is a lot better.
ReSharper has a lot of great features, and DevExpress has a lot of great features.
When you put the two together, you end up w/ whole lot of AWESOME.
You need to jump through a few hoops to make them play nicely together: http://frazzleddad.blogspot.com/2010/01/making-devexpress-resharper-play-nicely.html
R# 4.5 is a free upgrade if you have a 4.0 license. So I'd suggest to get and use it - changing the "productivity tool" is always a pain because you'll have to get used to different ways, keyboard shortcuts etc. of doing things - no matter how good the tool actually is.
I have a personal copy of Refactor Pro but I use R# 4.1 at work with the StyleCop add-in as that is the team standard tool. I like RfP's arrows and code positioning stuff which is better than R#. Otherwise the tools are very similar.
However, at this time, its the StyeCop add-in that swings it in favor of R# for me.
Cheers
Benjy

Resources