public Form1() { InitializeComponent(); dha.nSize = System.Runtime.InteropServices.Marshal.SizeOf(dha); dha.nRoundRadius = 2; PDFXEdit.IUIX_Inst uiInst = (PDFXEdit.IUIX_Inst)pdfCtl.Inst.GetExtension("UIX"); brush = uiInst.CreateNewBrush(); pen = uiInst.CreateNewPen(); brush.Color0 = (uint)ColorTranslator.ToWin32(Color.Blue) | 0xFF000000; brush.Opacity = 0.3; brush.BlendType = PDFXEdit.UIX_BlendType.UIX_BlendType_Multiply; pen.Brush.Color0 = brush.Color0; pen.Brush.Opacity = 0.9; pen.Brush.BlendType = PDFXEdit.UIX_BlendType.UIX_BlendType_Multiply; PDFXEdit.IAUX_Inst auxInst = (PDFXEdit.IAUX_Inst)pdfCtl.Inst.GetExtension("AUX"); mh = auxInst.MathHelper; dhp = new DrawHighlightOnPagesCallback(); dhp.brush = brush; dhp.pen = pen; dhp.mh = mh; }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) { ///////////////////////////////////////////////////////////////////////////////////// // Forced release of all COM-objects that may still captured by Garbage Collector. // // It is critical to release them before destroying of pdfCtl! // ///////////////////////////////////////////////////////////////////////////////////// wordsRanges = null; docHighlighter = null; brush = null; pen = null; dhp.Stop(true); dhp = null; mh = null; GC.Collect(); GC.WaitForPendingFinalizers(); }