| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 680 人关注过本帖
标题:使用microdraw图形创建地形表面轮廓图
只看楼主 加入收藏
华太龙
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-4-20
收藏
 问题点数:0 回复次数:0 
使用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-04-20 20:47
快速回复:使用microdraw图形创建地形表面轮廓图
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013594 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved