2

in my PPT Add in i want to display a WPF pop up window and it should be centered according to PPT window.

here's my code:

// get the postion and size of ppt window
float winLeft = Globals.ThisAddIn.Application.Left;
float winTop = Globals.ThisAddIn.Application.Top;
float winWidth = Globals.ThisAddIn.Application.Width;
float winHeight = Globals.ThisAddIn.Application.Height;

// set the position of WPF window            
this.Left = winLeft + (winWidth - this.Width) / 2;
this.Top = winTop + (winHeight - this.Height) / 2;

i can obtain the current PPT window using Globals.ThisAddIn.Application and somehow Left , Top, Width, and Height are different to the actual size on the screen (in my PC, the values are smaller)

i am wondering if there's a conversion of window size to actual size on screen

Kara
  • 6,115
  • 16
  • 50
  • 57
azer89
  • 1,529
  • 1
  • 15
  • 29
  • 1
    A units-conversion issue possibly? PPT is giving you the height and width in points, 72 points to the inch, rather than pixels. Divide the value it gives you by 72 then multiply by the DPI your display is set to (usually 96). See if that gets you closer. – Steve Rindsberg Dec 31 '12 at 19:24
  • Related to this, see http://stackoverflow.com/questions/5977445/how-to-get-windows-display-settings for answers on how you can calculate system dpi (more than one answer there will likely be needed). – Mark Miller May 16 '16 at 20:07

0 Answers0