I highlight some features with a semi transparent color via an ILayerExtensionDraw. When I print the ActiveView of the PageLayoutControl with IPrintAndExport the highlightning is not on the printout.
In the print method I get the printers HDc and save it to a static variable which the LayerExtension reads from.
System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
System.Windows.Forms.DialogResult res = printDialog.ShowDialog();
if (res == System.Windows.Forms.DialogResult.Cancel)
return false;
// ... assigning printer settings here...
System.Drawing.Graphics graphics = printDialog.PrinterSettings.CreateMeasurementGraphics();
MyLayerExtension.CurrentPrinterHdc = graphics.GetHdc();
PrintAndExport.Print(docActiveView, docPrinter, _pageLayoutControl.PageLayout.Page, 1, iResampleRatio, null);
graphics.ReleaseHdc();
MyLayerExtension.CurrentPrinterHdc = IntPtr.Zero;
The LayerExtension reads the IntPtr and uses it to draw the highlightning to the printer, but it is not shown on the print out.
SimpleFillSymbol fillSymbol = new SimpleFillSymbol();
fillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;
fillSymbol.Outline = new ESRI.ArcGIS.Display.SimpleLineSymbol();
fillSymbol.Color = Utilities.CreateColor(System.Drawing.Color.Khaki);
pDisplay.Filter = new TransparencyDisplayFilterClass { Transparency = 127 };
pDisplay.SetSymbol((ISymbol)fillSymbol);
pDisplay.StartDrawing(pDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache);
if (CurrentPrinterHdc != IntPtr.Zero)
pDisplay.StartDrawing(CurrentPrinterHdc.ToInt32(), (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache);
pDisplay.DrawPolygon(feature.Shape);
pDisplay.FinishDrawing();
The LayerExtension does get called on printing.
What did I miss?
Update As far as I understand the HDc now the drawing on the printers handle would only work, if I use the HDc to print later on again, which is not a real option.
Is there any other way to get the transparent (!) highlightning printed?