This is related to the question I asked earlier about the syntax for this method under Python and comtypes. Now that I know the syntax and am trying to use it, the returned out params are equal to 0. Why is this? Here is my code:
#make TextElement
pTextElement = NewObj(esriCarto.TextElement, esriCarto.ITextElement)
pTextFont = NewObj(stdole.StdFont, stdole.IFontDisp)
pTextFont.Name = 'Arial'
pTextFont.Size = 34.0
pTextSymbol = NewObj(esriDisplay.TextSymbol, esriDisplay.IFormattedTextSymbol)
pTextSymbol.Font = pTextFont
pTextSymbol.HorizontalAlignment = esriDisplay.esriTHACenter
pTextSymbol.VerticalAlignment = esriDisplay.esriTVACenter
txt = 'T>' #((( hard coded for testing )))
pScrDisp = mxDoc.ActiveView.ScreenDisplay
pDisplay = CType(pScrDisp, esriDisplay.IDisplay)
#Get dimensions of text string
pDisplay.StartDrawing(0, -1)
dblX, dblY = pTextSymbol.GetTextSize(pDisplay.hDC, pDisplay.DisplayTransformation, txt)
pDisplay.FinishDrawing
The out parameters dblX and dblY both equal 0. The hDC and DisplayTransformation inputs are valid. I checked. So, there is something I'm missing. Any insights?