Running PowerPoint in a Windows Form

A

Andrei Csibi

I'm running a PowerPoint slide show in a Windows Form using the code shown at
the end (it might be useful for others that have tried to do this). The
problem is that when I resize the Form, hence the panelView which is docked
on the form, the PowerPoint is not displayed properly, I mean I want to be
FULLY displayed in the panel (some parts are not displayed), respecting the
proportions of the panel. How can I achive this?

Code:
this.SuspendLayout();
PowerPoint.Application app = new PowerPoint.Application();
pres = app.Presentations.Open(file, MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);
pres.SlideShowSettings.ShowType =
PowerPoint.PpSlideShowType.ppShowTypeSpeaker;
PowerPoint.SlideShowWindow ssWindow =
pres.SlideShowSettings.Run();
ssWindow.Top = 0;
ssWindow.Left = 0;
ssWindow.Width = panelView.Width;
ssWindow.Height = panelView.Height;
// name.ppt is the name of the powerpoint file that should
be displayed
string pptTitle = @"PowerPoint Slide Show - [name.ppt]";
int screenClasshWnd = FindWindow(0, pptTitle);
SetParent(screenClasshWnd,
groupHomeworkPpPreview.Handle.ToInt32());
this.ResumeLayout();
 
A

Andrei Csibi

This control is very powerful but I still need to run the PowerPoint inside
the Windows Form without allowing the user to change the slide somehow. Can
you tell me how can I use this ActiveX control to achive this functionality?

Andrei Csibi.

Chirag said:
You might want to try to use the Office Document ActiveX at
http://support.microsoft.com/kb/311765.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html

Andrei Csibi said:
I'm running a PowerPoint slide show in a Windows Form using the code shown
at
the end (it might be useful for others that have tried to do this). The
problem is that when I resize the Form, hence the panelView which is
docked
on the form, the PowerPoint is not displayed properly, I mean I want to be
FULLY displayed in the panel (some parts are not displayed), respecting
the
proportions of the panel. How can I achive this?

Code:
this.SuspendLayout();
PowerPoint.Application app = new PowerPoint.Application();
pres = app.Presentations.Open(file, MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);
pres.SlideShowSettings.ShowType =
PowerPoint.PpSlideShowType.ppShowTypeSpeaker;
PowerPoint.SlideShowWindow ssWindow =
pres.SlideShowSettings.Run();
ssWindow.Top = 0;
ssWindow.Left = 0;
ssWindow.Width = panelView.Width;
ssWindow.Height = panelView.Height;
// name.ppt is the name of the powerpoint file that should
be displayed
string pptTitle = @"PowerPoint Slide Show - [name.ppt]";
int screenClasshWnd = FindWindow(0, pptTitle);
SetParent(screenClasshWnd,
groupHomeworkPpPreview.Handle.ToInt32());
this.ResumeLayout();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top