70002528 Set xref insert to be in gray

Article 70002528
Type HowTo
Product Engine
Version 11
Date Added 5/27/2024 12:00:00 AM
Fixed 11.1.5.0 (5/27/2024 12:00:00 AM)
Submitted by Gregory Wenger

Summary

Set xref insert to be in gray

Solution

It can be done by override the events OnDrawFigure and OnDrawAfterFigure as follow

doc.FreezeEntityDrawEvents.Push(false);
doc.OnDrawFigure += Doc_OnDrawFigure;
doc.OnDrawAfterFigure += Doc_OnDrawAfterFigure;
 private void Doc_OnDrawAfterFigure(object sender, vdRender render)
 {
     vdInsert ins = sender as vdInsert;
     if (ins == null || ins.Block == null || !ins.Block.IsXref) return;
     render.LockPenStyle = null;
 }
 private void Doc_OnDrawFigure(object sender, vdRender render, ref bool cancel)
 {
      vdInsert ins = sender as vdInsert;
      if (ins == null || ins.Block == null || !ins.Block.IsXref) return;
      render.LockPenStyle = new vdGdiPenStyle(Color.Gray, 128);
 }

Send comments on this topic.