Thierry Nenin

Hello,

Anyone of you have an idee on how to retrieve the BackColor a CustomTaskPane should have

In other words, in a Docmuent solution for excel 2003, before or after adding a user control to the ActionsPane, i just had to do

_myUserControl.BackColor = ActionsPane.BackColor in order to match current excel color scheme...

How can i do this with a CustomTaskPane created in an excel 2007 add-in

I have already spend hours trying to resolve this...

Any help will be appreciated...

TIA




Re: Visual Studio Tools for Office CustomTaskPane BackColor

Cindy Meister

Hi Thierry

The selected color scheme for Office 2007 is stored as a Registry entry:

You want to look at the registry value HKCU\Software\Microsoft\Office\12.0\Common\Theme, which can have one of these values for Office 12:

1 (default): blue

2: silver

3: black






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Thierry Nenin

Hi Cindy,

Tank for your answer, this will help...

But I am pretty sure you will agree that this is not so "generic".

I Wonder if we could get an interface to those themes giving us real info about the color used by the current theme without querying the regisry and make assumption of the color used for elements of the office UI.

In other words, i can pump on the screen colors with the different theme and hard code them or even save them in a setting file or so on... This is not a problem.

The problem come if new theme become available...

But waiting for a better solution i will use your proposal and mark this as an answer.

Again, thanks a lot.






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Dennis Wallentin

Thierry,


But I am pretty sure you will agree that this is not so "generic".

I fully agree and I find the "Theme" thing to be too much of "whistle & bells" that don't bring any value. Hopefully none of Your end users are semi colour blind (like me)...


The problem come if new theme become available...


Well, it depends how we solve things. With a configuration file for the solution we can easily add new themes when they comes around (version 14).






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Thierry Nenin

Hi Dennis,

I thank you for supporting my opinion about the generic fashion of such a solution...

You'd did ever support my frustration in the past about lack of documentation about really deploying a solution with VSTO 2005 SE. Maybe such simple complaints did the things moving because now, MFT have updated this technical article the good way...

I'd also said saving such color info in a setting or config file was not realy a problem. Even if I had to support maintenance, distribution and all the rest about such a solution.

The real problem att all is that with CustomTaskPanes, Microsoft did really remove control on usable and valuable properties of the old ActionsPane. Give us more or on another way is acceptable but removing functionalities is quite not...

But nobodies perfect beginning with myself.

Kind Regards Dennis.






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Cindy Meister

Hi Thierry

A custom task pane is not the same things as an ActionsPane. The ActionsPane bases on the SmartDocument technology, while the custom task pane is a new thing in Office 2007.

Any actions panes you have in Office 2003 document customizations should continue to work in Office 2007. And I'd imagine (but I don't know) that ActionsPanes will still be supported in the Office 2007 document customizations for Orcas.






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Thierry Nenin

Hi Cindy,

Indeed, on the technical background, ActionsPane and CustomTaskPane are not the same. But this is just a point of view that suite what software developpers have to do in order to get a solution work...

Now, consider the offer of microsoft and the very pretty handy material they give to their partners ...

Right from MSDN technical articles:

Migrating a Document-Level Customization to an Application-Level Add-In

If you read this article again and again, the goal of using CustomTaskPane is to provide our customer at least the same user experience as before and maybe more; not less...

That idea to port "Actions Pane" (Microsoft continue to use that keyword for CustomTaskPane in their articles) on the Application level is quite good because you are not tedied with a particular document in order to bring general services in any document a user could use. And I agree with this concept...

But what I know by experience are reactions of end users if I would just try to explain them that something is now impossible for some technical reasons... They wouldn't care about that...

Then, i did just point the fact that even if CustomTaskPane are not realy same objects then ActionsPane, they should offer the same kinds of services inside (technology) and outside (end user experience and services).

My personal conclusion is to say: before, The ActionsPane offered a property called BackGroundColor that solved the problem of looking your user controls like the application's color scheme and now, with CustomTaskPane (sensed to offer the same services then before and even more powerfull) we lost this functionality.

I dispite this... I will adapt my solution following your first answer to this post (I Marked that as an answer) but nobody on earth will convince me that this is not IMHO just a little lack in what Micorosoft offer now. Maybe they will think about me with Orcas but how many time will I have to wait for this goes RTM

Except those phylosophics points of view I have already spend many times to learn by myself that ActionsPanes and CustomTaskPanes are not the same things and that CustomTaskPanes is new in Office 2007... Also I confirm to you that any document level customization continue working with office 2007 but that sacrify some UI guideliness Microsoft have established in order to give the end user a consistant experience... Then I am currently working on a solution that separate some parts of the office UI like menu or "Actions Pane" to conform and take the best of both office 2003 and office 2007.

As just a little sample, all menu commands that you add to office 2003 are placed in an arbitrery way in office 2007 on the Add-In Tab. This mean that if I had added a popup menu to the data menu of excel 2003, it will now appear on the AddIn tab on the Ribbon UI. Ok, Ribbon UI and menu are not the same things. I Also agree that your old solution get work in both 2003 and 2007 but this does not satisfy me nor my end-users... They have enough "pain" to learn this new UI without having to be disturbed by the fact that menu we added aren't any more in the same "new logical place". They and I find this not very handy. And this frustation grows when they become to have skill with the new ribbon UI. I also experienced a little this transition. Now that I begin to know where the things are placed in this wonderfull ribbon, I get difficult to find my way in office 2003 menus.

What i want to have now is a well looked piece of ribbon UI added to the Data tab just as my end users had before... and this Piece of ribbon UI have to interact with my document level customization. This possible now... I have found a solution to resolve this problem and it works. But i just dispite that i can't find anymore the BackGroundColor just as a property elsewhere in another object or another interface as before...

Kind Regards Cindy and Thanks both for your help and your remarks...






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Misha Shneerson - MSFT

Thierry, due to the design diffs between CustomTaskPane and ActionsPane you do not get a lot of default sugar that we do provide with the ActionsPane. Things like back color or the controls stacking are not provided by default, It is not actually very hard to implement but I agree that it is nice when the functionality is already there.

Meantime, all I can help is just tell you what ActionsPane is actually doing when setting the background:

ActionsPane's constructor runs this code:

if (!SystemInformation.HighContrast)
{
this.BackColor = ProfessionalColors.ToolStripGradientBegin;
}
Microsoft.Win32.SystemEvents.UserPreferenceChanged += new Microsoft.Win32.UserPreferenceChangedEventHandler(UserPreferenceChanged);

The UserPreferenceChagned event is needed for the cases when theme is switched by the user. The event handler is implemented like this:

void UserPreferenceChanged(object sender, Microsoft.Win32.UserPreferenceChangedEventArgs e)
{
if (e.Category == Microsoft.Win32.UserPreferenceCategory.Color)
{
if (!SystemInformation.HighContrast)
{
this.BackColor = ProfessionalColors.ToolStripGradientBegin;
}
else
{
this.BackColor = System.Windows.Forms.Control.DefaultBackColor;
}

}
}






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Thierry Nenin

Misha,

Tanks a lot, this is a nice answer (Isn't it Dennis )

I think i've learned more in 20 seconds spend of reading your answer then in hours of personal research...

I would be pleased if you answer to this last question:

Is the 'Microsoft.Win32.UserPreferenceChangedEventHandler' also trigered in Office 2007 when user change Office theme with options dialog box

I hope the answer will be yes but I have just a litlle doubt ...

Again, Many thanks to you and Kind Regards






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Dennis Wallentin

Thierry,


Tanks a lot, this is a nice answer (Isn't it Dennis )


The main reason for me to 'hang around' at this forum is that Misha et al provide us with good knowledge about the VSTO platform. While frequent the forum I also take the opportunity to share some of my Excel & VSTO knowledge.






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Misha Shneerson - MSFT

Hi Thierry,

I am sorry i could not reply earlier. I finally found how to change Office theme - e.g. in Word - "Word Options" -> "Popular" ->"Color Scheme". From what I can see changes in this color scheme are not exposed through this event - this event only reflects system wide color scheme changes i.e. WM_THEMECHANGED notification.

What I have found though is that the numerical value of the current office theme is stored in registry under HKCU\Software\Microsoft\Office\12.0\Common\[Theme]. Seems like If the value is absent or is 0 - the theme is derived from the OS, 1, 2 and 3 correspond to Blue,Silver and Black office color schemes.






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Thierry Nenin

Hi Misha,

Again, tanks for your help...

In the meantime and as Cindy had already mentioned, I wrapped the colour settings of my own TaskPanes on this registry key because as I tought, the event you mentioned is not fired in office 2007 when the user change the theme (as you also mentioned)...

I also hook this event because my solutions have too work on both 2003 and 2007 and it works for 2003. Then, information you give me about how 2003 set background color of the ActionsPane is very usefull and valuable. I would also be glad to find a technical article that explain choice of system colors applied to various controls of office in order we can also fine tune the custom UI we can add to office.

But this solution does not satisfy me...

  • If the user changes the office theme, he has to close and reopen the document in order to see changes in my solutions (IMHO, not a very good user experience).
  • When new theme will becomes available, I will have to provide a new version of my color wrapper; how it is implemented does not matter, I will have to "update" anything.
  • Further, not only for "Task Panes", I figure that with the release of Orcas and the possibility of Document solutions developments for office 2007, we will have the orportunity to put users controls on documents. All those controls should apear "Office like" in order to comply to the user experience.

For those reason, VSTO team would be friendly to give us a generic interface to "office themes" with properties and events that let us hook user changes in order to adapt owned controls fashion's. When i say "generic", I mean this interface should work both for Office 2003 and 2007, because I guess many users on the world will continue to use 2003 for several years...

I realy think that this is not sugar but again, IMHO, a must have.

I have the vision of an Application level property that let us access such an interface...

This is only a guess, but I hope to be heard ...

Kind regards Misha






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Misha Shneerson - MSFT

It is very tempting to do what you suggest, but please understand that there might be technical limitations to doing this. We (VSTO team) can only use public APIs that are exposed by Office and if an API is not exposed - there is only so much that we can do. All I can tell you at this point that I will think about this and ask some people around me.

Said that I really like to thank you for this suggestion.






Re: Visual Studio Tools for Office CustomTaskPane BackColor

Thierry Nenin

Misha,

Many thanks considering my whishes.

Maybe should you push the Office team to provide VSTO team such an API.

It's realy nice to be heard and understood by poeple like you.

Regards






Re: Visual Studio Tools for Office CustomTaskPane BackColor

tomdeloford

Thierry, would you mind sharing your color wrapper code

Also I would just like to add my backing to Thierry's comments, this is a very frustrating oversight by the Office/VSTO team, while it is clear that Themes always present a problem the solution of checking the registry and not being able to listen to Theme changes is shocking. What possible technical reasons could there be for not exposing a Theme change event, I was hoping we had left this sort of thing with VSTO 2003

Tom Deloford