image.canvas.moveto()和image.canvas.lineto()只能带integer类型的参数,这样画的想垂直平分线等就非常的不精确,大家怎么处理这类问题呀?
我看help中有个单独的moveto函数可以带double型的参数,但是它属于TBaseReport的,是不是使用就需要重载呀?谢谢你的关注。(说明:HiProgramer (guest) 是昨天我注册的一个账号,好久没有使用delphi了,怕丢脸,现在看来这个问题可能比较复杂,解决了所有的分全给,不够可以再加)
我看help中有个单独的moveto函数可以带double型的参数,但是它属于TBaseReport的,是不是使用就需要重载呀?谢谢你的关注。(说明:HiProgramer (guest) 是昨天我注册的一个账号,好久没有使用delphi了,怕丢脸,现在看来这个问题可能比较复杂,解决了所有的分全给,不够可以再加)
解决方案 »
- FlowPanel内控件的ControlIndex属性
- cxgrid使用ExportGrid4ToEXCEL导出成excel格式时,如何只导出“部分”列?
- 请问这样的界面怎么实现的?(金蝶KIS)
- 运行时出错,不知那里出问题了?
- delphi5 ADO错误
- 我想用delphi, 你认为最好最快入门到精通的方法是什么?
- 请问高手
- delphi怎么通过注册表键值方式连接数据库
- createoleobject('excel.application')报错, eolesyserror 不支持此接口
- 请问如何实现针对宽带网的计费
- 请问如何修改TWEBBROWSER里网页的背景图片(需要从流或其他控件的图片导入)?
- 显示桌面怎么找回来?
在屏幕上只能在画点最终都是影射成的整数吧
你说的单独的moveto 好象是报表里面的哦
MM_ANISOTROPIC arbitrary(x<>y)or(x=y) 可定义/可定义
MM_HIENGLISH 0.001 inch 右/上
MM_HIMETRIC 0.01 mm 右/上
MM_ISOTROPIC arbitrary(x=y) 可定义/可定义
MM_LOENGLISH 0.01 inch 右/上
MM_LOMETRIC 0.1 mm 右/上
MM_TEXT 1 pixel 右/下
MM_TWIPS 1/440 inch 右/上
SetMapMode( ) 为给定设备环境设置映射模式。
GetMapMode( ) 获取给定设备环境的映射模式。
SetWindowOrgEx( ) 设置给定设备环境的窗口原点( 0 , 0 )。
SetViewportOrgEx( ) 设置给定设备环境的视区原点( 0 , 0 )。
SetWindowExtEx( ) 设置给定设备环境窗口的X,Y值的范围。这些值与视区X,Y值范围结合执
行逻辑单位到设备单位的转换。
SetViewPortExtEx( ) 设置给定设备环境视区的X,Y值的范围。这些值与窗口X,Y值范围结合执
行逻辑单位到设备单位的转换。
rgbwoo(元宵):我察看了一下msdn,上面有个setmapmode是否是你说的那个函数?我不知道怎么使用改变,能否详细说说?谢谢了。
SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, Dialogs, Menus, DB, DBCGrids, DBTables;type
TMainForm = class(TForm)
mmMain: TMainMenu;
mmiMappingMode: TMenuItem;
mmiMM_ISOTROPIC: TMenuItem;
mmiMM_ANSITROPIC: TMenuItem;
mmiMM_LOENGLISH: TMenuItem;
mmiMM_HIINGLISH: TMenuItem;
mmiMM_LOMETRIC: TMenuItem;
mmiMM_HIMETRIC: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure mmiMM_ISOTROPICClick(Sender: TObject);
procedure mmiMM_ANSITROPICClick(Sender: TObject);
procedure mmiMM_LOENGLISHClick(Sender: TObject);
procedure mmiMM_HIINGLISHClick(Sender: TObject);
procedure mmiMM_LOMETRICClick(Sender: TObject);
procedure mmiMM_HIMETRICClick(Sender: TObject);
public
MappingMode: Integer;
procedure ClearCanvas;
procedure DrawMapMode(Sender: TObject);
end;var
MainForm: TMainForm;implementation{$R *.DFM}procedure TMainForm.ClearCanvas;
begin
with Canvas do
begin
Brush.Style := bsSolid;
Brush.Color := clWhite;
FillRect(ClipRect);
end;
end;procedure TMainForm.DrawMapMode(Sender: TObject);
var
PrevMapMode: Integer;
begin
ClearCanvas;
Canvas.TextOut(0, 0, (Sender as TMenuItem).Caption); // Set mapping mode to MM_LOENGLISH and save the previous mapping mode
PrevMapMode := SetMapMode(Canvas.Handle, MappingMode);
try
// Set the viewport org to left, bottom
SetViewPortOrgEx(Canvas.Handle, 0, ClientHeight, nil);
{ Draw some shapes to illustrate drawing shapes with different
mapping modes specified by MappingMode }
Canvas.Rectangle(0, 0, 200, 200);
Canvas.Rectangle(200, 200, 400, 400);
Canvas.Ellipse(200, 200, 400, 400);
Canvas.MoveTo(0, 0);
Canvas.LineTo(400, 400);
Canvas.MoveTo(0, 200);
Canvas.LineTo(200, 0);
finally
// Restore previous mapping mode
SetMapMode(Canvas.Handle, PrevMapMode);
end;
end;procedure TMainForm.FormCreate(Sender: TObject);
begin
MappingMode := MM_TEXT;
end;procedure TMainForm.mmiMM_ISOTROPICClick(Sender: TObject);
var
PrevMapMode: Integer;
begin
ClearCanvas;
// Set mapping mode to MM_ISOTROPIC and save the previous mapping mode
PrevMapMode := SetMapMode(Canvas.Handle, MM_ISOTROPIC);
try
// Set the window extent to 500 x 500
SetWindowExtEx(Canvas.Handle, 500, 500, nil);
// Set the Viewport extent to the Window's client area
SetViewportExtEx(Canvas.Handle, ClientWidth, ClientHeight, nil);
// Set the ViewPortOrg to the center of the client area
SetViewportOrgEx(Canvas.Handle, ClientWidth div 2, ClientHeight div 2, nil);
// Draw a rectangle based on current settings
Canvas.Rectangle(0, 0, 250, 250);
{ Set the viewport extent to a different value, and
draw another rectangle. continue to do this three
more times so that a rectangle is draw to represent
the plane in a four-quadrant square }
SetViewportExtEx(Canvas.Handle, ClientWidth, -ClientHeight, nil);
Canvas.Rectangle(0, 0, 250, 250); SetViewportExtEx(Canvas.Handle, -ClientWidth, -ClientHeight, nil);
Canvas.Rectangle(0, 0, 250, 250); SetViewportExtEx(Canvas.Handle, -ClientWidth, ClientHeight, nil);
Canvas.Rectangle(0, 0, 250, 250);
// Draw an ellipse in the center of the client area
Canvas.Ellipse(-50, -50, 50, 50);
finally
// Restore the previous mapping mode
SetMapMode(Canvas.Handle, PrevMapMode);
end;
end;procedure TMainForm.mmiMM_ANSITROPICClick(Sender: TObject);
var
PrevMapMode: Integer;
begin
ClearCanvas;
// Set the mapping mode to MM_ANISOTROPIC and save the previous mapping mode
PrevMapMode := SetMapMode(Canvas.Handle, MM_ANISOTROPIC);
try
// Set the window extent to 500 x 500
SetWindowExtEx(Canvas.Handle, 500, 500, nil);
// Set the Viewport extent to that of the Window's client area
SetViewportExtEx(Canvas.Handle, ClientWidth, ClientHeight, nil);
// Set the ViewPortOrg to the center of the client area
SetViewportOrgEx(Canvas.Handle, ClientWidth div 2, ClientHeight div 2, nil);
// Draw a rectangle based on current settings
Canvas.Rectangle(0, 0, 250, 250);
{ Set the viewport extent to a different value, and
draw another rectangle. continue to do this three
more times so that a rectangle is draw to represent
the plane in a four-quadrant square }
SetViewportExtEx(Canvas.Handle, ClientWidth, -ClientHeight, nil);
Canvas.Rectangle(0, 0, 250, 250); SetViewportExtEx(Canvas.Handle, -ClientWidth, -ClientHeight, nil);
Canvas.Rectangle(0, 0, 250, 250); SetViewportExtEx(Canvas.Handle, -ClientWidth, ClientHeight, nil);
Canvas.Rectangle(0, 0, 250, 250);
// Draw an ellipse in the center of the client area
Canvas.Ellipse(-50, -50, 50, 50);
finally
//Restore the previous mapping mode
SetMapMode(Canvas.Handle, PrevMapMode);
end;
end;procedure TMainForm.mmiMM_LOENGLISHClick(Sender: TObject);
begin
MappingMode := MM_LOENGLISH;
DrawMapMode(Sender);
end;procedure TMainForm.mmiMM_HIINGLISHClick(Sender: TObject);
begin
MappingMode := MM_HIENGLISH;
DrawMapMode(Sender);
end;procedure TMainForm.mmiMM_LOMETRICClick(Sender: TObject);
begin
MappingMode := MM_LOMETRIC;
DrawMapMode(Sender);
end;procedure TMainForm.mmiMM_HIMETRICClick(Sender: TObject);
begin
MappingMode := MM_HIMETRIC;
DrawMapMode(Sender);
end;end.
要是没解决再开贴。
麻烦你到http://expert.csdn.net/Expert/topic/2630/2630682.xml?temp=.8672296接100分。