Is there a PowerPoint equivalent of Word's ToggleRibbon? Or another way to accomplish the same thing? - vsto

[In Office 2007+, you can cause the ribbon to be minimized so that only the tab names are shown, which makes it look a bit like a menu bar. The full ribbon is then only shown when you click on a tab. This ribbon state is what I'm trying to control.]
In the Word 2007+ object model, there's a ToggleRibbon method on the Window object, that minimizes (or not) the ribbon for that window.
I'm looking for an equivalent method in PowerPoint 2007+, and I can't find one. Is there such a thing, and if not is there another way to achieve it? Apart from using SendKeys, that is - don't go there.

i have implemented in c# with word addins .
you can take help from below link:
http://msdn.microsoft.com/en-us/library/bb608590.aspx
I have added a button in the ribbon(visual).
in the button click, i have added following code.
private void button1_Click(object sender, RibbonControlEventArgs e)
{
Globals.ThisAddIn.Toogle();
}
i have added these code in the ThisAddIn.cs:
public void Toogle()
{
Word.Window obj = Application.ActiveWindow;
obj.ToggleRibbon();
}
sorry, Window.ToggleRibbon() is present only in word. even it is not present in excel or work. so achieve this, do the following code :
private void button1_Click(object sender, RibbonControlEventArgs e)
{
SendKeys.SendWait("^{F1}");
}
Hope , this will work for you.

Related

Updating a textbox in main GUI from a thread (created on button click) in cli

I am very new with C++/CLI, which is based on c#. I have a main GUI form.
public ref class MyForm : public System::Windows::Forms::Form
On clicking a button in the from I am creating a thread using CreateThread. Code as following:
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e)
{
HANDLE h1;
h1 = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread1,0, 0, &threadID1);
}
Now my problem is I need to update a TextBox in Myform from the thread. Can anybody please tell me how to do it in cli?
It is safe to use .NET Thread^ in this scenario. Inside your thread1 method use Control::BeginInvoke or Control::Invoke like #AlexF mentioned. Here you have an example from C#.

Helix Toolkit How to use MouseWheelEventHandler to run specific methods in other classes

I would like to run particular methods of a custom Camera class whenever the user zooms in or out in the helix toolkit view that my program is running inside of.
A key feature of this functionality is getting the mouseargs from the event so I can adjust the camera in a way that is proportional to the number of scroll ticks.
I began to try this:
public event PropertyChangedEventHandler PropertyChanged;
public virtual void onMouseWheeled(MouseDevice Mouse, int time,
MouseWheelEventArgs e) {
MouseWheel?.Invoke(this, new MouseWheelEventArgs(Mouse, time,
e.Delta)); }
//This next line goes in a MainWindow_Loaded method that gets called in the
//MainWindowConstructor
void MainWindow_Loaded(object sender, RoutedEventArgs e) {
view1.MouseWheel += new MouseWheelEventHandler(onMouseWheeled(Cursor,
Time.simTime, view1.MouseWheeledEventArgs)); }
but was having a lot of trouble figuring out how to pass a MouseWheelEventArgs object into the onMouseWheeled method when I'm trying to add the onMouseWheeled method to the MouseWheelEventHandler. Assuming nothing is fundamentally wrong with that sentence, which is nothing more than wishful thinking, The last thing I am trying to figure out is how to get mouse wheel event args so that I can pass it into a method.
Then I tried this:
public event MouseWheelEventHandler MouseWheel;
public virtual void onMouseWheeled(object sender, MouseWheelEventArgs e)
{
Console.WriteLine(e.Delta);
}
//In Main Window Loaded method...
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
view1.MouseWheel += onMouseWheeled;
}
But I get no output when i scroll the wheel. I assumed this might actually work because view1 is the helix window I'm attaching all of my objects to, as children of view1.
Basically my main questions are:
What does invoke actually do? I only have this running to try to see if its working because onPropertyChanged methods I always use run the Invoke command like so. I'm actually not sure where I'm going with this.
How does the handler work?
How do the event args get called out so that I can use them and pass them as objects to other methods?
Thank you for your time. And Thank you twice for any and all pointers and advice you may give me.
Try to use preview mouse wheel event

Outlook VSTO Addin - NormalEmail.dotm not saved

I'm trying to register a handler for the WindowSelectionChanged event. It works, but when quitting Outlook, it will discard any changes to NormalEmail.dotm file.
For example, any changes to the Quick Part Gallery (Insert->Text->QuickParts) will only be visible during the current session; closing Outlook and starting it again will show the previous list of elements, even if they were deleted, or new ones were added).
Deleting the file :
C:\Users[USER]\AppData\Roaming\Microsoft\Templates\ NormalEmail.dotm
should prompt Outlook to create a new one, but this won't happen when the Addin is enabled.
This can be reproduced by registering even an empty method to the WindowSelectionChange event:
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.Inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(RegisterChangeHandler);
}
void RegisterChangeHandler(Outlook.Inspector inspector)
{
Microsoft.Office.Interop.Word.Application app = Application.ActiveExplorer().ActiveInlineResponseWordEditor?.Application;
--> app.WindowSelectionChange += WinSelectionChange; <-- this line causes the bug
}
private void WinSelectionChange(Selection Sel)
{
/* nothing */
}
...
}
This causes no exceptions; the result is the same when putting try/catch blocks in place, or when the callback is unregistered in the Application.Quit event.
Question: How can Outlook be made to commit the NormalEmail.dotm file, while also being able to register a callback for WindowSelectionChange event ?
(the project type is "2013 and 2016 VSTO Addin")

C++ will change it last input

I don't know if anyone had the same problem.
I use Microsoft visual C++ 2010 I am new to it but I know a lot of Java program but for me trying to go from one program to another is confusing.
Anyway I will make a basic program "Hello World" and run it it works fine but when I go and try to type something else or add something to the text it remains the same code when I run it. It does not happen all the time but it will do it a lot and it seam like it is becoming more common.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
label1 -> Text = "hello world";
}
This is what I put.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
label1 -> Text = "This is a test";
}
when I run the first code it works, but when I change to the code and put in the 2nd code it will remain the first code when I run it, but I change what the code say so it should change as well but it does not.
There is a setting that controls whether Visual Studio forces a build before you run, likely you set it to false.
Here is a similar question
Tools + Options, Projects and Solutions, Build and Run. "On Run, when projects are out of date" = Always build.

Replicate Hardware Back Button Functionality from UI in Windows Phone

I'm trying to write a windows phone application and am wondering if it's possible to have a software button in the UI that does the same thing as the hardware back button (just sends a system back command). I can't seem to find any information on how to do this online.
try this:
XAML:
<Button x:Name="btnBack" Content="Back" Click="btnBack_Click"></Button>
CS:
private void btnBack_Click(object sender, RoutedEventArgs e)
{
if (NavigationService.CanGoBack)
NavigationService.GoBack();
else
App.Current.Terminate();
}
This would work as same Back button. if any back-state is there it would go to that state or if not it would close (Terminate) the Application.
you can override the back button function
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
//Do your work here
base.OnBackKeyPress(e);
}