神啊,救救我吧,300分相送!Button控件!!!!!(300分)

  • 主题发起人 主题发起人 nixiufeng
  • 开始时间 开始时间
N

nixiufeng

Unregistered / Unconfirmed
GUEST, unregistred user!
控件需求
1。bitbutton:响应点击,贴图片;
运行期可调整属性:
caption,constraints,font,glyph,height,helpcontext,hint,layout,left,margin,name,showhint,taborder,tabstop,tag,top,width.
附加属性:

2.Image 运行期可调整属性:
name,height,hint,left,increamentaldisplay,picture,tag,top,width.

3.Shape-线状。运行期可调整属性:
name,height,hint,left,tag,top,width,pen...

4.Label 运行期可调整属性:
name,caption,font,height,hint,left,tag,top,width...

5.Panel
name,caption,font,height,hint,left,tag,top,width...

功能要求:
1。在画板上增加基本元素形成组合图形,手工修改属性,然后保存到数据库,可以从库中取出相应的数据并显示。
2。应该有批量修改属性的功能,批量移动或者改变元素,有对齐等编辑功能。
3。所有元素都响应click事件。
4。改变panel大小时,panel内的子元素和位置自动调整。
5。在1的基础上完成复杂图形的录入功能。在绘制图形时可以从已经录入的组合图形中取出一个或多个组合图形,在复杂图形中,组合图形的大小可以改变,其基本元素的大小和位置跟随改变,但是其基本元素的其他属性不能修改
 
深度历险上有一个XYGraph控件,我这儿也有。
 
这里是说明
(*
Component XYGraph, Version 3.0
April 1999

U.J黵?
57078 Siegen, Germany
e-mail: ujhs@aol.com

Component XYGraph 3.0 is a versatile graph for showing 2D data:
1. + Very flexible property design.
2. + Extended control interface
(control the graph and retrieve all curve data without writing one line
of code by simply assigning TControl磗 to the graph磗 CONTROLS property).
3. + Powerful, flickerfree CENTERZOOM (with or without aspect ratio).
4. + Flickerfree REALPAN (single curves or graph).
5. + Editing of curve controlpoints (move, insert, delete, freeze) by mouse
or numerical input.
6. + Free colored offset-lettering for every controlpoint.
7. + Three markstyles with scaleable size to mark important controlpoints.
8. + Relative cursor reading.
9. + Streamed writing and reading single curves or graph.
10. + DXF output of graph and curves for data exchange with CAD systems.
11. + Moveable hintpanel for additional graph-information.
12. + Example project showing some features.

Properties:
property Controls: TControls
(all properties of type TControl can be TLabel, TStaticText, TStatusLabel
or TPanel. They are used for data output. For example assigning a TLabel
to the property "Mode" will display the graph磗 actual mode.)
property XOut: TControl (output) (normally the TEdit XIn)
property YOut: TControl (output) (normally the TEdit YIn)
property Mode: TControl (output)
property Curve: TControl (output)
property Item: TControl (output)
property Color: TControl (output)
property Angle: TControl (output)
(TEdits are used for numerical inputs. (and outputs of X,Y))
property XIn: TEdit (input)
property YIn: TEdit (input)
(TButtons are used as switches to control graph functions.)
property Clear: TButton (input)
property OpenView: TButton (input)
property OpenPan: TButton (input)
property Reset: TButton (input)
(TRadioButtons are used to control the graph磗 operating mode.)
property ModeNone: TRadioButton (input)
property ModeMove: TRadioButton (input)
property ModeInsert: TRadioButton (input)
property ModeDelete: TRadioButton (input)
property ModeCursor: TRadioButton (input)
(TCheckBoxes are used to control graph options.)
property AspectRatio: TCheckBox (input)
property MainGrid: TCheckBox (input)
property SubGrid: TCheckBox (input)
property HintPanel: TCheckBox (input)
property ViewListBox: TCheckListBox (input)
(ViewListBox is used to control visibility of curves. Click checkmark
of the curve you want to show or hide. To show/hide the ViewListBox
use Button "OpenView".)
property PanListBox: TCheckListBox
(PanListBox is used to select the curve(s) you want to move in the graph.
To show/hide then PanListBox use Button "OpenPan".)

property Colors: TColors
property AxisBkGnd: color of xy-axis background.
property TickColor: color of scaleticks.
property GraphBkGnd: color of graph background.
property MainGridColor: color of maingrid.
property SubGridColor: color of subgrid.

property Fonts: TFonts
property AxisScale: font of axis-scale.
property AxisTitle: font of axis title.
property GraphTitle: font of graph title.

property GraphTitle: Str32 string of graph title.

property Positions: TPositions
property XAxisLeft: left margin of xaxis.
property XAxisRight: right margin of xaxis.
property YAxisTop: top margin of yaxis.
property YAxisBottom: bottom margin of yaxis.
property TitleTop: top margin of graph title.
property TitleLeft: left margin of graph title (centered if 0).
property XAxisTitle: bottom margin of xaxis title.
property YAxisTitle: left margin of yaxis title.

property XAxis: TAxis
property Title: title of axis
property Min: min value of axis
property Max: max value of axis
property MainTicks: how many ticks with texture.
property SubTicks: how many ticks between MainTicks.
property MainTickLen: length of MainTicks.
property SubTickLen: length of SubTicks.
property Decimals: how many digits after comma.
property ShowMainGrid: flag for showing MainGrid (for color look at Colors).
property ShowSubGrid: flag for showing SubGrid (for color look at Colors).

property YAxis: TAxis read FYAxis write FYAxis;
(same as XAxis)

property MaxZoom: defines the zoomlimits (MinZoom is 1 / MaxZoom).
----------------------------------------------------------------------------

Control functions:
LeftButton: does REALPAN if no other function is active. If one or
more curves are selected in the PanListBox, then these curves are moved
instead of panning the graph. You can also set this offset by numerical
input via the X/Y TEdits.
If a curve-controlpoint is active (shown by a marker), then
the actual function (move, insert, delete) is performed.

RightButton: does CENTERZOOM. The point you click will be centered
and then zoomed by mouse movement. If you deselect "Aspect" the X and Y
axis are zoomed independent.

DoubleClick: Resets the graph (pan and zoom).

Shift: if a curve-controlpoint is marked you can freeze this point by
holding down the shift-key.
----------------------------------------------------------------------------

How to do:
Setup the graph to your needs with the properties.
Use the
function MakeCurve(AName: Str32; AColor: TColor; ALineWidth: Byte;
APenStyle: TPenStyle; AEnabled: Boolean);
to create a new curve. The parameters makes the creation very flexible.
Assuming AName = "test". If "test" already exists, it will be renamed to
"test1" (just like Delphi does it with components).
You get a handle to the created curve. With this handle you can add new
points with the

procedure AddPoint(AIndex: Integer; X,Y: TFloat);

Where AIndex is the handle to the curve. After creation of all points you
can add text and/or marks to every point you want with the

procedure AddText(AIndex,APosition,AXOfs,AYOfs: Integer;
const AText: Str32; AColor: TColor);
procedure AddMark(AIndex,APosition: Integer; AMarkType:
TMarkType; AColor: TColor);

AIndex is the handle of the curve. APosition is the pointindex of the curve.
AXOfs,AYOfs defines at witch offsets (relative to the point) where the text
is displayed. Every text can be in different color. For every curve you can
assign a font with the

procedure SetCurveFont(AIndex: Integer; AName: TFontName;
ASize: Integer; AStyle: TFontStyles);

For every curve you can assign the size of marks with the

procedure SetMarkSize(AIndex: Integer; AMarkSize: TMarkSize);

To add text to the HintPanel use Graph.HintPanel.Strings.Add('test');
To clear the text use Graph.HintPanel.Strings.Clear;

To use the edit functions of the graph, set Mode <> None. If moving the
mouse cursor, a marker signs every controlpoint of the curve. Depending on
the editmode you can move, delete or insert a point (only if the marker
is visible). To freeze the actual marker, press (and hold down) the Shift-key.
If EditMode is "Move", you can numerical input new point coordinates via
the X,Y TEdits (if assigned).
----------------------------------------------------------------------------

DXF-output: you can create a DXF file with the

function MakeDXF(const FileName: string; FromX1,FromY1,FromX2,FromY2,
ToX1,ToY1,ToX2,ToY2,TextHeight: TFloat; Decimals: Byte): Boolean;

FromX1..FromY2 are the source coordinates.
ToX1..TY2 are the destination coordinates.
Decimals is the precision after comma.
All entities inside the source coordinates are transfered true to scale
into the destination coordinates. Everything outside (text,scalelines etc.)
are not true to scale. Does not process additional text (created with
AddText) and marks (created with AddMark).
----------------------------------------------------------------------------

Interesting public methods are:

function MakeCurve(const AName: Str32; AColor: TColor; ALineWidth: Byte;
APenStyle: TPenStyle; AEnabled: Boolean): Integer;
procedure AddPoint(AIndex: Integer; X,Y: TFloat);
procedure AddText(AIndex,APosition,AXOfs,AYOfs: Integer; const AText: Str32; AColor: TColor);
procedure SetCurveFont(AIndex: Integer; AName: TFontName; ASize: Integer; AStyle: TFontStyles);
procedure AddMark(AIndex,APosition: Integer; AMarkType: TMarkType; AColor: TColor);
procedure SetMarkSize(AIndex: Integer; AMarkSize: TMarkSize);
procedure ChangePoint(AIndex,APosition: Integer; X,Y: TFloat);
procedure DeleteCurve(AItem: Integer);
function GetCurveHandle(AName: Str32; var H: Integer): Boolean;
function GetCurveName(H: Integer): Str32;
procedure SetCurveEnabled(AIndex: Integer; Value: Boolean);
procedure GetPoint(AIndex,APosition: Integer; var X,Y: TFloat);
procedure InsertPoint(AIndex,APosition: Integer; X,Y: TFloat);
procedure DeletePoint(AIndex,APosition: Integer);
procedure Reset;
procedure ShowHintPanel(Show: Boolean);
procedure SetXOfs(AIndex: Integer; AOfs: TFloat);
function GetXOfs(AIndex: Integer): TFloat;
procedure SetYOfs(AIndex: Integer; AOfs: TFloat);
function GetYOfs(AIndex: Integer): TFloat;
procedure CheckCurvePoints(X,Y: Integer);
procedure ChangeCPx(Fx: TFloat);
procedure ChangeCPy(Fy: TFloat);
procedure ChangeCurveOfs(Ox,Oy: TFloat; Relative: Boolean);
procedure GetCPInfo(var CPMatch: Boolean; var CPCurve,CPIndex: Integer);
procedure SetMode(Value: TMode);
function MakeDXF(const FileName: string; FromX1,FromY1,FromX2,FromY2,
ToX1,ToY1,ToX2,ToY2,TextHeight: TFloat; Decimals: Byte): Boolean;
function SaveCurveToFile(const FileName: string; Item: Integer): Boolean;
function LoadCurveFromFile(const FileName: string): Boolean;
function SaveGraphToFile(const FileName: string): Boolean;
function LoadGraphFromFile(const FileName: string): Boolean;
----------------------------------------------------------------------------

Look at the demo project to see some other features like writing and
reading curves or graph, or creating DXF output.

Excuse my english - I hope you get at least the gist of it.
*)
 
