8 downloads
225 Views
311KB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
FBGBKL?JKL?J:PBB :JKL
<\_^_gb_\Delphi F_lh^bq_kdb_mdZaZgbydki_pdmjkm ©JZajZ[hldZ:LQGRZV-ijbeh`_gbcª ^eyklm^_glh\dmjkZ^g_\gh]hbdmjkZ\_q_jg_]h hl^_e_gbcnZdmevl_lZIFF
KhklZ\bl_ebJm^Ze_\<= Dj_f_j:B
2
Kh^_j`Zgb_ <\_^_gb_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 We_f_gluijh]jZffbjh\Zgby\'HOSKL Hkgh\gu_ihgylby 2 WlZiukha^Zgbyijbeh`_gby. . . . . . . . . . . . . . . . 5 EZ[hjZlhjgu_jZ[hlu AZ^Zgby^eykZfhklhyl_evghcjZ[hlu30 Ebl_jZlmjZ 33 Ijbeh`_gb_ 33 <\_^_gb_ <gZklhys__\j_fyh^gbfbagZb[he__m^h[guobgkljmf_glh\^eygZibkZ gby :LQGRZV-ijh]jZff y\eyxlky kbkl_fu [ukljhc \bamZevghc jZajZ[hldb 5$' DqbkemgZb[he__ihimeyjguo5$'hlghkblky'HOSKL-fhsgZymgb\_j kZevgZykbkl_fZijh]jZffbjh\Zgby^ey:LQGRZVgZhkgh\_yaudZ2EMHFW3DVFDO \dexqZxsZy\k_[ykj_^kl\Zih^^_j`db[Za^Zgguo Ihkh[b_kh^_j`blgZqZevgu_k\_^_gbyihjZ[hl_\Delphi. P_evihkh[bygZmqblvklm^_glh\\g_^jylvihevah\Zl_evkdbcbgl_jn_ckb]jZnbdm\k\hbijb deZ^gu_ \uqbkebl_evgu_ijh]jZffu^eydmjkh\uob^biehfguojZ[hlijZd lbdmfh\ihjZaebqguf^bkpbiebgZfbli FZl_jbZebaeZ]Z_lkygZijbf_jZo\ ihke_^h\Zl_evghklbhlijhklh]hdkeh`ghfmhlbkihevah\ZgbyklZg^Zjlguo\b amZevguodhfihg_glh\^hkha^Zgbykh[kl\_gguodeZkkh\ JZ[hlZ k ihkh[b_f lj_[m_l agZdhfkl\Z k h[t_dlgh-hjb_glbjh\Zgghc l_o gheh]b_cijh]jZffbjh\Zgbybmf_gbyjZ[hlZlv\:LQGRZV We_f_gluijh]jZffbjh\Zgby\'HOSKL 1.1.Hkgh\gu_ihgylby Delphi -kj_^Z\bamZevgh]hijh]jZffbjh\Zgby
3
DZdbex[hcdeZkkdhfihg_gloZjZdl_jbam_lkyiheyfbk\hckl\Zfbbf_ lh^Zfb<'HOSKL\f_klhihe_ch[uqghbkihevamxlkyk\hckl\ZK\hckl\hfh`gh jZkkfZljb\ZlvdZdjZagh\b^ghklviheydeZkkZh[jZs_gb_ddhlhjhfmZ\lhfZlb q_kdbijb\h^bld\uah\mf_lh^Zql_gbyaZibkbiheyGZihfgbfqlhohjhrbf klbe_f\h[t_dlgh-hjb_glbjh\Zgghfijh]jZffbjh\ZgbbkqblZ_lkyh[jZs_gb_d iheyflhevdhq_j_af_lh^u Djhf_lh]hdhfihg_glbf__li_j_q_gvkh[ulbcgZdhlhju_hgkihkh[_g j_Z]bjh\ZlvgZijbf_jgZ`Zlb_deZ\brbs_eqhddghidhcfurbb^j AZ^ZqZ ijh]jZffbklZ-gZibkZlvh[jZ[hlqbdbkh[ulbchl\_qZxsb_aZj_Zdpbxdhfih g_glZgZhij_^_e_ggh_kh[ulb_ Dhfihg_glu [u\Zxl \bamZevgufb b g_\bamZevgufb I_j\u_ ij_^gZagZ q_gu^eyhj]ZgbaZpbbbgl_jn_ckZkihevah\Zl_e_fdghidbkljhdbj_^Zdlbjh \Zgbyi_j_dexqZl_ebkibkdbbl^ Hgb\b^gugZwdjZg_\h\j_fy\uiheg_ gby ijh]jZffu G_\bamZevgu_ dhfihg_glu kem`Zl ^ey ^hklmiZ d kbkl_fguf j_kmjkZfgZijbf_j^jZc\_jZf[Za^Zgguoey jZaf_s_gby ij_^klZ\e_gguo dhfihg_glh\ gZ nhjf_ g_h[oh^bfh ©s_edgmlv furvxª gZ ibdlh]jZff_ b aZl_f ©s_edgmlv furvxª\gm`ghff_kl_nhjfu •HdghnhjfuA^_kvgZ^hjZaf_klblvbkihevam_fu_ijh]jZffhc\bamZev gu_bg_\bamZevgu_dhfihg_glu
4
Jbk •Hdgh j_^Zdlbjh\Zgby fh^mey Kh^_j`bl l_dklu fh^me_c k\yaZgguo k nhjfZfb Fh^meb ^ey jZaguo nhjf gZoh^ylky gZ hl^_evguo kljZgbpZo k aZ deZ^dZfb I_j_dexqblvky ba hdgZ j_^Zdlbjh\Zgby \ hdgh khhl\_lkl\mxs_c nhjfubh[jZlghfh`ghkihfhsvxdeZ\brbF12. •Bgki_dlhj h[t_dlh\ K _]h ihfhsvx fh`gh mklZgZ\eb\Zlv agZq_gby k\hckl\ dhfihg_glh\ b aZ^Z\Zlv boj_ZdpbxgZklZg^Zjlgu_kh[ulbyKhklhbl ba^\mokljZgbpGZi_j\hckljZgbp_3URSHUWLHV ijb\_^_gkibkhdk\hckl\dhf ihg_glh\gZ\lhjhc(YHQWV ijb\_^_gkibkhdkh[ulbcgZdhlhju_dhfihg_gl fh`_l j_Z]bjh\Zlv K\hckl\Z b kh[ulby mdZau\Zxlky \k_]^Z ^ey \u^_e_ggh]h dhfihg_glZgZnhjf_Dhfihg_gl\u^_ey_lkys_eqdhffurbijbwlhfihy\ ey_lkyoZjZdl_jgh_h[jZfe_gb_
5
WlZiukha^Zgbyijbeh`_gby Ijhp_kkkha^Zgbyex[h]h:LQGRZV-ijbeh`_gbygZ'HOSKL\dexqZ_l\k_ [yke_^mxsb_wlZiu 1. Kha^Zgb_ wkdbaZ nhjfu GZ nhjf_ jZaf_sZxlky g_h[oh^bfu_ \bam Zevgu_ b g_\bamZevgu_ dhfihg_glu Khhl\_lkl\mxsb_ nhjf_ fh^meb pas b .dfm'HOSKL]_g_jbjm_lkZfhklhyl_evgh>eydZ`^h]hjZaf_s_ggh]hdhfihg_glZ 'HOSKLaZghkbl\hibkZgb_deZkkZnhjfuiheykh^_j`Zsb_mdZaZl_ebgZh[t_d lu-wda_fieyjudhfihg_glh\Wda_fieyjudhfihg_glh\[m^mlkha^Zgu\iZfylb \h \j_fy \uiheg_gby ijh]jZffu f_lh^hf-dhgkljmdlhjhf nhjfu
6
^\hcghcs_eqhd OnKeyPressgZ`Zlb_deZ\brb bl^Qlh[ukhihklZ\blvkh [ulbx_]hf_lh^-h[jZ[hlqbdg_h[oh^bfh^\ZjZaZs_edgmlvfurvx\bgki_d lhj_h[t_dlh\gZkljZgbp_(YHQWVihimklhfmihexjy^hfkgZa\Zgb_fkh[ulby Ijb wlhf 'HOSKL Z\lhfZlbq_kdb k]_g_jbjm_l aZ]hlh\dm f_lh^Z dm^Z ijh]jZf fbkl^he`_gaZibkZlvg_h[oh^bfu_ih_]hfg_gbxhi_jZlhju GZa\Zgby h[jZ[hlqbdh\ kh[ulbc kljhylky ih hij_^_e_gguf ijZ\beZf ijbklZ\dZ On aZf_gy_lky bf_g_f agZq_gb_f k\hckl\Z Name dhfihg_glZ©khmqZklgbdZªkh[ulbykmdZaZgb_fdeZkkZl_dms_cnhjfugZijbf_j^eykh [ulby OnClick s_eqdZ ih dghid_ Button1 gZa\Zgb_ [m^_l bf_lv \b^ SURFHGXUH TForm1.Button1Click LZdbf h[jZahf \ gZa\Zgbb h[jZ[hlqbdZ aZnbdkbjh\Zgh dZdgZa\Zgb_kh[ulbylZdbbfyh[t_dlZgZdhlhjhfhghijhbahreh >eydZ`^h]hdhfihg_glZbf__lkylgkh[ulb_ihmfheqZgbxGZijbf_j ^eyButton -wlhOnClick?keb^\Z`^us_edgmlvihh[t_dlm'HOSKLkha^ZklaZ]h lh\dmh[jZ[hlqbdZlZdh]hkh[ulby BlZd \_kv dh^ ijh]jZffu hdZau\Z_lky khkj_^hlhq_g \ h[jZ[hlqbdZo kh [ulbc JZamf__lky wlb h[jZ[hlqbdb fh]ml \uau\Zlv b ^jm]b_ g_aZ\bkbfu_ ijhp_^mju\lhfqbke_ojZgysb_ky\^jm]boljZ^bpbhgguofh^meyoZlZd`_ ©qm`b_ª h[jZ[hlqbdb kh[ulbc Ih kjZ\g_gbx k [hevrbgkl\hf ijh]jZff ^ey MS-'26ijh]jZffu^ey:LQGRZVbf_xlbgmx©iZjZee_evgmxªkljmdlmjmG_ \^Z\Zykv\^_lZeb__fh`ghij_^klZ\blvdZdpbdeh`b^Zgbykh[ulbc\gmljb dhlhjh]hkh[ulbyZgZebabjmxlkyb\uau\Z_lkykhhl\_lkl\mxsbch[jZ[hlqbd FDVHkh[ulb_RI kh[ulb_H[jZ[hlqbd kh[ulb_H[jZ[hlqbd . . . kh[ulb_1H[jZ[hlqbd1 end; 'HOSKLkdju\Z_lhlijh]jZffbklZwlmkljmdlmjmhklZ\eyy_fmebrvgZib kZgb_h[jZ[hlqbdh\©NmgdpbhgZevghklvªl_Ze]hjblfjZkq_lh\^eyijbdeZ^ ghcaZ^ZqblZd`_jZaf_sZ_lky\h[jZ[hlqbd_kh[ulby
7
>ey ojZg_gby nZceh\ ijh_dlZ kha^Zcl_ gh\uc dZlZeh] gZijbf_j f:\projectsKh[ex^Zcl_ijZ\behdZ`^ucgh\ucijh_dlojZgblv\hl^_evghfdZ lZeh]_ AZimklbl_'HOSKLb\u[_jbl_imgdlf_gx)LOH_1HZ$SSOLFDWLRQ?keb ^jm]hcijh_dl[uem`_aZ]jm`_gbfh^bnbpbjh\Zglh'HOSKLFihfhsvx^bZeh ]h\h]hhdgZij_^hklZ\bl\hafh`ghklvkhojZgblvwlhlijh_dli_j_^aZ]jmadhc gh\h]hijb\u[hj_Yes bebhldZaZlvkyhl_]hkhojZg_gbyijb\u[hj_No). Ih mfheqZgbx nZceZf gh\h]h ijh_dlZ ijbk\Zb\Zxlky bf_gZ Project1, Unit1ZkZfbnZceu[m^mljZaf_s_gu\jZ[hq_fdZlZeh]_'HOSKLJ_dhf_g^m_lky kjZam `_ khojZgblv wlb nZceu \ ebqghf dZlZeh]_ k gh\ufbkh^_j`Zl_evgufb bf_gZfb\u[jZ\dhfZg^m)LOH_6DYH3URMHFWAs. Baf_gbl_ aZ]heh\hd nhjfu >ey wlh]h \u^_ebl_ nhjfm mdZaZ\ gZ g__ furvx \u[_jbl_ aZdeZ^dm 3URSHUW\ \ hdg_ bgki_dlhjZ h[t_dlh\ b kijZ\Z hl k\hckl\ZCaption\\_^bl_l_dklgZijbf_jFhyi_j\Zyijh]jZffZ[_adZ\uq_d k\hckl\hCaptionbf__llbiString). <ijbgpbi_hjZ[hlZ_fijh_dlS_edgbl_gZaZdeZ^d_6WDQGDUGgZiZeblj_dhfih g_glh\S_edgbl_kgZqZeZihdghid_ButtonZaZl_f_s_jZa\lhf_klhnhjfu ]^_
8
Kha^Zcl_h[jZ[hlqbdkh[ulbys_eqdZfurvx^eydghidbButton1>ey wlh]h\u^_ebl_dghidmb^\ZjZaZs_edgbl_gZkljZgbp_(YHQWVbgki_dlhjZh[t _dlh\kijZ\Zhlkh[ulbyOnClickeb[h^\ZjZaZihdghid_Button1<hdg_j_^Zd lbjh\Zgby ihy\blky aZ]hlh\dZ bkoh^gh]h l_dklZ ijhp_^mju-h[jZ[hlqbdZ Dmj khj jZkiheh`blky \gmljb l_eZ ijhp_^mju f_`^m dexq_\ufb keh\Zfb begin b end<\_^bl_f_lh^nhjfuCloseaZdju\Zxsbcnhjfm procedure TForm1.Button1Click (Sender: TObject); begin Close; //IheghklvxaZibku\Z_lky)RUP&ORVH end;
LZddZdForm1 -]eZ\gZynhjfZijbeh`_gby__aZdjulb_\_^_ldaZ\_jr_ gbxijbeh`_gbyA^_kvSender -klZg^ZjlguciZjZf_ljkh^_j`ZsbckkuedmgZ h[t_dl-bklhqgbd kh[ulby Bkihevam_lky j_^dh \ hkgh\ghf dh]^Z g_kdhevdh h[t_dlh\bkihevamxlh^bgblhl`_h[jZ[hlqbdkh[ulby :gZeh]bqgu_ ^_ckl\by ijh^_eZcl_ k dghidhc Button2 >ey g__ h[jZ [hlqbdkh[ulbyaZibrbl_ke_^mxsbfh[jZahf procedure TForm1.Button2Click(Sender: TObject); begin 3DQHO&DSWLRQ ¶GZ`ZlZdghidZKlZjl¶ end;
GZihfgbfqlhButton2 -bfyh[t_dlZagZq_gb_k\hckl\ZName), KlZjl -gZ^ibkvgZh[t_dl_agZq_gb_k\hckl\ZCaption). Ijhkfhljbl_l_dklfh^meyGZc^bl_\g_fh[ty\e_gb_deZkkZTForm1. Wlhl deZkk y\ey_lky gZke_^gbdhf klZg^Zjlgh]h deZkkZ TForm hibku\Zxs_]h imklh_hdghGZc^bl_dZdb_\g_fihy\bebkvgh\u_k\hckl\Zbf_lh^u Hldhfibebjmcl_ijh]jZffmbaZimklbl___gZ\uiheg_gb_Hdghijh ]jZffu[m^_lbf_lvke_^mxsbc\b^
AZ\_jrbl_ijh]jZffmgZ`Zlb_fdghidb
9
JZkkfhljbfkljmdlmjmgZibkZggh]h
unit Unit1; AZ]heh\hdfh^mey interface K_dpbybgl_jn_ckZhldjuluohibkZgbc uses Ih^dexq_gb_klZg^Zjlguofh^me_c Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type HibkZgb_deZkkZnhjfu TForm1=class(TForm) bj_dlb\ZdhfibeylhjmaZklZ\eyxsZy_]h\dexqblv \bkihegy_fucnZce\bamZevgh_hibkZgb_nhjfuk\yaZggh_k ^Zgguffh^me_fHibkZgb_ojZgblkygZ^bkd_\hl^_evghf h^ghbf_gghfnZce_kjZkrbj_gb_f')0gZijbf_j^ey fh^mey8QLWSDV\nZce_8QLWGIP >Ze__jZkiheZ]Zxlkyh[jZ[hlqbdbkh[ulbc procedure TForm1.Button1Click(Sender: TObject); begin 3DQHO&DSWLRQ ¶GZ`ZlZdghidZKlZjl¶ end; procedure TForm1.Button2Click(Sender: TObject); begin KORVH end; procedureTForm1.Button3Click(Sender: TObject); begin 3DQHO&DSWLRQ ¶GZ`ZlZdghidZ¶%XWWRQ&DSWLRQ end; end.
NZce ijh_dlZ SURMHFWGSU [ue k]_g_jbjh\Zg 'HOSKL iheghklvx kZfhklhy l_evgh
10
Application.CreateForm(TForm1, Form1); Application.Run;
Ijb bamq_gbb wlbo nZceh\ \hagbdZxl ^\Z \hijhkZ: dm^Z bkq_aeb \\_ ^_ggu_ gZfb agZq_gby k\hckl\ dhfihg_glh\ gZijbf_j aZ]heh\db dghihd KlZjl, bj_dlb\Z {$R *.DFM}aZklZ\ey_ldhfibey lhjqblZlvwlhlnZcedhfibebjh\Zlvb\dexqZlv\bkihegy_fucfh^mevL_d klh\h_ ij_^klZ\e_gb_ nZceZ *.dfm fh`gh m\b^_lv gZ`Z\ deZ\brb Alt+F12.) NhjfZ y\ey_lky \eZ^_evp_f (Owner) jZaf_s_gguo gZ g_cdhfihg_glh\<eZ^_ e_pihke_k\h_]hkha^ZgbyZ\lhfZlbq_kdb\uau\Z_ldhgkljmdlhjujZaf_s_gguo gZ g_f h[t_dlh\ Z i_j_^ k\hbf mgbqlh`_gb_f – bo ^_kljmdlhju Kha^Zgb_ ]eZ\ghc nhjfu \uihegy_lky \ fh^me_ ijh_dlZ \uah\hf dhgkljmdlhjZ h[t_dlZ Application.CreateForm(TForm1, Form1). AZf_qZgb_ihoh^mjZ[hlu: Qlh[um^Zeblvhrb[hqghjZaf_s_ggucdhfihg_glgm`ghmdZaZlvgZg_]h furvxbgZ`ZlvdeZ\brmDelete. Ijbwlhf[m^mlm^Ze_gub\k_h[jZ[hlqbdb kh[ulbc ^Zggh]h dhfihg_glZ G_ m^Zeycl_ h[jZ[hlqbdb ©\jmqgmxª ?keb [ue kha^Zg©ebrgbcªh[jZ[hlqbdgZ^hm^Zeblv_]hkh^_j`bfh_f_`^mbegin bend, bDelphi kZfZijbihke_^mxs_cdhfibeypbbm^Zeblimklhch[jZ[hlqbdJZamf_ _lkyihke_^kl\byjmqgh]hm^Ze_gbyihijZ\bfugh^eywlh]hey dhfihg_glZ Edit hqbklbl_ agZq_gb_ k\hckl\Z Text \ wlhf k\hckl\_ lbiZString[m^_lkh^_j`Zlvky\\_^_ggZykljhdZ >h[Z\vl_gZnhjfmdghidm-\udexqZl_evCheckBoxb]jmiimjZ^bhdgh ihd RadioGroup Wlb dghidb bkihevamxlky ^ey mklZgh\db jZaebqguo neZ]h\ b j_`bfh\ \uiheg_gby aZ^Zqb Dghidb-\udexqZl_eb fh]ml i_j_dexqZlvky g_aZ \bkbfh^jm]hl^jm]ZZ\]jmii_jZ^bhdghihd\dexq_gghcfh`_l[ulvlhevdh
11
h^gZbagboAZ^Z^bf^eyCheckBoxagZq_gb_k\hckl\ZCaption - =jZ^mkuZj]m f_gl kbgmkZ baf_jy_lky \ ]jZ^mkZo Z _keb dghidZ \udexq_gZ lh \ jZ^bZgZo >ey ijh\_jdb khklhygby dghidb-\udexqZl_ey bkihevam_lky k\hckl\h Checked: Boolean\ha\jZsZxs__True_kebdghidZ\dexq_gZihf_q_gZ bFalse\ijh lb\ghfkemqZ_ 5. >ey aZg_k_gby dghihd \ ]jmiim jZ^bhdghihd gZ`f_f ©ª gZijhlb\ k\hckl\Z Items dhfihg_glZ RadioGroup1 < jZkdju\r_fky^bZeh]h\hfhdg_aZ ibr_fgZbf_gh\ZgbyjZ^bhdghihd\ljbkljhqdbsin cos tg . <k\hckl\h CaptionaZibr_fNmgdpby. Khklhygb_ ]jmiiu jZ^bhdghihd ijh\_jy_lky k ihfhsvx __ k\hckl\Z ItemIndex lbiZ Integer ?keb ItemIndexjZ\_glh\dexq_gZi_j\Zyihihjy^dm dghidZ_keblh-ybl^?keb-lhgbh^gZbadghihdg_\dexq_gZ NhjfZijbf_l\b^
6 Hldhfibebjmcl_ ijbeh`_gb_ M[_^bl_kv qlh k ihfhsvx Edit fh`gh \\h^blv b j_^Zdlbjh\Zlv kljhdb H^gZdh ihdZ gbdZdbo ^_ckl\bc k \\_^_gghc kljhdhcg_\uihegy_lky Qlh[u\uqbke_gbygZ^\\_^_gghckljhdhc\uihegyebkvkha^Zcl_ke_ ^mxsb_h[jZ[hlqbdbkh[ulbc. >ey kh[ulby OnClick dghidb Button1: procedure TForm1.Button1Click(Sender: TObject); var x: real; //<\_^_ggh_agZq_gb_ code: integer; Dh^\ha\jZlZhi_jZpbbij_h[jZah\Zgby kljhdZ-qbkeh s: string; begin val(Edit1.text,x,code); //Ij_h[jZah\Zgb_kljhdZ-qbkeh if CheckBox1.Checked then x:=pi*x/180.0; // I_j_\h^\jZ^bZgu case RadioGroup1.ItemIndex of //
>eykh[ulbyOnClick dghidbButton2: procedure TForm1.Button2Click(Sender: TObject); begin Close; end;
12
Hldhfibebjmcl_b\uihegbl_ijh_dl J_amevlZl_]hjZ[hlu[m^_lbf_lv ke_^mxsbc\b^
Fh^bnbpbjm_f ijh_dl >ey \u^_e_ggh]h dhfihg_glZ Edit1 gZc^bl_ \ bgki_dlhj_ h[t_dlh\ kh[ulb_ OnChange \hagbdZxs__ ijb baf_g_gbb l_dklZ \gmljbTEditjZkdjhcl_dhf[bgbjh\ZgguckibkhdgZijhlb\OnChangeb\u[_ jbl_\g_fm`_kha^Zgguch[jZ[hlqbdkh[ulbcButton1ClickL_i_jvwlZijhp_ ^mjZ[m^_l\uau\ZlvkyijbgZklmie_gbbkh[ulbyOnChangeke_^h\Zl_evgh\u qbke_gby[m^mlijhbkoh^blvkbgojhgghk\\h^bfufl_dklhfM[_^bl_kv\wlhf \uihegb\ijh_dl AZ^Zgby. >hjZ[hlZcl_ijh_dlij_^mkfhlj_\h[jZ[hldmhrb[hdijb\\h^_ Zj]mf_glZ GZc^bl_ gZ iZeblj_ dhfihg_glh\ b bkihevamcl_ ^jm]b_ kj_^kl\Z ijb]h^gu_^ey\\h^Z^Zgguo EZ[hjZlhjgZyjZ[hlZ L_fZDeZkkTStrings DeZkk TStrings – h^bg ba hkgh\hiheZ]Zxsbo deZkkh\ \ Delphi. JZ[hlZ hq_gv fgh]bo dhfihg_glh\ ihkljh_gZ gZ bf_xs_fky \ bo khklZ\_ k\hckl\_ deZkkZ TStrings. GZijbf_j wlh k\hckl\h Items m ListBox b RadioGroup, Lines m Memo b l^ b li DeZkk TStrings ijbf_gy_lky ^ey ojZg_gby ex[uo h[t_dlh\ gZke_^gbdh\ deZkkZ TObject b k\yaZgguo k gbfb l_dklh\uo kljhd K\hckl\Z deZkkZTStringsgZau\ZxlkygZ[hjZfbkljhd TStrings –Z[kljZdlgucdeZkkH[jZlblvkydg_fmfh`ghebrvijb©ih kj_^gbq_kl\_ªkhhl\_lkl\mxs_]hdhfihg_glZ?kebg_h[oh^bfhkha^Zlvwda_f ieyjdeZkkZTStrings \g_dhfihg_glh\bkihevamcl_h[t_dl-ihlhfhdTStringList, gZke_^mxsbck\hckl\Zbf_lh^uTStrings. GZijbf_j var SL: TStringList; begin 6/ 76WULQJ/LVWFUHDWHGhg_6/ 76WULQJFUHDWH 6/DGGµKljhdZ¶ … end;
DkljhdZfbh[t_dlZfojZgysbfky\TStrings, fh`ghh[jZlblvkykihfh svxbg^_dkbjh\Zgguok\hckl\ property Strings[i: integer]: string; default; property Object [i: integer]: TObject;
:ljb[mldefault hagZqZ_lqlhbfybg^_dkbjh\Zggh]hk\hckl\Zfh`_l[ulv hims_ghgZijbf_jke_^mxsb_h[jZs_gbyjZ\ghagZqgu: /LVW%R[LWHPVVWULQJV>@ ¶KljhdZ¶
13
ListBoxLWHPV>@ ¶KljhdZ¶ >eyijh]jZffbklZk\hckl\hlbiZTStrings\u]ey^bldZdh[uqgucfZkkb\ kljhdghbg^_dk\lZdhffZkkb\_gZoh^blky\^bZiZahg_p_euoqbk_e- 32767. Ijbf_j Items[0]:=’text1’ - aZibkZlv kljhdm \ -c we_f_gl gZ[hjZ kljhd Items[1]:=’text2’ - \h \lhjhc we_f_gl b l^ H[s__ qbkeh kljhd fh`gh hij_^_ eblvh[jZlb\rbkvdk\hckl\mCountlbiinteger deZkkZTStrings. DeZkk TStrings lZd`_ ijbf_gy_lky ^ey ojZg_gby iZj \b^Z ©iZjZf_ljagZq_gb_ªIjbql_gbbaZibkb k\hckl\Z property Values[const Name: string]: string;
bs_lkykljhdZkh^_j`ZsZy ih^kljhdm\b^ZName=agZq_gb_ b\ha\jZsZ _lkyaZibku\Z_lky agZq_gb_ihke_kbf\heZ= .GZijbf_j ListBox1.Items.Values[‘y’]:=1; ijb\_^_ldihy\e_gbx\kibkd_kljhdby=1. >jm]b_k\hckl\Zbf_lh^udeZkkZTStrings: property Count: inteQbkehiZjkljhdbh[t_dlh\ ger; function Add(const S: string): integer;
function AddObject(const S: string; AObject: Tobject): integer; procedure AddStrings (Strings: TStrings); procedure InsertObject (I: integer; const S: string; AObject: TObject); procedure Delete (I: integer); function IndexOf (const S: string): integer; function Equals (Strings: TStrings): boolean; procedure Move(I1,I2:integer); procedure Exchange (I1,I2: integer); procedure LoadFromFile (const FileName: string); procedure SaveToFile (const FileName: string);
>h[Z\ey_lkljhdm\dhg_pgZ[hjZb\ha\jZ sZ_lijbk\h_gguc_cghf_j >h[Z\ey_l kljhdm b h[t_dl h[Z\ey_l \ dhg_p gZ[hjZ ^jm]hc gZ[hj TSrings.
JZkkfhljbfke_^mxsbcijbf_jKha^Z^bfijbeh`_gb_\dhlhjhf\u [jZggu_dghidb©ijyqmlkyª\kibkd_ListBoxZ ijb\u[hj_bobakibkdZihy\ eyxlkygZij_`g_ff_kl_>hklmidkh^_j`bfhfmkibkdZijhbkoh^blq_j_a
14
k\hckl\hItems lbiZTStrins. Ihjy^dh\ucghf_j\u[jZggh]hwe_f_glZkibkdZ fh`ghmagZlvkihfhsvxk\hckl\ZItemIndex dhfihg_glZListBox.Gmf_jZpby gZqbgZ_lkykgmey JZaf_klbl_gZnhjf_ljbdghidbButton1, Button3, Button3, kljhdmLabel bkibkhdListBox1, dZdwlhihdZaZghgZjbkmgd_
Kha^Zcl_h[jZ[hlqbdkh[ulbyOnClick^eydghidbButton1: procedure TForm1.Button1Click(Sender: TObject); begin (Sender as TControl).visible := False; ListBox1.Items.AddObject((Sender as TButton).caption, Sender); end;
F_lh^AddObject^h[Z\ey_l\kibkhdbaZ]heh\hddghidbbkZfmdghidm K\hckl\hVisible iha\hey_lkdju\Zlvwe_f_glg_mgbqlh`Zy_]h 3. GZagZqvl_wlhlh[jZ[hlqbdZgZeh]bqgufkh[ulbyf^jm]bodghihddZd wlh^_eZehkv\iij_^u^ms_ceZ[jZ[hlu Dhff_glZjbc IZjZf_lj Sender lbiZ TObject hibkZg \ aZ]heh\dZo ijhp_ ^mj-h[jZ[hlqbdh\kh[ulbcQ_j_awlhliZjZf_lji_j_^Z_lkykkuedZgZh[t_dlbklhqgbd kh[ulby LZd dZd Sender hlghkblky d deZkkm TObject - Z[kljZdlghfm deZkkmgZ\_jomb_jZjobbdhfihg_glh\'HOSKLlh\ijhp_^mjmfh`_l[ulvi_j_ ^Zgex[hcdhfihg_gl[m^mqbgZke_^gbdhfTObjecthglh`_TObject IZjZf_lj Sender h[uqgh b]ghjbjmxl gh _]h g_h[oh^bfh bkihevah\Zlv dh]^Z g_kdhevdh dhfihg_glh\h[jZsZxlkydh^ghfmblhfm`_h[jZ[hlqbdmkh[ulbcdZd\^Zg ghfijbf_j_Lh]^ZSenderiha\hey_lmagZlvdlhdhgdj_lghwlhlh[jZ[hlqbd\u a\Ze Hi_jZlhj as \ijbf_j_khh[sZ_ldhfibeylhjmqlhh[t_dlSenderke_^m_l jZkkfZljb\ZlvdZdijbgZ^e_`ZsbcdeZkkm©dghidZª Kha^Zcl_h[jZ[hlqbd^eykh[ulbyOnClick h[t_dlZListBox1: procedure TForm1.ListBox1Click(Sender: TObject); begin with ListBox1 do begin (Items.Objects[ItemIndex] as TButton).visible := true; Items.Delete(ItemIndex); end; end;
Ijb\uiheg_gbbijh]jZffZ[m^_lbf_lvke_^mxsbc\b^
15
AZ^Zgb_: baf_gbl_ijh]jZffmqlh[u\kibkhdfh`gh[uehaZghkblvjZa ghjh^gu_we_f_glu:dghidbiZg_ebb^j;he__ih^jh[gmxbgnhjfZpbxh[bk ihevah\Zgbbhi_jZlhjh\is bas fh`ghihemqblv\[7]. EZ[hjZlhjgZyjZ[hlZ L_fZKibkdbbdhf[bgbjh\Zggu_kibkdbIhehkuijhdjmldb Kibkdbdhfihg_glListBox bkihevamxlky^ey\u[hjZwe_f_glZdhf[bgb jh\Zggu_ kibkdb ComboBox fh]ml ^hihegbl_evgh hlj_^Zdlbjh\Zlv wlhl \u [jZggucwe_f_glq_j_ak\hckl\hText. GZibrbl_kZfhklhyl_evghijbf_jiha\heyxsbc\u[bjZlvbakibkdZ(bba dhf[bgbjh\Zggh]h kibkdZ p\_l nhjfu >ey baf_g_gby p\_lZ nhjfu gZ^haZ ^Zlvk\hckl\hnhjfuColor: TColor. >hklmigu_p\_lh\u_dhgklZglufh`ghih kfhlj_lv\k\hckl\_Color \bgki_dlhj_h[t_dlh\ Ijbf_jgucwkdbanhjfu:
GZibrbl_ ijbf_j \ dhlhjhf p\_l nhjfu aZ^Z_lky k bkihevah\Zgb_f nmgdpbbRGB: function RGB (R,G,B: byte): TColor; A^_kvR,G,B – agZq_gbybgl_gkb\ghkl_cdjZkghca_e_ghcbkbg_ckhklZ\ eyxs_c p\_lZ >ey ieZ\gh]h baf_g_gby bgl_gkb\ghkl_c bkihevamcl_ ljb dhf ihg_glZScrollBar (ihehkZijhdjmldb)K\hckl\Zmin, max: integer kh^_j`ZlgZ qZevgh_ b dhg_qgh_ agZq_gb_ iheh`_gby [_]mgdZ K\hckl\h Position – l_dms__ iheh`_gb_ [_]mgdZ P\_l ^he`_g baf_gblvky ijb gZklmie_gbb kh[ulby OnChange dhfihg_glZScrollBar\aZ\bkbfhklbhlagZq_gbyPosition. EZ[hjZlhjgZyjZ[hlZ5 L_fZKha^Zgb_ijbeh`_gbckg_kdhevdbfbnhjfZfb >hjZ[hlZ_f ij_^u^msmx ijh]jZffm lZd qlh[u ijb gZ`Zlbb dghidb gZ wdjZg_ihy\behkv^hihegbl_evgh_hdgh
16
JZaf_klbf_s_h^gmdghidmButton3kaZ]heh\dhfHijh]jZff_ hibrbl_\kibkhdfh^me_c\gZ qZe_ fh^mey Unit1 hkgh\ghc nhjfu \ ^bj_dlb\_ Uses _s_ h^bg - _eh\lhfqlhnhjfZaZ dju\Z_lky dh]^Z __ h^ghbf_ggh_ k\hckl\h ModalResult ijbgbfZ_l g_gme_\h_ agZq_gb_ Z ijb gZ`Zlbb dghidb Z\lhfZlbq_kdb ijhbkoh^bl ijbk\Zb\Zgb_ Form.ModalResult:=Button.ModalResult. AZf_lbf qlh \ bkihevah\Zgguo
17
ihevah\Zl_evbkihevah\Ze^ey__aZdjulbygZijbf_jdghidmOKbebCancel. Ihke_^g__e_]dhk^_eZlvldf_lh^ShowModaljZ[hlZ_ldZdnmgdpby\ha\jZ sZyagZq_gb_k\hckl\ZModalResultaZdju\Zxs_cdghidbIjbf_jgucnjZ]f_gl dh^Z^ey\uah\Z^bZeh]h\h]hhdgZbf__l\b^ if Form2.ShowModal =mrOk then begin Val (Form2.Edi1.Text, x, code); ... end;
h[Z\vl_ dhfihg_gl Memoj_^Zdlhjl_dklZ baZ^Zcl__]hk\hckl\hAlign\ujZ\gb\Zgb_ \alBottom . MklZgh\bl_aZ]heh\hdnhjfu- ;ehdghl. Memo ij_^klZ\ey_l kh[hc fgh]hkljhqguc j_^Zdlhj l_dklZ Kh^_j`bfh_ j_^ZdlhjZ ojZgblky \ k\hckl\_ Lines Wlh - k\hckl\h deZkkZ TStrings gZ[hj kljhd AZ^Zcl_k\hckl\Zdhfihg_glh\^ey\u[hjZbf_gnZceh\ Dhfihg_glOpenDialog: K\hckl\h AgZq_gb_ Dhff_glZjbc DefaultExt txt JZkrbj_gb_bf_gbnZceZihmfheqZgbx Title Hldjulb_l_dklh\h]hnZceZ Options.OfFileMustExist true Hldju\Z_fucnZce^he`_gkms_kl\h\Zlv Filter baZcg_jf_gxs_edgm\^\ZjZaZihagZqdmMainMenu<>b aZcg_j_kha^Zcl_imgdlu]hjbahglZevgh]hf_gxFaZ]heh\dZfb)LOHb+HOSbgZ
18
a\Zgbyfbk\hckl\hName) File1, Help1Kha^Zcl_gbkiZ^Zxsb_f_gx^eyimgd lZFile - Open, Save, SaveAs, ExitbimgdlZHelp - AboutklZdbfb`_agZq_gbyfb Name. Ihf_klbl_ih^ihehkhcf_gxPanelbjZkiheh`bl_gZg_cljbdghidb [ukljh]h ^hklmiZ SpeedButton IZg_ev y\ey_lky dhgl_cg_jhf ^ey jZaf_s_g guo gZ g_c dhfihg_glh\ ihwlhfm dghidb [m^ml i_j_f_sZlvky \f_kl_ k iZg_ evx
Kha^Zcl_h[jZ[hlqbdbkh[ulbc\u[hjZimgdlZf_gxs_edgm\^\ZjZaZ ihimgdlmf_gx procedure TForm1.OpenClick(Sender: TObject); begin with OpenDialog1 do if Execute then begin F_lh^([HFXWHaZimkdZ_l^bZeh]b\ha\jZsZ_l7UXH_keb // ^ey\uoh^Zba^bZeh]Z[ueZgZ`ZlZdghidZ2.l_nZce[ue // \u[jZg Memo1.Lines.LoadFromFile(FileName);//AZ]jm`Z_l\l_dklh\uc j_^ZdlhjnZcekaZ^Zggufbf_g_f HistoryList.Add(FileName);//>h[Z\ey_lbfynZceZ\©bklhjbxª &DSWLRQ ¶;ehdghl-’+ExtractFileName (FileName); //Nmgdpby ([WUDFW)LOH1DPH\ha\jZsZ_lbfynZceZ[_aimlbdhlhjh_ aZl_fhlh[jZ`Z_lky\aZ]heh\d_nhjfu SaveDialog1.FileName:=FileName; //AZihfbgZ_lkybfy // hldjulh]hnZceZ end; end; procedure TForm1.SaveClick(Sender: TObject); begin if OpenDialog1.FileName<>’’ then //?kebbfyg_imklhlhbkihevah\Zlv_]h^eykhojZg_gbynZceZ Memo1.Lines.SaveToFile(SaveDialog1.FileName) else //bgZq_\ua\Zlvh[jZ[hlqbdKhojZgblvDZd SaveAsClick(Sender); end; procedure TForm1.SaveAsClick(Sender: TObject);
19
begin with SaveDialog1 do if Execute then begin Memo1.lines.SaveToFile(FileName); &DSWLRQ ¶;ehdghl-’+ ExtractFileName(File Name); end; end; procedure TForm1.AboutClick(Sender: TObject); begin 0HVVDJH'OJµ;ehdghlY¶PW,QIRUPDWLRQ>PE2.@ end;
AZimklbl_ >baZcg_j ^ey \kieu\Zxs_]h f_gx s_edgm\ ^\Z jZaZ ih agZqdmPopUpMenu<>baZcg_j_f_gx\\_^bl_imgdluRjbnlbP\_lkbf_ gZfbFont1bColor1khhl\_lkl\_gghbkh[jZ[hlqbdZfbkh[ulby\u[hjZimgdlZ f_gx procedure TForm1.Font1Click(Sender: TObject); begin If FontDialog1.Execute then
ey ijb\yadb _]hddhfihg_glmMemo1 mklZgh\bl_k\hckl\hPopUpMenu^eyMemo1jZ\gh_ PopUpMenu1 (PopUpMenu1 -bfykha^Zggh]hdhfihg_glZPopUpMenu). H[jZ[hlqbdb kh[ulbc ^ey dghihd [ukljh]h ^hklmiZ k^_eZcl_ lZdbfb `_dZdb\]eZ\ghff_gxih^klZ\b\\bgki_dlhj_h[t_dlh\\dZq_kl\_OnClick ^eyi_j\hcdghidb- OpenClick^ey\lhjhc- SaveClick^eylj_lv_c- ExitClick. EZ[hjZlhjgZyjZ[hlZ7 L_fZLZ[ebqguc\\h^-\u\h^ >eyij_^klZ\e_gby\oh^guobeb\uoh^guo^Zgguo\\b^_lZ[ebp\Delphi fh`_lbkihevah\Zlvkydhfihg_glTStringGrid -lZ[ebpZkhklhysZybai_j_f_g guolbiZStringHkgh\gufbk\hckl\Zfby\eyxlkyColCount -qbkehklhe[ph\\ lZ[ebp_bRowCount -qbkehkljhd>ey^hklmiZdyq_cdZflZ[ebpuij_^gZagZ
20
q_ghbg^_dkbjh\Zggh_k\hckl\hCellsh[jZs_gb_ddhlhjhfmijhbkoh^bldZdd ^\mf_jghfmfZkkb\m DZdgbkljZgghi_j\ucbg^_dkmCells -ghf_jklhe[pZZ\lhjhc-ghf_j kljhdbqlhhlebqZ_lkyhlh[s_ijbgylhcfZl_fZlbq_kdhcljZ^bpbbIhwlhfm Z\lhjijbghkblba\bg_gbyaZi_j_klZ\e_ggu_bg^_dku\gb`_ke_^mxs_fnjZ] f_gl_dh^Z <dZq_kl\_ijbf_jZgZibr_fijh]jZffm^eymfgh`_gby^\mofZljbp JZaf_klbl_gZnhjf_ljbdhfihg_glZTStringGridbmklZgh\bl_bok\hc kl\hName\A,B,Ckhhl\_lkl\_gghLZ[ebpZC[m^_lkh^_j`Zlvj_amevlZlmfgh `_gby>ey\k_olZ[ebpmklZgh\bl_\bgki_dlhj_h[t_dlh\agZq_gbyk\hckl\ ColCountbRowCountjZ\gu_FixedRows - 0, FixedCols=0, Options.GoEditing True>h[Z\vl_LabelkgZ^ibkvxX , ButtonkgZ^ibkvx kfjbk , Edit1Ijb baf_g_gbbkh^_j`bfh]hEdit1 jZaf_jghklbfZljbp^he`gukhhl\_lkl\_gghba f_gylvky
GZibrbl_h[jZ[hlqbdbkh[ulbcOnClick b OnChange procedure TForm1.Button1Click(Sender: TObject); var i,j,k,n, Sum: integer; begin n:=A.ColCount-1; for i:=0 to n do for j:=0 to n do begin Sum := 0; for k:=0 to n do Sum:=Sum+StrToInt(A.Cells[k,i])*StrToInt(B.Cells[j,k]); KKHOOs[j,i]:=IntToStr(Sum); end; end; procedure TForm1.Edit1Change(Sender: TObject); var i: integer; begin try i:=StrToInt(Edit1.text); if i > 0 then begin a.colcount:=i; a.rowcount:=i; b.colcount:=i; b.rowcount:=i; c.colcount:=i; c.rowcount:=i; end; except 6KRZ0HVVDJH G_ijZ\bevguc\\h^ end; end;
21
AZ^Zgb_: i_j_^_eZcl_ijbf_jlZdqlh[ufZljbpukha^Z\Zebkv\ijhp_kk_ \uiheg_gbyijh]jZffu^bgZfbq_kdb\khhl\_lkl\bbk\\_^_gghcjZaf_jghklvx kfke_^mxsmxeZ[jZ[hlm EZ[hjZlhjgZyjZ[hlZ L_fZ>bgZfbq_kdh_kha^Zgb_bgl_jn_ckguowe_f_glh\ Bgl_jn_ckgu_we_f_gludghidbf_gxbli fh`ghkha^Z\Zlvg_lhevdh \bamZevgh gZ wlZi_ ijh_dlbjh\Zgby gh b \ ijhp_kk_ jZ[hlu ijh]jZffu ^b gZfbq_kdb >eywlh]hihlj_[m_lkybkihevah\Zlvf_lh^dhgkljmdlhjdeZkkZwlh ]hbgl_jn_ckgh]hwe_f_glZIjh^_eZcl_ke_^mxsb_^_ckl\by P_ev-ijbgZ`Zlbbg_dhlhjhcdghidbkha^Zlv\lhjmxdghidmkgZa\Zgb_f ©Ijb\_lªKha^Zcl_gh\ucijh_dlbjZaf_klbl_gZg_fh^gmdghidmkaZ]heh\dhf ©Kha^Zlvª<h[jZ[hlqbdkh[ulbys_eqdZwlhcdghidbaZibrbl_ procedure TForm1.Button1Click(Sender: TObject); begin ^Wda_fieyjgh\hcdghidbkha^Z_lkyf_lh^hf-dhgkljmdlhjhf&UeDWH:^j_kwda_fieyjZaZghkblky\i_j_f_ggmx0\%XWWRQ:j]mf_glhf &UHDWHy\ey_lkydhfihg_gl-\eZ^_e_pdghidbl_nhjfZ` MyButton := TButton.Create(Form1); >Ze__mdZau\Z_lkyf_klhgZoh`^_gb_dghidb MyButton.Parent := Form1; MyButton.Left := 60; // JZkklhygb_hle_\h]hdjZynhjfu MyButton.Top := 15; JZkklhygb_hl\_jog_]hdjZynhjfu` 0\%XWWRQ&DSWLRQ µIjb\_l¶ end;
KZfm i_j_f_ggmx deZkkZ TButton h[ty\bl_ dZd ]eh[Zevgmx \ k_dpbb Implementationfh^mey var MyButton: TButton;
Dhff_glZjbc DZ`^uc dhfihg_gl bf__l \h-i_j\uo ij_^dZ m dhlhjh]h hggZke_^m_lk\hckl\Zbf_lh^u\h-\lhjuo\eZ^_evpZOwner dhlhjucfh`_l Z\lhfZlbq_kdbkha^Z\Zlvbmgbqlh`Zlv^Zggucdhfihg_gl\uau\Z_l_]hdhgkl jmdlhju b ^_kljmdlhju ijb k\h_f kha^Zgbb b mgbqlh`_gbb \-lj_lvbo jh^b l_evkdbcdhfihg_glParent gZdhlhjhf^Zggucdhfihg_gljZkiheh`_g\bam ZevghIjb^bgZfbq_kdhfkha^Zgbbg_h[oh^bfhaZ^Z\Zlvbfy\eZ^_evpZOwner iZjZf_ljhf f_lh^Z Create b bfy jh^bl_ey \ k\hckl\_ Parent dhfihg_glZ qlh \ur_ b [ueh k^_eZgh <eZ^_evp_f dhfihg_glh\ h[uqgh y\ey_lky nhjfZ Z jh ^bl_eyfbfh]ml[ulvnhjfuiZg_ebb]jmiiu AZf_lvl_qlhf_lh^^_kljmdlhjFree^eymgbqlh`_gbydghidba^_kvg_bk ihevah\ZekyDghidmmgbqlh`bl\eZ^_e_p-nhjfZ©\f_kl_kkh[hcª?keb`_lj_ [m_lky mgbqlh`blv dghidm jZgvr_ ^h aZdjulby nhjfu fh`gh ihklmiblv ke_ ^mxsbfh[jZahfIj_^mkfhljbl_gZijbf_j_s_h^gmdghidmkgZ^ibkvxM^Z eblvb\h[jZ[hlqbdkh[ulbyOnClick^eyg__aZg_kbl_kljhdm MyButton.Free; EZ[hjZlhjgZyjZ[hlZ
22
L_fZ=jZnbdZ\'HOSKL =jZnbq_kdb_ nmgdpbb h[t_^bg_gu bgdZikmebjh\Zgu \ deZkk_ 7KDQYDV ohekl Bah[jZ`_gbykljhylkykihfhsvxk\hckl\bf_lh^h\TCanvas. K\hckl \h Canvas lbiZ 7KDQYDV _klv m fgh]bo \bamZevguo dhfihg_glh\ gZijbf_j m nhjfu \ bgki_dlhj_ h[t_dlh\ Canvas g_ hlh[jZ`Z_lky d g_fm fh`gh h[jZ lblvkylhevdhijh]jZffgh ?kebmdhfihg_glZg_llZdh]hk\hckl\ZlhgZwlhf dhfihg_gl_ qZklh fh`gh jZaf_klblv dhfihg_gl PaintBox ©jZfdZ ^ey ohe klZª kf kljZgbpm 6\VWHP iZeblju dhfihg_glh\ m dhlhjh]h _klv k\hckl\h Canvas>eyjbkh\ZgbydeZkkCanvas\dexqZ_l k\hckl\Z: Font (rjbnl Peni_ jh bBrushdbklv I_jh oZjZdl_jbam_lky k\hckl\Zfb Color (p\_l), Width (lhesbgZ Style (klbev DbklvoZjZdl_jbam_lkyp\_lhfbklbe_f =jZnbq_kdb_ nmgdpbb LineTo, Rectangle b ^j y\eyxlky f_lh^Zfb TCanvasKijZ\dmihk\hckl\Zfbf_lh^Zf&DQYDVkf\Ijbeh`_gbb <dZq_kl\_ijbf_jZgZjbkm_f]jZnbdy(t)=sin(t). 1. <gh\hfijh_dl_jZaf_klbl_gZnhjf_^\_dghidbdhfihg_glGroupBox bmklZgh\bl_bogZa\ZgbyCaptionlZddZdwlhihdZaZghgZjbk 2. GZGroupBoxjZkiheh`bl_LabelbEditbaZ^Zcl_agZq_gbyk\hckl\ CaptionbTextkhhl\_lkl\_gghjbk JZaf_klbl_ \ gb`g_c qZklb nhjfu Panel gZ iZg_eb jZkiheh`bl_ PaintBoxbmklZgh\bl__]hk\hckl\hAlign\AlClientZk\hckl\hName - PB. Kha^Zcl_h[jZ[hlqbdkh[ulbyOnClick^eydghidbJbkh\Zlv: procedure Tform1.Button1Click(Sender: TObject); var n, code: integer; x, y: real; //Nbabq_kdb_dhhj^bgZlu x0, xk, W, YMax, YMin, dx: real; PW, PH, ix, iy: integer; WdjZggu_dhhj^bgZlu i: integer; begin %XWWRQKXUVRU FU+RXU*ODVV©I_khqgu_qZkuª Val(NtEdit.text, n, code); Qbkehlhq_d Val(WEdit.text, W, code); QZklhlZ Val(InitTEdit.text, x0, code);GZqZehhlkq_lZihhkbo Val(FinalTEdit.text, xk, code);//Dhg_phlkq_lZihhkbo dx:=(xk-x0)/n; //RZ]^bkdj_lbaZpbb YMax:=1; //>bZiZahgbaf_g_gbyihhkb< YMin:=-1; PW:=PB.width;RbjbgZh[eZklbjbkh\Zgby PH:=PB.height;
23
Pen.Style := psSolid; //KiehrgZyebgby I_j_kq_lnbabq_kdbodhhj^bgZl\wdjZggu_^eyi_j\hclhqdb iy := round((sin(w*x0)-YMin)/(YMax-YMin)*PH); MoveTo(0,PH-iy-1); x:=x0; for i:=2 to n do begin x := x + dx; y := sin(w*x); I_j_kq_l^eyihke_^mxsbolhq_d ix := round((x-x0)/(xk-x0)*PW); iy := round((y-ymin)/(ymax-ymin)*PH); LineTo(ix, PH-iy-1); end; end; %XWWRQKXUVRU FU'HIDXOW end;
Ijb\uiheg_gbbijh]jZffuh[jZlbl_\gbfZgb_qlhihke_fbgbfbaZpbb hdgZijh]jZffubebi_j_djulby_]h^jm]bfbhdgZfbbah[jZ`_gb_gZPaintBox ihjlblkyQlh[uwlh]hg_ijhbkoh^behgZc^bl_\bgki_dlhj_h[t_dlh\kh[ulb_ OnPaint ^ey PaintBox1 wlh kh[ulb_ \hagbdZ_l ijb i_j_jbkh\d_ dhfihg_glZ b ijbk\hcl__fmh[jZ[hlqbdkh[ulbyButton1Click. EZ[hjZlhjgZyjZ[hlZ L_fZKha^Zgb_]jZnbq_kdh]hj_^ZdlhjZ GZibrbl_ijhklhc]jZnbq_kdbcj_^Zdlhjiha\heyxsbc\u[bjZlvp\_lb lhesbgmebgbcaZdjZrb\ZlvaZfdgmlu_h[eZklbaZ]jm`ZlvbkhojZgylvbah [jZ`_gb_\nZce_ Bkihevamcl_dhfihg_glImage, mf_xsbcq_j_ak\hckl\hPicture jZ[hlZlvk ]jZnbq_kdbfbnZceZfbgZijbf_j Image.Picture.LoadFromFile(CurrentFile); Jbkh\Zgb_ ijhbkoh^bl \ h[jZ[hlqbdZo kh[ulbchlfurbKh[ulb_i_j_ f_s_gbymdZaZl_eyfurbOnMouseMove bf__llbi type TMouseMoveEvent = procedure(Sender: TObject; Shift: TShiftState; X, Y: Integer) of object, ]^_ iZjZf_lj Shift iha\hey_l magZlv [ueb eb gZ`Zlu ijb i_j_f_s_gbb mdZaZl_ey deZ\brb deZ\bZlmju Shift, Ctrl, Alt beb dghidb furb dhgklZglu
24
ssAlt, SSCtrl, ssShift h[hagZqZxl kblmZpbx gZ`Zlby khhl\_lkl\mxsbo deZ\br dhgklZglussLeft, ssRight, ssMiddle, ssDouble h[hagZqZxlkblmZpbxgZ`ZlbydeZ \brfurbijbq_fssDouble – gZ`ZlbybijZ\hcbe_\hcdghidb iZjZf_lju;b<kh^_j`Zlgh\u_dhhj^bgZlumdZaZl_eyfurb\deb_gl kdhch[eZklbh[t_dlZSender. Kh[ulb_gZ`Zlby/hlimkdZgbydghidbfurb OnMouseDown/OnMouseUp: type TMouseEvent = procedure(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer) of object, ]^_ Button: TMouseButton – b^_glbnbdZlhj dghidb TMouseButton = (mbLeft, mbRight, mbMiddle). EZ[hjZlhjgZyjZ[hlZ L_fZKha^Zgb_kh[kl\_gguodeZkkh\ Baf_gbfijh]jZffmbaeZ[jZ[hluKha^Z^bfdeZkkTGrafik\dexqZx sbc ihey k\hckl\Z b f_lh^u b ijb]h^guc ^ey bah[jZ`_gby ijhba\hevguo nmgdpbc<dZq_kl\_[Zah\h]hdeZkkZg_ihkj_^kl\_ggh]hij_^dZ \u[_j_fdeZkk TPaintBox ih^^_j`b\Zxsbc q_j_a k\hckl\h Canvas hkgh\gu_ ]jZnbq_kdb_ nmgdpbb DeZkk TGrafik [m^_l ^hihegbl_evgh kh^_j`Zlv k\hckl\Z PenColor p\_l ebgbb BrushColor p\_l aZeb\db nhgZ %RUGHU p\_l jZfdb Series bg ^_dkbjh\Zggh_k\hckl\hgZ[hjagZq_gbcihhkbY ihe_Nxqbkehlhq_dihhkb X I_j_hij_^_ebfmgZke_^h\ZgguchlTControlf_lh^SetParentijbdj_ie_gb_ djh^bl_evkdhfm\bamZevghfmdhfihg_glm^h[Z\b\\g_]h\ujZ\gb\Zgb_]jZnb dZih\k_ch[eZklbjh^bl_evkdh]hdhfihg_glZ BlZd^eywlh]hgZ^hijh^_eZlv ke_^mxsb_rZ]b Hldjhcl_gh\ucijh_dl<jZa^_e_j_ZebaZpbbfh^meyihke_kljhd LPSOHPHQWDWLRQb^5 ')0`aZibrbl_h[ty\e_gb_deZkkZ type TGrafik = class(TPaintBox) private Ihey©^eykem`_[gh]hihevah\Zgbyª IF7FRORUP\_lebgbb IEF7FRORUP\_lnhgZ public H[s_^hklmigu_k\hckl\Zbf_lh^u nx: iQWHJHUQbkehlhq_d procedure SetParent(Pn: TWinControl);override; procedure SetColor(c: TColor); procedure SetBColor(c: TColor); procedure SetBorder(c: Tcolor); procedure SetSeries(i: integer; y: real); property Border: TColor write Set%RUGHUP\_ljZfdb property PenColor: TColor read Fc write Setcolor; property BrushColor: TColor read fbc write SetBcolor; property Series[i: integer]: real write SetSeries; end; ^K\hckl\hhibku\Z_lkyke_^mxsbfh[jZahfkem`_[gh_keh\hSURpHUW\aZl_fgZa\Zgb_blbik\hckl\ZIhke_kem`_[guokeh\UHDGb ZULWHaZibku\Zxlkybf_gZf_lh^h\ql_gbybaZibkbk\hckl\Z khhl\_lkl\_gghF_lh^ql_gbyhibku\Z_lkydZdnmgdpby?keb
25
ihlj_[ghklb\ki_pbZevghff_lh^_ql_gbyg_llh\f_klhbf_gb f_lh^Zql_gbymdZau\Z_lkybfyiheyojZgys_]hagZq_gbyk\hckl\Z ?kebk\hckl\hbkihevam_lkylhevdh^eyql_gbybeblhevdh^eyaZibkb lhkhhl\_lkl\mxsbcf_lh^fh`_l[ulvhims_g` procedure TGrafik.SetParent (Pn: TWinControl); begin Inherited SetParent(Pn);//
>ey l_klbjh\Zgby deZkkZ kha^Zcl_ nhjfm kh ke_^mxsbfb bgl_jn_ck gufbwe_f_glZfbdghidZButton1FgZ^ibkvxJbkh\ZlviZg_evPanel1]jmiiZ GroupBox1\dhlhjhcgZoh^ylkyr_klvkljhdj_^Zdlbjh\Zgbykijb]eZr_gbyfb kfjbk
26
Kha^Zcl_h[jZ[hlqbdkh[ulbyOnClick^eydghidbJbkh\ZlvG_ihkj_^ kl\_gghi_j_^h[jZ[hlqbdZfbghihke_hibkZgbcf_lh^h\deZkkZh[ty\bl_i_ j_f_ggmxlbiZTGrafik. var g: TGrafik; procedure TForm1.Button1Click(Sender: TObject); var i,n,code: integer; x,x0,xk,dx,w: real; YMax, YMin: real; function sinc(x: real): real; begin if x<>0 then sinc:=sin(x)/x else sinc:=1; end; begin Val(NtEdit.Text, n, code); Val(WEdit.Text, W, code); Val(InitTEdit.Text, x0, code); Val(FinalTEdit.Text, xk, code); Val(MaxEdit.Text, Ymax, code); Val(MinEdit.Text, Ymin, code); dx:=(xk-x0)/n; with g do begin //H[jZs_gb_d]jZnbdma^_kvijhbkoh^blq_j_ak\hckl\Z nx:=n; BrushColor:=clWhite; Border:=clRed; PenColor:=clRed; x:=x0; for i:=1 to n do begin x:=x+dx; Series[i]:=(sinc(w*x)-YMin)/(YMax-YMin); end; end; end; procedure TForm1.FormCreate(Sender: TObject); begin Kha^Zgb_wda_fieyjZdeZkkZ7*UDILNbijb\yadZ_]hdiZg_eb g:=TGrafik.create(Form1); <eZ^_e_p– Form1 g.SetParent(Form1.Panel1); Jh^bl_ev– Panel1
27
//Ij_^hd- PaintBox g.OnPaint:=Button1Click; ^Kh[ulbxi_j_jbkh\db]jZnbdZ gZagZqZ_lkyh[jZ[hlqbd%XWWRQ&OLFN` Form1.WEdit.OnChange:=g.OnPaint; // Ijbbaf_g_gbbqZklhlu]jZnbd[m^_lkjZami_j_jbkh\Zg end;
AZ^Zgby: Fh^bnbpbjmcl_deZkkTGrafik^h[Z\b\\g_]hdhhj^bgZlgmxk_ldmbih^ ibkbagZq_gbcihhkyfb\\_^yk\hckl\h©lbi]jZnbdZªbaf_g_gb_dhlhjh]hi_ j_jbkh\u\Z_l]jZnbd\\b^_klhe[bdh\hc^bZ]jZffu>h[Z\vl_k\hckl\hmklZ gh\dZdhlhjh]h\Trueijb\h^bldZ\lhfZlbq_kdhfmfZkrlZ[bjh\Zgbx]jZnbdZ ihjZaf_jmjZfdbIj_^mkfhljbl_\hafh`ghklv^bZeh]h\h]hbaf_g_gbyp\_lZb nhgZjbkmgdZkihfhsvxdhfihg_glZColorDialog. EZ[hjZlhjgZyjZ[hlZH[jZs_gb_dnmgdpbyfAPI. <dhg_qghfblh]_\u\h^bgnhjfZpbbgZwdjZg \kj_^_Windowsijhbkoh ^blkihfhsvxnmgdpbcGDI (Graphics Device Interfacebgl_jn_ck]jZnbq_kdbo mkljhckl\).NmgdpbbGDI y\eyxlkyqZklvxAPI (Application Programming Interfacebgl_jn_ckijbdeZ^gh]hijh]jZffbjh\Zgby) Windowsb^hklmigubaijb deZ^guoijh]jZffgZibkZgguogZex[uoyaudZo. <Delphi g_h[oh^bfhklvh[jZs_gbydnmgdpbyfGDI \hagbdZ_lkjZ\gb l_evghj_^dh JZkkfhlj_ggucgZfbdeZkkTCanvas y\ey_lky ihkmlbm^h[ghc h[t_dlgh-hjb_glbjh\ZgghcgZ^kljhcdhcgZ^dhgl_dklhf]jZnbq_kdh]hmkl jhckl\Z WindowsbgdZikmebjmxs_ciZjZf_ljudhgl_dklZb[hevrbgkl\hgh g_\k_!) nmgdpbbGDI.Dhgl_dkl]jZnbq_kdh]hmkljhckl\Z -wlhklZg^Zjlguc ^ey WindowsgZ[hjiZjZf_ljh\oZjZdl_jbamxsbo\bjlmZevgh_]jZnbq_kdh_mkl jhckl\hi_jhdbklvrjbnlkbkl_fZdhhj^bgZlb^j JZ[hlZkdhgl_dklhf kljhblkyihko_f_ [3]: ihemqblvdhgl_dkl^eyhdgZbeb^jm]hch[eZklbjbkh\Zgby; \u\_klbbgnhjfZpbx; hk\h[h^blvdhgl_dkl; Wlb^_ckl\byh[uqgh\klZ\eyxl\ijhp_^mjmh[jZ[hldbkhh[s_gby wm_PaintihkueZ_fh]hy^jhfWindows bbgnhjfbjmxs_]hijh]jZffmhg_h[ oh^bfhklbi_j_jbkh\dbhdgZIhke_ihemq_gbydhgl_dklZijh]jZff_klZgh\blky ^hklmi_g^_kdjbilhjdhgl_dklZ-i_j_f_ggZykh^_j`ZsZykkuedmgZdhgl_dkl >_kdjbilhjaZl_fi_j_^Z_lky\kibkd_Zj]mf_glh\\uau\Z_fuf]jZnbq_kdbf nmgdpbyfAPI. Ijb\u\h^_bgnhjfZpbbkh[ex^Z_lkyke_^mxsZyihke_^h\Zl_evghklv ^_ckl\bc^eydZ`^h]hbkihevam_fh]hbgkljmf_glZ_kebdhg_qghg_^hklZlhqgh klZg^ZjlguoijbgyluoihmfheqZgbxi_jZdbklbrjbnlZ : kha^Zlvbgkljmf_gl (bkihevamygZijbf_jnmgdpbbCreatePen, CreateSolidBrush, CreateFontIndirect); \klZ\blv\dhgl_dkl (nmgdpbySelect); bkihevah\Zlvdhgl_dkl;
28
\hkklZgh\blvgZqZevguc\ZjbZgldhgl_dklZ(nmgdpbySelect); m^Zeblvbgkljmf_glnmgdpbyDelete); DeZkkTCanvas bf__lk\hckl\hHandle: hDCkihfhsvxdhlhjh]he_]dh fh`ghmagZlv^_kdjbilhjh[eZklbjbkh\ZgbyIhwlhfmihemqZlvdhgl_dkly\gh \uau\Zyijhp_^mjmGetDcg_lg_h[oh^bfhklb JZkkfhljbff_lh^bdmh[jZs_gbydnmgdpbyfAPI baijh]jZffugZDelphiI_j_njZabjmyijbf_jbadgb]b[3]kha^Z^bfijbeh`_gb_ij_^klZ\e_ggh_ gZjbkmgd_
h[Z\vl_\k_dpbxuses \uah\fh^meyWinProcskh^_j`Zs_]hbgl_jn_cku dnmgdpbyfAPI.Kha^Zcl_h[jZ[hlqbdkh[ulbyOnPaintnhjfu procedure TForm1.FormPaint(Sender: TObject); var s: string; OI7ORJ)RQWAZibkvOIkh^_j`bljZaebqgu_iZjZf_ljurjbnlZ p: PPoint; k: integer; IQWIQW2OG)QW2OG)QW+)RQW>_kdjbilhjurjbnlZ begin V
G_emqrZy\fbj_kbkl_fZijh]jZffbjh\Zgby with lf do begin lfhHLJKW eydZ`^hc[md\uk\hcgZdehg begin Mjh\_gvgZdehgZrjbnlZd]hjbahglZevghchkb\^_kyluo ^heyo]jZ^mkZ LF.lfEscapement := -(k-1)*Round(3600/length(s));
29
Kha^ZlvrjbnlbaZibkZlv_]h^_kdjbilhj\IQW fnt2:=CreateFontIndirect(Lf); N@
AZ^Zgby. IhiulZcl_kv gZclb \ Delphi ^jm]b_ ZgZeh]bqgu_ kj_^kl\Z AZ ijh]jZffbjmcl_\jZs_gb_©i_qZlbªihqZkh\hcklj_ed_ AZ^Zgby^eykZfhklhyl_evghcjZ[hlu GZibrbl_ijh]jZffmdhlhjZykqblu\Z_lfZkkb\p_euoqbk_ebal_d klh\h]hnZceZq_lgu_qbkeZaZghkbl\kibkhdListbox1g_q_lgu_-\ListBox2. GZibrbl_ijh]jZffmdhlhjZykljhbl]jZnbdihqbkeZf\\h^bfuf\ l_dklh\hfj_^Zdlhj_ Kha^Zcl_gZhkgh\_deZkkZTStringGridlZ[ebpmihkljhdZfdhlhjhcgZ oh^ylky^Zggu_ihijh^Z`_lh\ZjZaZdZ`^ucf_kypZihklhe[pZf-^Zggu_ih ijh^Z`_dZ`^h]h\b^Zlh\ZjZ
30
AZ^ZqbihijbdeZ^ghcklZlbklbd_ GZibkZlv^_fhgkljZpbhggmxmq_[gmxijh]jZffm©IehlghklbjZkij_ ^_e_gby\_jhylghkl_cª Ijh]jZffZ©Fh^_ebjh\Zgb_\j_f_ggh]hjy^ZªBkihevah\Zlvfh^_ev :JKKIj_^mkfhlj_lv\hafh`ghklvkemqZcguob^_l_jfbgbjh\Zgguo\oh^guo \ha^_ckl\bc GZibkZlvijh]jZffmb^_glbnbdZpbb:J-fh^_eb\j_f_ggh]hjy^Zf_lh ^hfgZbf_gvrbod\Z^jZlh\ GZibkZlvijh]jZffmb^_glbnbdZpbb:J-fh^_eb\j_f_ggh]hjy^Zj_ dmjj_glguff_lh^hfgZbf_gvrbod\Z^jZlh\ GZibkZlv ijh]jZffm jZkq_lZ ki_dljZevghc iehlghklb fhsghklb i_ jbh^h]jZffguff_lh^hf GZibkZlv ijh]jZffm jZkq_lZ ki_dljZevghc iehlghklb fhsghklb dhj j_eh]jZffguff_lh^hf B^_glbnbdZpby ebg_cghc kbkl_fu f_lh^hf ihke_^h\Zl_evgh]h h[m q_gby Ijh]jZffZ©Fh^_ebjh\Zgb_klhoZklbq_kdbomjZ\g_gbckhklhygbyª KlZlbklbq_kdb_oZjZdl_jbklbdbebg_cguokbkl_f GZ[ex^Zl_evkhklhygbyebg_cghckbkl_fu Ijh]jZffZ©NbevljDZefZgZ-;vxkbª AZ^Zqbihki_dljZevghcl_hjbbjZ^bhkb]gZeh\ Ihkljhblv aZ\bkbfhklv hl qZklhlu fh^mey ki_dljZevghc iehlghklb ijyfhm]hevgh]h bfimevkZ k ^ebl_evghklvx jZ\ghc fdk b Zfieblm^hc < =jZnbdihkljhblv^ey^bZiZahgZqZklhlhl^hF]p GZclbki_dljZevgmxiehlghklvG(jω) dhkbgmkhb^Zevgh]hbfimevkZ T U ⋅ cos( ⋅ t T ), t < B 2 , B u(t) = T 0, t > B 2 . Ihkljhblv aZ\bkbfhklv hl qZklhlu fh^mey ki_dljZevghc iehlghklb \ ^bZiZahg_qZklhlhl^hF]p ^eyZfieblm^ugZijy`_gby U = 10B, TB = 1fdk IhkljhblvlZd`_\j_f_ggmx^bZ]jZffmbfimevkZu(t). F_lh^bq_kdb_ mdZaZgby: a^_kv b ^Ze__ ih l_dklm j = − 1 Ihkdhevdm bf imevk u(t) hibku\Z_lky q_lghc nmgdpb_c \j_f_gb _]h ki_dljZevgZy iehlghklv y\ey_lky^_ckl\bl_evghcnmgdpb_cqZklhluωIjb\h^bf__\ujZ`_gb_^eykZ fhijh\_jdb:
31
&7B ) 2UTB 2 G (j&) = ⋅ . 1 − 4 ⋅ ( &7B ) 2 2 3 Ki_dljZevgZyiehlghklvbfimevkZu(t)bf__l\b^: G (j&) = 8H[S− & ). GZclbbfimevku(t)bihkljhblv_]h\j_f_ggmx^bZ]jZffm F_lh^bq_kdb_ mdZaZgby: ihkdhevdm ki_dljZevgZy iehlghklv G(jω) _klv ^_ckl\bl_evgZy nmgdpby qZklhlu lh bfimevk hibku\Z_lky q_lghc nmgdpb_c \j_f_gb<p_eyokZfhijh\_jdbijb\h^bf__\ujZ`_gb_: u(t) = 8 2 + t 2 ). GZclb b ihkljhblv aZ\bkbfhklv hl qZklhlu ki_dljZevghc iehlghklb bfimevkZ u(t) = exp(− 2 t 2 ). Ihkljhblv lZd`_ \j_f_ggmx ^bZ]jZffm bfimevkZ u(t). F_lh^bq_kdb_ mdZaZgby ijb ihkljh_gbb aZ\bkbfhklb ki_dljZevghc iehlghklb hl qZklhlu m^h[gh hldeZ^u\Zlv ih hkb Z[kpbkk \_ebqbgm & < cos(
p_eyokZfhijh\_jdbijb\h^bf\ujZ`_gb_ki_dljZevghciehlghklb– 2 ). G (j&) = ⋅ exp(− & 4 2 Bfimevkgh_dhe_[Zgb_aZ^Zghnhjfmehc u(t) = 15 ⋅ exp(−107 t) ⋅1(t), ]^_
1(t) –nmgdpbyO_\bkZc^Znmgdpby\dexq_gby rbjhdhbkihevam_fZy\l_hjbb Z\lhfZlbq_kdh]hj_]mebjh\ZgbyHij_^_eblv]jZgbqgmxqZklhlm f ]j \]_jpZo lZdbfh[jZahfqlh[u\bgl_j\Ze_qZklhl[0, f ]j @[uehkhkj_^hlhq_gh\k_c wg_j]bbbfimevkZ F_lh^bq_kdb_ mdZaZgby: wg_j]_lbq_kdbc ki_dlj jZkkfZljb\Z_fh]h bf imevkZbf__l\b^ 225 . W(&) = 14 10 + & 2 M]eh\Zy ]jZgbqgZy qZklhlZ &]j baf_jy_fZy \ jZ^bZgZo \ k_dmg^mm^h\ e_l\hjy_lmjZ\g_gbx &]j ∞ d& d& = ⋅ , 0,9 ∫ ∫ 14 14 2 2 + + 10 & 10 & 0 0 ]^_\ijZ\hcbe_\hcqZklbijbkmlkl\m_lijhkl_crbclZ[ebqgucbgl_]jZe J_rb\^Zggh_mjZ\g_gb_ihgZc^_gghfmagZq_gbxm]eh\hcqZklhlugZoh & ^bfdjm]h\mxqZklhlm f ]j = ]j 2 . AZ^Zqbihl_hjbbZ\lhfZlbq_kdh]hj_]mebjh\Zgby Ih aZ^Zgghfm EZieZkh\kdhfm bah[jZ`_gbx F(p) \hkklZgh\blv hjb]b gZef(t) bihkljhblv_]h\j_f_ggmx^bZ]jZffm:
32
p+2 ; (p + 1) ⋅ (p − 2) ⋅ (p 2 + 4) [ F(p) = 1 2 ; (p + 1) 2
Z F(p) =
\ F(p) = p ⋅ e
−2p
. (p 2 + 9) Ihkljhblv b \u\_klb gZ i_qZlv Zfieblm^gh-nZah\u_ qZklhlgu_ oZjZdl_jbklbdb:NQO ^eykbkl_fZ\lhfZlbq_kdh]hj_]mebjh\Zgbybf_xsbo i_j_^Zlhqgu_nmgdpbbke_^mxs_]h\b^Z 45p + 120 15p + 40 Z W(p) = 3 [ = ; . W(p) p + 4p 2 − 10p p 3 + 4p 2 − 10p F_lh^bq_kdb_ mdZaZgby: aZf_gyyp gZjωhli_j_^Zlhqghcnmgdpbb:S i_j_oh^bf d :NQO W(jω ]^_ :Mω)=U(ω)+jV(ω). =h^h]jZn :NQO h[uqgh kljhyl \ ijyfhm]hevguo dhhj^bgZlZo ^8 9` Ijb ihkljh_gbb ]h^h]jZnZ j_dhf_g^m_f baf_g_gby qZklhlu ω ijhba\h^blv \ ij_^_eZo ijb\h^ysbo d baf_g_gbyf8\bgl_j\Ze_[0, -4], ZV - \bgl_j\Ze_[0, 10]. 24. Ihkljhblv :NQO ^ey kbkl_fu Z\lhfZlbq_kdh]h j_]mebjh\Zgby bf_xs_ci_j_^Zlhqgmxnmgdpbx 8 W(p) = . (1 + 80p) ⋅ (1 + 12p) F_lh^bq_kdb_ mdZaZgby: ijb ihkljh_gbb ]h^h]jZnZ j_dhf_g^m_f aZ^Zlv baf_g_gbyqZklhluω\ij_^_eZohl^h k −1 . GZclbi_j_^Zlhqgu_nmgdpbba\_gv_\kbkl_fuZ\lhfZlbq_kdh]hj_]m ebjh\Zgby_kebba\_klgubo\_kh\u_nmgdpbb: k Z k(t) = sin (Ωt ) , k=const, [ k(t) = (k/T)exp(-t/T). IhgZc^_ggufi_j_^Zlhqgufnmgdpbyfihkljhblv]h^h]jZn:NQO 26. IhaZ^Zggufi_j_oh^gufnmgdpbyfh(t) a\_gv_\kbkl_fuZ\lhfZlbq_ kdh]hj_]mebjh\ZgbygZclbboi_j_^Zlhqgu_nmgdpbb: Z h(t) = 15 ⋅1(t) ⋅ exp(− t/2), [ h(t) = 0,1⋅1(t) ⋅ [exp(t/5) − 1] . Ihke_hlukdZgbyi_j_^ZlhqghcnmgdpbbW(p) i_j_c^bl_d:NQOW(jω) b ihkljhcl_ Zfieblm^gh-qZklhlgu_ A(ω) b nZah-qZklhlgu_ ϕ(ω) oZjZdl_jbklbdb ^Zgguo^\moa\_gv_\
33
Ijh]jZffZ©Ihkljh_gb_]h^h]jZnZª Ijh]jZffZI_j_oh^gu_ijhp_kku Ijh]jZffZ©Bfimevkgu_oZjZdl_jbklbdbª. Ijh]jZffZ©Kbkl_fZmijZ\e_gbykh[jZlghck\yavxª Ijh]jZffZ©Nbevljgb`gboqZklhl;Zll_j\hjlZª Ebl_jZlmjZ >ZjZo\_eb^a_I=FZjdh\?I'HOSKL-kj_^Z\bamZevgh]hijh]jZffbjh\Zgby-KI[%+9-KZgdl-I_l_j[mj]-k K\ZgLHkgh\uijh]jZffbjh\Zgby\'HOSKL^ey:LQGRZV-Db_\ >bZe_dlbdZ-k NZjhgh\<<IZkdZevbWindows. -F©FNLM-N?KLH>B>:DLBDª 1995. -k 4. NZjhgh\<<'HOSKLMq_[gucdmjk-FGheb^`-k
IJBEH@?GB? IG_dhlhju_k\hckl\Zbf_lh^udeZkkZTCanvas &\hckl\Z7&DQYDV property Pen: TPen; I_jh K\hckl\haZ^Z_ljZaebqgu_Zljb[mluebgbc
34
gby
property Brush: TBrush; DbklvK\hckl\haZ^Z_lp\_lbrZ[ehgaZiheg_
property Font: TFont; Rjbnl property Pixels(X,Y: integer); Ijbf_gy_lky^eymklZgh\dbbql_gbyp\_lZ lhqdbkdhhj^bgZlZf;ke_\ZgZijZ\hgZqbgZykgmey b<k\_jom\gbagZqb gZykgmey Dhhj^bgZluhlghkylkyddeb_glkdhcqZklbdhfihg_glZbf_xs_ ]h&DQvas. K\hckl\Zi_jZ property Color: TColor; P\_lebgbb property Width: integer; LhesbgZebgbb\ibdk_eZo property Style: TPenStyle; TPenStyle=(psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear, psInsideFrame); &lbevebgbbimgdlbjrljbo-imgdlbj bli property Mode: TPenMode; TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy, pmMergePenNot, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge, pmNotMerge, pmMask, pmNotMask, pmXor, pmNotXor); J_`bfjbkh\ZgbyMklZgZ\eb\Z_lkihkh[\aZbfh^_ckl\byp\_ lZi_jZbp\_lZih\_joghklb&DQYDV K\hckl\Zdbklb property Color: TColor; P\_laZdjZkdb property Style: TBrushStyle; TBrushStyle ={ bsSolid, bsCross, bsClear, bsDiagCross, bsBDiagonal, bsHorizontal, bsFDiagonal, bsVertical}; RZ[ehgaZ djZkdb property Bitmap: TBitmap; Ijhba\hevgucrZ[ehgaZdjZkdb &\hckl\ZrjbnlZ property Name:TFontName;Kh^_j`bl bfy rjbnlZ gZijbf_j7LPHV 1HZ Roman). property Style: TFontStyles; TFontStyles = set of TFontStyle; TFontStyle = (fsBold, fsItalic, fsUnderline, fsStrikeOut); Kh^_j`blgZq_jlZgb_rjbnlZgZ ijbf_jdmjkb\ property Color: TColor; P\_lrjbnlZ property Pitch: TFontPitch; TFontPitch = (fpDefault, fpVariable, fpFixed); MklZgZ\eb\Z_llbirjbnlZ-fhghrbjbggucbebijhihjpbhgZevguc property Size: integer; JZaf_jrjbnlZ\imgdlZo.
F_lh^u7&DQYDV procedure Arc (X1, Y1, X2, Y2, X3, Y3, X4, Y4: integer); Jbkm_l k_]f_gl weebikZK_]f_gljbkm_lkyijhlb\qZkh\hcklj_edbWeebikhij_^_ey_lkyhib ku\Zxsbf ijyfhm]hevgbdhf X1,Y1) - ;< GZqZevgZy b dhg_qgZy lhqdb k_]f_glZ e_`Zl gZ i_j_k_q_gbb weebikZ b emq_c ijh\_^_gguo ba _]h p_gljZ q_j_alhqdb;< b;< khhl\_lkl\_ggh
35
procedure Chord (X1, Y1, X2, Y2, X3, Y3, X4, Y4: integer); Jbkm_lohj^mb aZeb\Z_l hlk_dZ_fmx _x qZklv weebikZ Weebik b dhhj^bgZlu ohj^u hij_^_ eyxlkydZd\f_lh^_$UF procedure Ellipse (X1, Y1, X2, Y2: integer); Jbkm_lbaZdjZrb\Z_ll_dm s_cdbklvxweebik\ibkZgguc\ijyfhm]hevgbd;< - (X2,Y2). procedure LineTo (X, Y: Integer); Ijh\h^bl ebgbx l_dmsbfi_jhfbal_ dms_clhqdb\lhqdm;< procedure MoveTo (X, Y: Integer); I_j_f_sZ_ll_dms__iheh`_gb_i_jZ\ lhqdm;< procedure CopyRect (const Rect: TRect; Canvas: TCanvas; const Source: TRect); Ijhba\h^bldhibjh\Zgb_ijyfhm]hevgbdZSourcebadZg\u&DQYDV\ijy fhm]hevgbdDest \l_dmsmxdZg\m procedure Draw (X, Y: Integer; Graphic: TGraphic);
36
procedure Rectangle (X1, Y1, X2, Y2: integer); Jbkm_l ijyfhm]hevgbd k \_jogbfe_\ufm]ehf;< bgb`gbfijZ\uf\;< procedure Refresh; Ijb\h^bl &DQYDV ohekl d aZ^Zgghfm ih mfheqZgbx khklhygbx. procedure RoundRect (X1, Y1, X2, Y2, X3, Y3: integer); Jbkm_lijyfhm]hev gbd k aZdjm]e_ggufb m]eZfb AZdjm]e_gby jbkmxlky dZd k_]f_glu weebikZ k jZaf_jZfbhk_cih]hjbahglZebb\_jlbdZeb;b< procedure TextHeight (const Text: string): integer;
KhklZ\bl_ebJm^Ze_\