如何在Delphi中使用Microdraw图形控件的OLEVariant类型数据
示例如下:
procedure TForm1.Button1Click(Sender: TObject);
var
objid : oleVariant;
i,dim,lb,hb,count :integer;
pt_x,pt_y :array of double;
begin
self.Memo1.Clear;
setlength(pt_x,1);
setlength(pt_y,1);
objid := self.MicroDrawOcx1.GetObjectIDArrayByType(1);//得到文件中直线的类型
//得到当前直线的全部id
dim := VarArrayDimCount(objid);//得到数组的维数
lb:=VarArrayLowBound(objid,dim);//得到数组的下限
hb := VarArrayHighBound(objid,dim);//得到数组的上线
count := hb-lb+1;//得到数组的长度
for i := 0 to (count- 1) do
begin
self.MicroDrawOcx1.GetPointEx(objid[i],-1,pt_x[0],pt_y[0]);//得到直线的起点
self.Memo1.Text:= self.memo1.text+'第'+inttostr(i+1)+'条直线的起点为:'+floattostr(pt_x[0])+':'+floattostr(pt_y[0])+';'#13#10;
self.MicroDrawOcx1.GetPointEx(objid[i],-2,pt_x[0],pt_y[0]);//得到直线的终点
self.Memo1.Text:=self.Memo1.Text+'第'+inttostr(i+1)+'条直线的终点为:'+floattostr(pt_x[0])+':'+floattostr(pt_y[0])+';'#13#10;
self.MicroDrawOcx1.SetObjectColor(objid[i],Microdrawocxlib_tlb.COLOR_RED);
self.MicroDrawOcx1.RedrawAll;
end;
end;
如何在Delphi中使用Microdraw图形控件的OLEVariant类型数据
最新推荐文章于 2020-08-10 17:53:35 发布
本文详细介绍了如何在Delphi中利用Microdraw图形控件的OLEVariant类型数据,通过示例代码展示了如何获取文件中直线的类型,并遍历这些类型来获取直线的起点和终点坐标,同时设置了颜色并刷新视图。
901

被折叠的 条评论
为什么被折叠?



