void ISymbolCollectionRelocationHandler.PrepareForRelocation(SymbolCollection aCollection, uint aOldBase, uint aNewBase) { // This is invoked when a map file is activated. Because we've probably not yet read the // source content, we will synchronously parse the map file now so that we have a full set // of symbols available to the client. if (aCollection.IsEmptyApartFromDefaultSymbol) { // This will read into the original map source and original map collection. iOriginalMapSource.Read(TSynchronicity.ESynchronous); // If the specified aCollection is a clone, i.e. not the original, then we may need // to copy symbols over. if (iOriginalMapSource.Count > 0) { SymbolCollection primaryMapCollection = iOriginalMapSource[0]; if (aCollection != primaryMapCollection) { aCollection.Clone(primaryMapCollection); } } } }
public void DrawPreview() { using (System.Drawing.Graphics gr = System.Drawing.Graphics.FromHwnd(panelPreview.Handle)) { Rectangle rect = new Rectangle(0, 0, panelPreview.Width, panelPreview.Height); using (SolidBrush brush = new SolidBrush(Color.White)) { gr.FillRectangle(brush, rect); } if (GraphicsEngine.Current.Engine != null) { using (var bitmap = GraphicsEngine.Current.Engine.CreateBitmap(rect.Width, rect.Height)) using (var canvas = bitmap.CreateCanvas()) { new SymbolPreview(null).Draw(canvas, rect.ToCanvasRectangle(), _symbol?.Clone(null) as ISymbol, false); gr.DrawImage(bitmap.ToGdiBitmap(), new Point(rect.X, rect.Y)); } } using (Pen pen = new Pen(Color.Gray, 0)) { pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; gr.DrawLine(pen, 0, rect.Height / 2, rect.Width, rect.Height / 2); gr.DrawLine(pen, rect.Width / 2, 0, rect.Width / 2, rect.Height); } } }