你从Tpanel继承,自己做吧
 
看的糊涂,好象是做矢量图,却又要响应Click。不懂。
 
wangxd我怎么做啊?
以前没做过控件,
老兄给多点提示??

jifee,XYGraph控件我怎的没找到,你发个过来,traveler@ah163.com

 
谢谢jifee兄,不过你发的好像装不上?

分会给你一大笔的,我还有问题,怎么在运行期加控件,和控制控件的各项属性?

当然这些功能都在控件中实现?

各位大虾快来帮帮帮我!!!!!

 
你的要求太复杂,简直可以做为一个项目来做了。
我有个早些时候做的试验例程,是动态创、删除建控件及修改控件尺寸的例子,里面可能
有些元素是你用得到的。如果要的话我发给你。
 
怎么在运行期加控件,和控制控件的各项属性。
procedure CreateButton;
var
myButton: TButton;
begin
//运行期加控件
myButton := TButton.Create(Application);
//各项属性
myButton.parent := Panel1;
myButton.Top := 10;
...
end;

 
eastroad兄,你误解我的意思!

我的意思是加控件原来没有的属性,比如:给Image加一个NUMBER属性!

还有在运行期可以加事件。就象Delphi在运行是可以加控件一样!

是不是象开发一个 delphi :(((
 
Sachow兄,如果有请来一个,我等救命!
你的消息正是我等救命的东东,
越快越好!你就是我的救星·_@
分吗,肯定少不了!
还可以加分!:))
我的Mail:traveler@ah163.com or one_top_one@hotmail.com
 
别期望值太高,期望值越高,越容易失望。
先用着看。
(今天我的机器出了问题,等弄好以后再试着按照你的需求做一下)
 
多谢Sachow兄,希望Sachow兄能在28号之前帮我做一个,
28号散分,做好,另开请Sachow去拿分!

另外我还想问一下,怎么在运行期改控件的其它属性,
比如Image的Picture属性,还有怎么添加属性与事件?
 
28号,还剩不到两天了,只怕我是有心无力。今天重装系统又花了一整天时间。
尽力而为了……
 
抱歉要让你失望了,这两天接到了新的工作,不能深入研究你要求的控件了。
你试试到这个网站找找看:
http://www.torry.net/charts.htm
主要看一下VCL中的Sizers, Charts and Graphs
 
可以修改DsFancyButton的源码,达到你的要求。
 
麻烦doxpix兄给我发一个DsFancyButton控件。:)

这里要特别感谢Sachow兄,还希望Sachow兄有时间的时候能写一个让俺来学习学习,先谢了

开始散分!都有分啊!:))))
 
我想补充一下,跟据你的要求,实现5项控件需求并不难,但要实现功能需求后面几项就
比较麻烦,而且如果要将其做成一个产品或是项目的组成部分,还需要更清晰地定义需求。
要完成后面这几项功能需求,我估计快赶上做Word XP的流程图编辑功能了,所以如果真
要做的话,要花大功夫才行。
 
http://www.vclxx.org/DELPHI/D32FREE/DSFANCY.ZIP
可下载DsFancyButton。

参见——
http://www.vclxx.org/DELPHI/AAAT1023.HTM
 
后退
顶部