| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
学习型 ASP/PHP/ASP.NET 主机 35元/年全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
赛孚耐:软件保护加密专家身份认证令牌USB KEY  
共有 262 人关注过本帖
标题:使用microdraw图形创建地形表面轮廓图
收藏  订阅  推荐  打印 
华太龙
Rank: 1
等级:新手上路
帖子:2
积分:120
注册:2006-4-20
使用microdraw图形创建地形表面轮廓图

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, MICRODRAWOCXLib_TLB, ExtCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
MicroDrawOcx1: TMicroDrawOcx;
Button1: TButton;
Button2: TButton;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
self.Button1.Caption:='偏'#13+'移'#13+'封'#13+'闭'#13+'区'#13+'域'; //显示竖排文字
setwindowlong(self.Button1.Handle,gwl_style,getwindowlong(self.Button1.Handle,gwl_style)or bs_multiline);
self.Button2.Caption:='关'#13+'闭'#13+'程'#13+'序';
setwindowlong(self.Button2.Handle,gwl_style,getwindowlong(self.Button2.Handle,gwl_style)or bs_multiline);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
obj_count : integer;
i : integer;
obj_id : integer;
obj_type : integer;
pt : array <0..1> of double;
radius : double;
area : double;
begin
obj_count:= self.MicroDrawOcx1.GetSelectCount;
for i := 1 to obj_count do
begin
obj_id := self.MicroDrawOcx1.GetObject(i);
obj_type := self.MicroDrawOcx1.GetObjectType(obj_id);
if obj_type = MICRODRAWOCXLib_TLB.AS_TYPE_CIRCLE then
begin
self.MicroDrawOcx1.CreateHatchOffset(obj_id,10,10,0);//偏移封闭区域,最后一个参数缺省为0
self.MicroDrawOcx1.GetPoint(obj_id,MICRODRAWOCXLib_TLB.POS_CENTER,pt<0>);//得到圆心
radius := self.MicroDrawOcx1.GetReal(obj_id,MICRODRAWOCXLib_TLB.REAL_RADIUS);//得到半径
area := self.MicroDrawOcx1.GetReal(obj_id,MICRODRAWOCXLib_TLB.REAL_AREA);//得到面积
//显示属性
self.ListBox1.Items.Text := '偏移的元素为: 圆'#13#10+'偏移的距离为:10'#13#10;
self.ListBox1.Items.Text := self.ListBox1.Items.Text+'偏移的数量为 : 10'#13#10+'最大圆的面积为:'+floattostr(area);
self.ListBox1.Items.Text := self.ListBox1.Items.Text+'最大圆的半径 :'+floattostr(radius);
self.ListBox1.Items.Text := self.ListBox1.Items.Text+'圆心坐标为 :'+format('%.2f,%.2f',,pt<1>]);
self.MicroDrawOcx1.ZoomAll;
self.MicroDrawOcx1.RedrawAll;
end

end;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate; //退出程序
end;

end.


附件: 只有本站会员才能下载或查看附件,请您 登录注册
搜索更多相关主题的帖子: 轮廓  图形  microdraw  地形  
2006-4-20 20:47
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.058277 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved