做符号预览的时候需要将ISymbol或IElement绘制到指定的控件上,下面边码边说,一起讨论讨论:
一、ISymbol:
ISymbol接口有Draw函数,查询其接口可以发现,我们需要执行ISymbol.SetupDC -> ISymbol.Draw -> ISymbol.ResetDC 这三个步骤;
首先SetupDC需要参数 hDC和IDisplayTransformation;贴代码:
例如:绘制在Panel上:
————————————————————————————————————————————————————————————————-
int width=Panel.Width;
IEnvelope pEnve=new EnvelopeClass();
pEnve.PutCoords(0,0,width,heigth);
tagRECT myRect=new tagRECT();
一、ISymbol:
ISymbol接口有Draw函数,查询其接口可以发现,我们需要执行ISymbol.SetupDC -> ISymbol.Draw -> ISymbol.ResetDC 这三个步骤;
首先SetupDC需要参数 hDC和IDisplayTransformation;贴代码:
例如:绘制在Panel上:
————————————————————————————————————————————————————————————————-
int width=Panel.Width;
int heigth=Panel.Heigth;
//绘制方法
Graphics graph=Graphics.FromHwnd(Panel.Handle);graph.Clear(Panel.BackColor);
//分辨率
double dpi=graph.DpiX;IEnvelope pEnve=new EnvelopeClass();
pEnve.PutCoords(0,0,width,heigth);
Ipoint pCenterPt=new PointClass;
pCenter.PutCoords(width/2,height/2);
tagRECT myRect=new tagRECT();