home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / Chip_2002-09_cd1.bin / zkuste / delphi / kompon / d6 / YPPARSER.ZIP / GraphX / GraphImpl.pas < prev    next >
Pascal/Delphi Source File  |  2002-06-14  |  19KB  |  702 lines

  1. {********************************************************}
  2. {                                                        }
  3. {                      GraphX                            }
  4. {             IMPORTANT-READ CAREFULLY:                  }
  5. {                                                        }
  6. {    This End-User License Agreement is a legal          }
  7. {    agreement between you (either an individual         }
  8. {    or a single entity) and Pisarev Yuriy for           }
  9. {    the software product identified above, which        }
  10. {    includes computer software and may include          }
  11. {    associated media, printed materials, and "online"   }
  12. {    or electronic documentation ("SOFTWARE PRODUCT").   }
  13. {    By installing, copying, or otherwise using the      }
  14. {    SOFTWARE PRODUCT, you agree to be bound by the      }
  15. {    terms of this LICENSE AGREEMENT.                    }
  16. {                                                        }
  17. {    If you do not agree to the terms of this            }
  18. {    LICENSE AGREEMENT, do not install or use            }
  19. {    the SOFTWARE PRODUCT.                               }
  20. {                                                        }
  21. {    License conditions                                  }
  22. {                                                        }
  23. {    No part of the software or the manual may be        }
  24. {    multiplied, disseminated or processed in any        }
  25. {    way without the written consent of Pisarev          }
  26. {    Yuriy. Violations of these conditions will be       }
  27. {    prosecuted in every case.                           }
  28. {                                                        }
  29. {    The use of the software is done at your own         }
  30. {    risk. The manufacturer and developer accepts        }
  31. {    no liability for any damages, either as direct      }
  32. {    or indirect consequence of the use of this          }
  33. {    product or software.                                }
  34. {                                                        }
  35. {    Only observance of these conditions allows you      }
  36. {    to use the hardware and software in your computer   }
  37. {    system.                                             }
  38. {                                                        }
  39. {    All rights reserved.                                }
  40. {    Copyright 2002 Pisarev Yuriy                        }
  41. {                                                        }
  42. {                 yuriy_mbox@hotmail.com                 }
  43. {                                                        }
  44. {********************************************************}
  45.  
  46. unit GraphImpl;
  47.  
  48. {$WARN SYMBOL_PLATFORM OFF}
  49.  
  50. interface
  51.  
  52. uses
  53.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  54.   ActiveX, AxCtrls, XGraph_TLB, StdVcl, ActnList, ActnMan, ImgList,
  55.   ComCtrls, StdCtrls, ExtCtrls, ToolWin, ClipBrd, GraphBldr, Menus;
  56.  
  57. type
  58.   TGraphX = class(TActiveForm, IGraphX)
  59.     ControlBar1: TControlBar;
  60.     ToolBar1: TToolBar;
  61.     Panel1: TPanel;
  62.     tbCalculate: TToolButton;
  63.     tbDelete: TToolButton;
  64.     tbShowGrid: TToolButton;
  65.     tbCopy: TToolButton;
  66.     ToolButton1: TToolButton;
  67.     tbDetailLevel: TTrackBar;
  68.     tbGraphColor: TToolButton;
  69.     ToolButton2: TToolButton;
  70.     StatusBar: TStatusBar;
  71.     ImageList1: TImageList;
  72.     ActionManager1: TActionManager;
  73.     EditCalculate: TAction;
  74.     EditShowGrid: TAction;
  75.     EditTrace: TAction;
  76.     EditCopy: TAction;
  77.     EditDelete: TAction;
  78.     EditGraphColor: TAction;
  79.     ColorDialog: TColorDialog;
  80.     HelpAbout: TAction;
  81.     GraphBldr: TGraphBldr;
  82.     ToolBar2: TToolBar;
  83.     Panel2: TPanel;
  84.     edXMaxValue: TEdit;
  85.     udXMaxValue: TUpDown;
  86.     ToolButton4: TToolButton;
  87.     Panel3: TPanel;
  88.     edYMaxValue: TEdit;
  89.     udYMaxValue: TUpDown;
  90.     ToolButton5: TToolButton;
  91.     Panel4: TPanel;
  92.     edPenWidth: TEdit;
  93.     udPenWidth: TUpDown;
  94.     ToolButton6: TToolButton;
  95.     Panel6: TPanel;
  96.     edHorzSpacing: TEdit;
  97.     udHorzSpacing: TUpDown;
  98.     ToolButton7: TToolButton;
  99.     Panel7: TPanel;
  100.     edVertSpacing: TEdit;
  101.     udVertSpacing: TUpDown;
  102.     EditAxis: TAction;
  103.     tbHelp: TToolButton;
  104.     tbAxis: TToolButton;
  105.     ToolButton3: TToolButton;
  106.     RichEdit: TRichEdit;
  107.     tbTrace: TToolButton;
  108.     procedure EditCalculateExecute(Sender: TObject);
  109.     procedure EditShowGridExecute(Sender: TObject);
  110.     procedure EditAxisExecute(Sender: TObject);
  111.     procedure EditTraceExecute(Sender: TObject);
  112.     procedure EditCopyExecute(Sender: TObject);
  113.     procedure EditDeleteExecute(Sender: TObject);
  114.     procedure EditGraphColorExecute(Sender: TObject);
  115.     procedure GraphBldrMouseMove(Sender: TObject; Shift: TShiftState; X,
  116.       Y: Integer);
  117.     procedure GraphBldrTrace(Sender: TObject; X, Y: Double);
  118.     procedure edTextKeyPress(Sender: TObject; var Key: Char);
  119.     procedure tbDetailLevelChange(Sender: TObject);
  120.     procedure RichEditKeyDown(Sender: TObject; var Key: Word;
  121.       Shift: TShiftState);
  122.     procedure edXMaxValueChange(Sender: TObject);
  123.     procedure edYMaxValueChange(Sender: TObject);
  124.     procedure edPenWidthChange(Sender: TObject);
  125.     procedure edHorzSpacingChange(Sender: TObject);
  126.     procedure edVertSpacingChange(Sender: TObject);
  127.     procedure EditKeyPress(Sender: TObject; var Key: Char);
  128.     procedure HelpAboutExecute(Sender: TObject);
  129.   private
  130.     FEvents: IGraphXEvents;
  131.     procedure ActivateEvent(Sender: TObject);
  132.     procedure ClickEvent(Sender: TObject);
  133.     procedure CreateEvent(Sender: TObject);
  134.     procedure DblClickEvent(Sender: TObject);
  135.     procedure DeactivateEvent(Sender: TObject);
  136.     procedure DestroyEvent(Sender: TObject);
  137.     procedure KeyPressEvent(Sender: TObject; var Key: Char);
  138.     procedure PaintEvent(Sender: TObject);
  139.   protected
  140.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  141.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  142.     function Get_Active: WordBool; safecall;
  143.     function Get_AlignDisabled: WordBool; safecall;
  144.     function Get_AutoScroll: WordBool; safecall;
  145.     function Get_AutoSize: WordBool; safecall;
  146.     function Get_AxBorderStyle: TxActiveFormBorderStyle; safecall;
  147.     function Get_Caption: WideString; safecall;
  148.     function Get_Color: OLE_COLOR; safecall;
  149.     function Get_Cursor: Smallint; safecall;
  150.     function Get_DoubleBuffered: WordBool; safecall;
  151.     function Get_DropTarget: WordBool; safecall;
  152.     function Get_Enabled: WordBool; safecall;
  153.     function Get_Font: IFontDisp; safecall;
  154.     function Get_HelpFile: WideString; safecall;
  155.     function Get_HelpKeyword: WideString; safecall;
  156.     function Get_HelpType: TxHelpType; safecall;
  157.     function Get_KeyPreview: WordBool; safecall;
  158.     function Get_PixelsPerInch: Integer; safecall;
  159.     function Get_PrintScale: TxPrintScale; safecall;
  160.     function Get_Scaled: WordBool; safecall;
  161.     function Get_Visible: WordBool; safecall;
  162.     function Get_VisibleDockClientCount: Integer; safecall;
  163.     procedure _Set_Font(var Value: IFontDisp); safecall;
  164.     procedure AboutBox; safecall;
  165.     procedure Set_AutoScroll(Value: WordBool); safecall;
  166.     procedure Set_AutoSize(Value: WordBool); safecall;
  167.     procedure Set_AxBorderStyle(Value: TxActiveFormBorderStyle); safecall;
  168.     procedure Set_Caption(const Value: WideString); safecall;
  169.     procedure Set_Color(Value: OLE_COLOR); safecall;
  170.     procedure Set_Cursor(Value: Smallint); safecall;
  171.     procedure Set_DoubleBuffered(Value: WordBool); safecall;
  172.     procedure Set_DropTarget(Value: WordBool); safecall;
  173.     procedure Set_Enabled(Value: WordBool); safecall;
  174.     procedure Set_Font(const Value: IFontDisp); safecall;
  175.     procedure Set_HelpFile(const Value: WideString); safecall;
  176.     procedure Set_HelpKeyword(const Value: WideString); safecall;
  177.     procedure Set_HelpType(Value: TxHelpType); safecall;
  178.     procedure Set_KeyPreview(Value: WordBool); safecall;
  179.     procedure Set_PixelsPerInch(Value: Integer); safecall;
  180.     procedure Set_PrintScale(Value: TxPrintScale); safecall;
  181.     procedure Set_Scaled(Value: WordBool); safecall;
  182.     procedure Set_Visible(Value: WordBool); safecall;
  183.     function Get_Detailization: Integer; safecall;
  184.     procedure Set_Detailization(Value: Integer); safecall;
  185.     function Get_XMaxValue: Integer; safecall;
  186.     procedure Set_XMaxValue(Value: Integer); safecall;
  187.     function Get_YMaxValue: Integer; safecall;
  188.     procedure Set_YMaxValue(Value: Integer); safecall;
  189.     function Get_PenWidth: Integer; safecall;
  190.     procedure Set_PenWidth(Value: Integer); safecall;
  191.     function Get_Text: WideString; safecall;
  192.     procedure Set_Text(const Value: WideString); safecall;
  193.   public
  194.     procedure Initialize; override;
  195.   end;
  196.  
  197. implementation
  198.  
  199. uses ComObj, ComServ, About;
  200.  
  201. {$R *.DFM}
  202.  
  203. { TGraphX }
  204.  
  205. procedure TGraphX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  206. begin
  207.   { Define property pages here.  Property pages are defined by calling
  208.     DefinePropertyPage with the class id of the page.  For example,
  209.       DefinePropertyPage(Class_GraphXPage); }
  210. end;
  211.  
  212. procedure TGraphX.EventSinkChanged(const EventSink: IUnknown);
  213. begin
  214.   FEvents := EventSink as IGraphXEvents;
  215.   inherited EventSinkChanged(EventSink);
  216. end;
  217.  
  218. procedure TGraphX.Initialize;
  219. begin
  220.   inherited Initialize;
  221.   OnActivate := ActivateEvent;
  222.   OnClick := ClickEvent;
  223.   OnCreate := CreateEvent;
  224.   OnDblClick := DblClickEvent;
  225.   OnDeactivate := DeactivateEvent;
  226.   OnDestroy := DestroyEvent;
  227.   OnKeyPress := KeyPressEvent;
  228.   OnPaint := PaintEvent;
  229.   GraphBldr.DataEditor.AttrsManager.Add(RichEdit);
  230. end;
  231.  
  232. function TGraphX.Get_Active: WordBool;
  233. begin
  234.   Result := Active;
  235. end;
  236.  
  237. function TGraphX.Get_AlignDisabled: WordBool;
  238. begin
  239.   Result := AlignDisabled;
  240. end;
  241.  
  242. function TGraphX.Get_AutoScroll: WordBool;
  243. begin
  244.   Result := AutoScroll;
  245. end;
  246.  
  247. function TGraphX.Get_AutoSize: WordBool;
  248. begin
  249.   Result := AutoSize;
  250. end;
  251.  
  252. function TGraphX.Get_AxBorderStyle: TxActiveFormBorderStyle;
  253. begin
  254.   Result := Ord(AxBorderStyle);
  255. end;
  256.  
  257. function TGraphX.Get_Caption: WideString;
  258. begin
  259.   Result := WideString(Caption);
  260. end;
  261.  
  262. function TGraphX.Get_Color: OLE_COLOR;
  263. begin
  264.   Result := OLE_COLOR(Color);
  265. end;
  266.  
  267. function TGraphX.Get_Cursor: Smallint;
  268. begin
  269.   Result := Smallint(Cursor);
  270. end;
  271.  
  272. function TGraphX.Get_DoubleBuffered: WordBool;
  273. begin
  274.   Result := DoubleBuffered;
  275. end;
  276.  
  277. function TGraphX.Get_DropTarget: WordBool;
  278. begin
  279.   Result := DropTarget;
  280. end;
  281.  
  282. function TGraphX.Get_Enabled: WordBool;
  283. begin
  284.   Result := Enabled;
  285. end;
  286.  
  287. function TGraphX.Get_Font: IFontDisp;
  288. begin
  289.   GetOleFont(Font, Result);
  290. end;
  291.  
  292. function TGraphX.Get_HelpFile: WideString;
  293. begin
  294.   Result := WideString(HelpFile);
  295. end;
  296.  
  297. function TGraphX.Get_HelpKeyword: WideString;
  298. begin
  299.   Result := WideString(HelpKeyword);
  300. end;
  301.  
  302. function TGraphX.Get_HelpType: TxHelpType;
  303. begin
  304.   Result := Ord(HelpType);
  305. end;
  306.  
  307. function TGraphX.Get_KeyPreview: WordBool;
  308. begin
  309.   Result := KeyPreview;
  310. end;
  311.  
  312. function TGraphX.Get_PixelsPerInch: Integer;
  313. begin
  314.   Result := PixelsPerInch;
  315. end;
  316.  
  317. function TGraphX.Get_PrintScale: TxPrintScale;
  318. begin
  319.   Result := Ord(PrintScale);
  320. end;
  321.  
  322. function TGraphX.Get_Scaled: WordBool;
  323. begin
  324.   Result := Scaled;
  325. end;
  326.  
  327. function TGraphX.Get_Visible: WordBool;
  328. begin
  329.   Result := Visible;
  330. end;
  331.  
  332. function TGraphX.Get_VisibleDockClientCount: Integer;
  333. begin
  334.   Result := VisibleDockClientCount;
  335. end;
  336.  
  337. procedure TGraphX._Set_Font(var Value: IFontDisp);
  338. begin
  339.   SetOleFont(Font, Value);
  340. end;
  341.  
  342. procedure TGraphX.AboutBox;
  343. begin
  344.   ShowGraphXAbout;
  345. end;
  346.  
  347. procedure TGraphX.ActivateEvent(Sender: TObject);
  348. begin
  349.   if FEvents <> nil then FEvents.OnActivate;
  350. end;
  351.  
  352. procedure TGraphX.ClickEvent(Sender: TObject);
  353. begin
  354.   if FEvents <> nil then FEvents.OnClick;
  355. end;
  356.  
  357. procedure TGraphX.CreateEvent(Sender: TObject);
  358. begin
  359.   if FEvents <> nil then FEvents.OnCreate;
  360. end;
  361.  
  362. procedure TGraphX.DblClickEvent(Sender: TObject);
  363. begin
  364.   if FEvents <> nil then FEvents.OnDblClick;
  365. end;
  366.  
  367. procedure TGraphX.DeactivateEvent(Sender: TObject);
  368. begin
  369.   if FEvents <> nil then FEvents.OnDeactivate;
  370. end;
  371.  
  372. procedure TGraphX.DestroyEvent(Sender: TObject);
  373. begin
  374.   if FEvents <> nil then FEvents.OnDestroy;
  375. end;
  376.  
  377. procedure TGraphX.KeyPressEvent(Sender: TObject; var Key: Char);
  378. var
  379.   TempKey: Smallint;
  380. begin
  381.   TempKey := Smallint(Key);
  382.   if FEvents <> nil then FEvents.OnKeyPress(TempKey);
  383.   Key := Char(TempKey);
  384. end;
  385.  
  386. procedure TGraphX.PaintEvent(Sender: TObject);
  387. begin
  388.   if FEvents <> nil then FEvents.OnPaint;
  389. end;
  390.  
  391. procedure TGraphX.Set_AutoScroll(Value: WordBool);
  392. begin
  393.   AutoScroll := Value;
  394. end;
  395.  
  396. procedure TGraphX.Set_AutoSize(Value: WordBool);
  397. begin
  398.   AutoSize := Value;
  399. end;
  400.  
  401. procedure TGraphX.Set_AxBorderStyle(Value: TxActiveFormBorderStyle);
  402. begin
  403.   AxBorderStyle := TActiveFormBorderStyle(Value);
  404. end;
  405.  
  406. procedure TGraphX.Set_Caption(const Value: WideString);
  407. begin
  408.   Caption := TCaption(Value);
  409. end;
  410.  
  411. procedure TGraphX.Set_Color(Value: OLE_COLOR);
  412. begin
  413.   Color := TColor(Value);
  414. end;
  415.  
  416. procedure TGraphX.Set_Cursor(Value: Smallint);
  417. begin
  418.   Cursor := TCursor(Value);
  419. end;
  420.  
  421. procedure TGraphX.Set_DoubleBuffered(Value: WordBool);
  422. begin
  423.   DoubleBuffered := Value;
  424. end;
  425.  
  426. procedure TGraphX.Set_DropTarget(Value: WordBool);
  427. begin
  428.   DropTarget := Value;
  429. end;
  430.  
  431. procedure TGraphX.Set_Enabled(Value: WordBool);
  432. begin
  433.   Enabled := Value;
  434. end;
  435.  
  436. procedure TGraphX.Set_Font(const Value: IFontDisp);
  437. begin
  438.   SetOleFont(Font, Value);
  439. end;
  440.  
  441. procedure TGraphX.Set_HelpFile(const Value: WideString);
  442. begin
  443.   HelpFile := String(Value);
  444. end;
  445.  
  446. procedure TGraphX.Set_HelpKeyword(const Value: WideString);
  447. begin
  448.   HelpKeyword := String(Value);
  449. end;
  450.  
  451. procedure TGraphX.Set_HelpType(Value: TxHelpType);
  452. begin
  453.   HelpType := THelpType(Value);
  454. end;
  455.  
  456. procedure TGraphX.Set_KeyPreview(Value: WordBool);
  457. begin
  458.   KeyPreview := Value;
  459. end;
  460.  
  461. procedure TGraphX.Set_PixelsPerInch(Value: Integer);
  462. begin
  463.   PixelsPerInch := Value;
  464. end;
  465.  
  466. procedure TGraphX.Set_PrintScale(Value: TxPrintScale);
  467. begin
  468.   PrintScale := TPrintScale(Value);
  469. end;
  470.  
  471. procedure TGraphX.Set_Scaled(Value: WordBool);
  472. begin
  473.   Scaled := Value;
  474. end;
  475.  
  476. procedure TGraphX.Set_Visible(Value: WordBool);
  477. begin
  478.   Visible := Value;
  479. end;
  480.  
  481. function TGraphX.Get_Detailization: Integer;
  482. begin
  483.   Result := GraphBldr.DetailLevel;
  484. end;
  485.  
  486. procedure TGraphX.Set_Detailization(Value: Integer);
  487. begin
  488.   GraphBldr.DetailLevel := Value;
  489. end;
  490.  
  491. function TGraphX.Get_XMaxValue: Integer;
  492. begin
  493.   Result := GraphBldr.XMaxValue;
  494. end;
  495.  
  496. procedure TGraphX.Set_XMaxValue(Value: Integer);
  497. begin
  498.   GraphBldr.XMaxValue := Value;
  499. end;
  500.  
  501. function TGraphX.Get_YMaxValue: Integer;
  502. begin
  503.   Result := GraphBldr.YMaxValue;
  504. end;
  505.  
  506. procedure TGraphX.Set_YMaxValue(Value: Integer);
  507. begin
  508.   GraphBldr.YMaxValue := Value;
  509. end;
  510.  
  511. function TGraphX.Get_PenWidth: Integer;
  512. begin
  513.   Result := GraphBldr.GraphPen.Width;
  514. end;
  515.  
  516. procedure TGraphX.Set_PenWidth(Value: Integer);
  517. begin
  518.   GraphBldr.GraphPen.Width := Value;
  519. end;
  520.  
  521. function TGraphX.Get_Text: WideString;
  522. begin
  523.   Result := GraphBldr.Text;
  524. end;
  525.  
  526. procedure TGraphX.Set_Text(const Value: WideString);
  527. begin
  528.   GraphBldr.Text := Value;
  529. end;
  530.  
  531. procedure TGraphX.EditCalculateExecute(Sender: TObject);
  532. begin
  533.   Screen.Cursor := crHourGlass;
  534.   try
  535.     with GraphBldr do begin
  536.       Text := RichEdit.Text;
  537.       try
  538.         Calculate;
  539.         StatusBar.Panels[2].Text := '';
  540.       except
  541.         on E: Exception do begin
  542.           Clear;
  543.           StatusBar.Panels[2].Text := E.Message;
  544.         end;
  545.       end;
  546.       Draw;
  547.     end;
  548.   finally
  549.     Screen.Cursor := crDefault;
  550.   end;
  551. end;
  552.  
  553. procedure TGraphX.EditShowGridExecute(Sender: TObject);
  554. begin
  555.   EditShowGrid.Checked := not EditShowGrid.Checked;
  556.   with GraphBldr do begin
  557.     ShowGrid := EditShowGrid.Checked;
  558.     Draw;
  559.   end;
  560. end;
  561.  
  562. procedure TGraphX.EditAxisExecute(Sender: TObject);
  563. begin
  564.   EditAxis.Checked := not EditAxis.Checked;
  565.   with GraphBldr do begin
  566.     ShowAxis := EditAxis.Checked;
  567.     Draw;
  568.   end;
  569. end;
  570.  
  571. procedure TGraphX.EditTraceExecute(Sender: TObject);
  572. begin
  573.   EditTrace.Checked := not EditTrace.Checked;
  574.   with GraphBldr do begin
  575.     Tracing := EditTrace.Checked;
  576.     if not Tracing then StatusBar.Panels[1].Text := '';
  577.     Draw;
  578.   end;
  579. end;
  580.  
  581. procedure TGraphX.EditCopyExecute(Sender: TObject);
  582. begin
  583.   ClipBoard.Assign(GraphBldr.Picture);
  584. end;
  585.  
  586. procedure TGraphX.EditDeleteExecute(Sender: TObject);
  587. begin
  588.   with GraphBldr do begin
  589.     Clear;
  590.     with StatusBar do begin
  591.       Panels[1].Text := '';
  592.       Panels[2].Text := '';
  593.     end;
  594.     Draw;
  595.   end;
  596. end;
  597.  
  598. procedure TGraphX.EditGraphColorExecute(Sender: TObject);
  599. begin
  600.   ColorDialog.Color := GraphBldr.GraphPen.Color;
  601.   if ColorDialog.Execute then with GraphBldr do begin
  602.     GraphPen.Color := ColorDialog.Color;
  603.     Draw;
  604.   end;
  605. end;
  606.  
  607. procedure TGraphX.GraphBldrMouseMove(Sender: TObject; Shift: TShiftState;
  608.   X, Y: Integer);
  609. begin
  610.   StatusBar.Panels[0].Text := Format('%f: %f',
  611.     [GraphBldr.XCoord(X), GraphBldr.YCoord(Y)]);
  612.   PostMessage(StatusBar.Handle, WM_PAINT, 0, 0);
  613. end;
  614.  
  615. procedure TGraphX.GraphBldrTrace(Sender: TObject; X, Y: Double);
  616. begin
  617.   StatusBar.Panels[2].Text := Format('Tracing: %f: %f', [X, Y]);
  618. end;
  619.  
  620. procedure TGraphX.edTextKeyPress(Sender: TObject; var Key: Char);
  621. begin
  622.   if Key = #13 then begin
  623.     Key := #0;
  624.     EditCalculateExecute(nil);
  625.   end;
  626. end;
  627.  
  628. procedure TGraphX.RichEditKeyDown(Sender: TObject; var Key: Word;
  629.   Shift: TShiftState);
  630. begin
  631.   if Key = VK_RETURN then EditCalculate.Execute;
  632. end;
  633.  
  634. procedure TGraphX.tbDetailLevelChange(Sender: TObject);
  635. begin
  636.   GraphBldr.DetailLevel := tbDetailLevel.Position;
  637. end;
  638.  
  639. procedure TGraphX.edXMaxValueChange(Sender: TObject);
  640. begin
  641.   with GraphBldr do begin
  642.     XMaxValue := udXMaxValue.Position;
  643.     if Trim(Text) <> '' then Calculate;
  644.     Draw;
  645.   end;
  646. end;
  647.  
  648. procedure TGraphX.edYMaxValueChange(Sender: TObject);
  649. begin
  650.   with GraphBldr do begin
  651.     YMaxValue := udYMaxValue.Position;
  652.     if Trim(Text) <> '' then Calculate;
  653.     Draw;
  654.   end;
  655. end;
  656.  
  657. procedure TGraphX.edPenWidthChange(Sender: TObject);
  658. begin
  659.   with GraphBldr do begin
  660.     GraphPen.Width := udPenWidth.Position;
  661.     Draw;
  662.   end;
  663. end;
  664.  
  665. procedure TGraphX.edHorzSpacingChange(Sender: TObject);
  666. begin
  667.   with GraphBldr do begin
  668.     HorzSpacing := udHorzSpacing.Position;
  669.     Draw;
  670.   end;
  671. end;
  672.  
  673. procedure TGraphX.edVertSpacingChange(Sender: TObject);
  674. begin
  675.   with GraphBldr do begin
  676.     VertSpacing := udVertSpacing.Position;
  677.     Draw;
  678.   end;
  679. end;
  680.  
  681. procedure TGraphX.EditKeyPress(Sender: TObject; var Key: Char);
  682. begin
  683.   if not (Key in ['0'..'9', #8]) then Key := #0;
  684. end;
  685.  
  686. procedure TGraphX.HelpAboutExecute(Sender: TObject);
  687. begin
  688.   AboutBox;
  689. end;
  690.  
  691. initialization
  692.   TActiveFormFactory.Create(
  693.     ComServer,
  694.     TActiveFormControl,
  695.     TGraphX,
  696.     Class_GraphX,
  697.     1,
  698.     '',
  699.     OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL,
  700.     tmApartment);
  701. end.
  702.