Delphi small experience summary

xiaoxiao2021-03-06  98

1. live anywhere on the form of realization with the mouse, drag the window procedure TForm1.FormMouseDown (Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); beginreleasecapture; perform (WM_SYSCOMMAND, $ f012, 0); END; 2. // Shield system function key; SystemParametersInfo (SPI_SCREENSAVERRUNNINFO (SPI_Screensaverrunning, 1, NIL, 0); // Restore function key SystemParametersInfo (spi_screensaverrunning, 0, nil, 0);

3.While FRM_LOGIN.LOGIN_OFF = false do application.processMessages; // Wait, and constantly detect frM_login.login_off

ProcessMessages does not allow the application to go idle, whereas HandleMessage does.4 // not displayed on the taskbar icon SetWindowLong (Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); 5 partial screen refresh Rect.Left:.. = X-50; Rect .Top: = Y-50; Rect.right: = x 85; Rect.Bottom: = Y 85; RedRawWindow (0, @ RECT, 0, RDW_ERASE or RDW_INVALIDATE OR RDW_INTERNALPAINT or RDW_ERASENOW OR RDW_AllChildren); SLEEP (5) If you are not delay, you will not refresh the local screen.

6.alphablend: = true; // Oh, this is the transparent way to make the window ALPHABLENDVALUE: = 100; FormStyle: = fsstayontop; // Let the form are always in front 7.Function Trunc (x: extended): INT64; // converts REAL to Intege

8.Delphi ADO Remote Connection SQL Server 2000 server problem, adoConnection.connectionstring: = 'provider = sqloledb.1; password = YourPwd; user ID = YourId;' 'initial catalog = database name; data source = data server name ' ' NetWork Library = DBMSSOCN; Network Address = IP, 1433 '; adoconnection.open;

9. Get IP Varhostent: phostent; beadata: TWSADATA; BeGinwsastartup (2, WSADATA); Hostent: = gethostByname; Hostent: = gethostByname (pchar (edit2.text)); with hostent ^ dosip: = format ('% d.% D. % d.% d ', [byte (h_addr ^ [0]), Byte (h_addr ^ [1]), byte (h_addr ^ [2]), byte (h_addr ^ [3])]); wsacleanup;

10. The input box automatically fill the page content IE} {procedure TForm1.PutData; varShellWindow: IShellWindows; nCount: integer; spDisp: IDispatch; i, j, X: integer; vi: OleVariant; IE1: IWebBrowser2; IDoc1: IHTMLDocument2 ; iELC: IHTMLElementCollection; S, S2: string; HtmlInputEle: IHTMLInputElement; HtmlSelEle: IHTMLSelectElement; beginShellWindow: = CoShellWindows.Create; nCount: = ShellWindow.Count; for i: = 0 to nCount - 1 dobeginvi: = i; spDisp: = ShellWindow.Item (vi); if spDisp = nil then continue; spDisp.QueryInterface (iWebBrowser2, IE1); if IE1 <> nil thenbeginIE1.Document.QueryInterface (IHTMLDocument2, iDoc1); if iDoc1 <> nil thenbeginielc: = idoc1.Get_all ;

for j: = 0 to dobeginApplication.ProcessMessages ielc.length-1; spDisp: = ielc.item (J, 0); if SUCCEEDED (spDisp.QueryInterface (IHTMLInputElement, HtmlInputEle)) thenwith HtmlInputEle dobeginS2: = Type_; S2: = UpperCase (S2); // I fill all the INPUT, Checkbox tick IF (strComp (Pchar (S2), 'Text') = 0) OR (Strcomp (Pchar (S2), 'Password') = 0) ThenValue: = 'try' // s: = s # 9 valueElse if strcomp (pchar (s2), 'checkbox') = 0 dam; end; if succeeded (SpdisP.Queryinterface) HTMLSELEEE)) Thenwith HTMLSELEE, MEMO1.LINES DOBEGINS: = S # 9 INTOSTR (SELECTEDEX 1); // This is the acquisition data end; end; // end formemo2.Lines.Add (s); exit; End; end;

}

11. Visit the author Homepage: Shellexecute (Http://www.jijian.sdu.edu.cn/shaojian '), NIL, NIL, SW_SHOWNORMAL);

12. Add a background to the MDI main window In the MDI program, since the MDI's main window general function is to provide the position of the sub-window display and provide menus, toolbars, statusters, etc., and the customer area of ​​the window generally does not have other Use, if you draw some software signs, the company's logo or other background pattern, not only make MDI's main window more fulfilling, beautiful, but also highlight the company's image and increase company logo in customer heart Status.

Due to the characteristics of the MDI main window, use normal onpaint and use timage and other methods. Here, you will use a simple MDI program to describe how to implement it. The first step: Open Delphi (Delphi 1, 2, 3 can be created, create a new project. Step 2: Set Form1's FormStyle to FSMDIFORM, set to the MDI's main window. Step 3: Add an image component to Form1 and select the background to be set to the image of Image. Step Four: Private Form1 defined in: FClientInstance, FPrevClientProc: TFarProc; PROCEDURE ClientWndProc (VAR Message: TMessage); Fifth Step: Add the contents of the above-described process, particularly in the implementation (Implementation) in: PROCEDURE TForm1.ClientWndProc (VAR Message : TMessage); var mydc: hdc; ro, co: word; begin with message do case msg of wm_eratedbkgn: begin mydc: = twmesebkgnd (message) .dc; for ro: = 0 to clientheight div iMage1.Picture.Height Do for Co: = 0 TO clientWIDTH DIV Image1.Picture.Width DO BitBlt (MyDC, Co * Image1.Picture.Width, Ro * Image1.Picture.Height, Image1.Picture.Width, Image1.Picture.Height, Image1.Picture.Bitmap .Canvas.handle, 0, 0, srcopy; result: = 1; End; Else Result: = CallWindowProc (FPREVCLIENTPROC, ClientHandle, MSG, WPARAM, LPARAM); END;

Step Six: Add creating event of Form1: FClientInstance: = MakeObjectInstance (ClientWndProc); FPrevClientProc: = Pointer (GetWindowLong (ClientHandle, GWL_WNDPROC)); SetWindowLong (ClientHandle, GWL_WNDPROC, LongInt (FClientInstance));

The above steps have completed the setting of the MDI main window background pattern, and one of the MDICHILD windows can be added to implement the MDI program.

Step 7: Add a Form and set the FormStyle to FSMDichild.

Now you can compile this program, you will find that the image component does not display it on the Form, but the entire Form's customer area is covered by images in Image. (1). A event after the Ctrl and other keys are pressed. Procedure TFORM1.FORMKEYDOWN (Sender: Tobject; var key: word; shift: tshiftstate); begin if (ssctrl in shift) and (key = 67) Then ShowMessage ('KeyDown Ctrl C'); END; (2) .dbgrid Tab key instead of the Enter key using procedure TForm1.DBGrid1KeyPress (Sender: TObject; var key: Char);. begin if key = # 13 then if ActiveControl = DBGrid1 then begin TDBGrid (ActiveControl) .SelectedIndex: = TDBGrid (ActiveControl) .SelectedIndex 1; Key: = # 0; end; end; (3). Select Multi-line events in. DBGRID. procedure TForm1.Button1Click (Sender: TObject); var i: integer; bookmarklist: Tbookmarklist; bookmark: tbookmarkstr; begin bookmark: = adoquery1.Bookmark; bookmarklist: = dbgrid1.SelectedRows; try begin for i: = 0 to bookmarklist.Count- 1 do begin adoquery1.Bookmark: = bookmarklist [i]; with adoquery1 do begin edit; fieldbyname ( 'mdg') AsString:. = edit2.Text; post; end; end; end; finally adoquery1.Bookmark: = bookmark; end End; (4). A appearance effect of form. Procedure TForm1.Button1Click (Sender: TOBJECT); VAR R: THANDLE; I: Integer; Begin for i: = 1 to trunc (width / 1.414) Do Begin R: = CreatellipticRgn (Trunc (Width / 2) -i, Trunc ( Height / 2) -i, trunc (width / 2) i, trunc (height / 2) i); setWindowRgn (Handle, R, True); Application.ProcessMessages; Sleep (1); End; End; (5) . Use Enter instead of TAB to move in the edit box.

procedure TForm1.FormKeyPress (Sender: TObject; var Key: Char); begin if key = # 13 then begin if not (Activecontrol is Tmemo) then begin key: = # 0; keybd_event (vk_tab, mapvirtualkey (vk_tab, 0), 0 , 0); end; end; end; (6) .progressbar plus color. const {$ EXTERNALSYM PBS_MARQUEE} PBS_MARQUEE = 08; var Form1: TForm1; implementation {$ R * .dfm} uses CommCtrl; procedure TForm1.Button1Click (Sender: TObject); begin // Set the Background color to teal Progressbar1.Brush.Color : = CLTEAL; // SET Bar Color To Yellow SendMessage (ProgressBar1.Handle, PBM_SetBarcolor, 0, ClyEllow); END; (7). Edit box color when the point is moving.

Procedure tform1.edit1enter (sender: TOBJECT); Begin (Sender as tedit) .COLOR: = CLRED; end; procedure tform1.edit1exit (sender: TObject); recomcolor: = CLWHITE; END; (8) ) backup and recovery procedure TForm1.Button1Click (Sender:. TObject); begin if OpenDialog1.Execute then begin try adoconnection1.Connected: = False; adoconnection1.ConnectionString: = 'Provider = SQLOLEDB.1; Persist Security Info = False; User ID = sa; Initial Catalog = master; Data Source = FRIEND-YOFZKSCO; ' ' Use Procedure for Prepare = 1; Auto Translate = True; Packet Size = 4096; Workstation ID = FRIEND-YOFZKSCO; Use Encryption for Data = False; Tag with column collation when possible = False '; adoconnection1.Connected: = True; with adoQuery1 do begin Close; SQL.Clear; SQL.Add (' Backup DataBase sfa to disk = '' ' opendialog1.FileName ' '' '); Exceql; End; Except ShowMessage ('±? · Yê§ ° ü'); EXIT; END; End; Application.MessageBox ('1 §? 2? Ú? Êy? Y ±? · Y3é1 |', 'ìáê?', MB_OK MB_ICONITIONFORMATION; End; ProCedure TFORM1.BUTTON2CLICK (Sender: TOBJECT) ; begin if OpenDialog1.Execute then begin try adoconnection1.Connected: = false; adoconnection1.ConnectionString: = 'Provider = SQLOLEDB.1; Persist Security Info = False; User ID = sa; Initial Catalog = master; Data Source = FRIEND-YOFZKSCO ; ' ' Use procedure for prepare = 1; auto translate = true; packet size = 4096;

Workstation ID = FRIEND-YOFZKSCO; Use Encryption for Data = False; Tag with column collation when possible = False '; adoconnection1.Connected: = true; with adoQuery1 do begin Close; SQL.Clear; SQL.Add (' Restore DataBase sfa from Disk = '' ' OpenDialog1.FileName ' ''); EXECSQL; End; Except ShowMessage ('???' ê§ ° ü '); exit; end; end; application.MessageBox (' 1 §? 2? ú £? êy? Y ??? '3é1 |', 'ìáê?', MB_OK MB_ICONITIONFORMATION; END;

(9). Find the SQLServer servers on the LAN. uses Comobj; procedure TForm1.Button1Click (Sender: TObject); var SQLServer: Variant; ServerList: Variant; i, nServers: integer; sRetValue: String; begin SQLServer: = CreateOleObject ( 'SQLDMO.Application'); ServerList: = SQLServer. Listavailablesqlservers; Nserve: = ServerList.count; for i: = 1 to Nserve do listbox1.items.add (ServerList.Item (i)); SQLServer: = null; serverList: = null; end; (10). Form opening The fade in the fade. Procedure TForm1.FormCreate (Sender: TOBJECT); Begin AnimateWindow (Handle, 400, AW_Center); END; (11). Dynamically create forms. procedure TForm1.Button1Click (Sender: TObject); begin try form2: = Tform2.Create (self); form2.ShowModal; finally form2.Free; end; end; procedure TForm1.FormClose (Sender: TObject; var Action: TCloseAction); Begin action: = cafree; end; procedure tForm1.formDestroy (Sender: TOBJECT); begin form1: = nil; end; (12). Copy file. Procedure tForm1.Button1Click (Sender: Tobject); Begin Try Copyfilea (Pchar ('C: /AAA.TXT'), PCHAR ('D: /AAA.TXT'), FALSE); Except ShowMessage ('sfdsdf'); END ; End; (13). Copy the folder.

uses shellAPI; procedure TForm1.Button1Click (Sender: TObject); var lpFileOp: TSHFileOpStruct; begin with lpFileOp do begin Wnd: = Self.Handle; wfunc: = FO_COPY; pFrom: = pchar ( 'C: / AAA'); pTo: = pchar ( 'D: / AAA'); fFlags: = FOF_ALLOWUNDO; hNameMappings: = nil; lpszProgressTitle: = nil; fAnyOperationsAborted: = True; end; if SHFileOperation (lpFileOp) <> 0 then ShowMessage ( 'delete failed'); End; (14). Change the selected color of DBGRID. procedure TForm1.DBGrid1DrawDataCell (Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin if gdSelected in state then SetBkColor (dbgrid1.canvas.handle, clgreen) else setbkcolor (dbgrid1.canvas.handle, clwhite) DBGrid1.canvas.TextRect (Rect, 0, 0, Field.Asstring); dbgrid1.canvas.textout (Rect.Lect, Rect.top, Field.Asstring); END; (15). Detection system has installed ADO . uses registry; function Tform1.ADOInstalled: Boolean; var r: TRegistry; s: string; begin r: = TRegistry.create; try with r do begin RootKey: = HKEY_CLASSES_ROOT; OpenKey ( '/ADODB.Connection/CurVer', false) ; S: = readstring ('); if s <>' 'Then Result: = true else result: = false; closekey; end; finally r.free; end; end; procedure tform1.button1click (sender: TOBJECT); Begin if AdoinStalled The ShowMessage ('this Computer Has Installed Ado'); END; (16). The IP address of the peeling host.

Uses Winsock; Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); VAR IP: String; Ipstr: String; Buffer: Array [1..32] of char; i: integer; wsdata: twsadata; host: phostent; begin if wsastartup 2, WSDATA) <> 0 THEN BEGIN SHOWMESSAGE ('WS2_32.dll3? Ê ?? ˉˉ§ ° ü.'); EXIT; End; Try if gethostname (@Buffer [1], 32) <> 0 THEN BEGIN SHOWMESAGE '?? ódμ? μ? ÷? ú ??.'); exit; end; Except showMessage ('?? ód3é1 | · μ ??? ÷? ú ??'); exit; end; host: = gethostbyname (@Buffer [1]); if Host = nil the beginning ('ipμ ?????.'); exit; end else begin edit2.text: = host.h_name; edit3.text: = CHR ( Host.h_addrtype 64); for i: = 1 to 4 do begin ip: = INTOSTR (ORD (Host.h_addr ^ [i-1])); IF i <4 Then Ipstr: = IPSTR IP '.' Else Edit1.text: = IPSTR IP; End; End; wsacleanup; end; (17). A computer name. function tform1.get_name: string; var ComputerName: PChar; size: DWord; begin GetMem (ComputerName, 255); size: = 255; if GetComputerName (ComputerName, size) = False then result: = '' else result: = ComputerName; FreeMem (ComputerName); end; procedure tform1.button1click (sender: TOBJECT); begin label1.caption: = GET_NAME; END;

(18). Get the hard disk serial number. Function tform1.gethdserialnumber: longint; {$ IFDEF WIN32} var PDW: pdword; MC, FL: DWORD; {$ ENDIF} Begin {$ IFDEF WIN32} New (PDW); GetVolumeInformation ('c: /', nil, 0, PDW, MC, FL, NIL, 0); Result: = PDW ^; Dispose (PDW); {$ ELSE} Result: = getwinflags; {$ ENDIF} End; Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT); Begin Edit1. Text: = INTOSTR (GETHDSERIALNUMBER); END; (19). Limit the cursor mobile range. procedure TForm1.Button1Click (Sender: TObject); var rect1: trect; begin rect1: = button2.BoundsRect; mapwindowpoints (handle, 0, rect1,2); clipcursor (@ rect1); end; procedure TForm1.Button2Click (Sender: TObject VAR ScreenRect: TRECT; Begin ScreenRect: = Rect (0, 0, Screen.Width, Screen.Height); Clipcursor (@screenRect); end; (20). Restricting the Edit box can only enter numbers. Procedure TForm 1.EDit1KeyPress (Sender: Tobject; Var Key: Char); Begin if Not (Key In ['0' .. '9', '.', # 8]) The begin key: = # 0; MessageBeep (0 ); END; END; (21). DBGRID is discolored according to any one of the qualifications. procedure TForm_main.DBGridEh1DrawColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumnEh; State: TGridDrawState); begin if (trim (DataModule1.ADOQuery1.FieldByName ( 'dczt') AsString) = 'OK'.) then begin if datacol = 6 then begin DbGrideh1.Canvas.Brush.Color: = clGradientActiveCaption; DbGrideh1.DefaultDrawColumnCell (Rect, datacol, column, state); end; end; end; (22) open word file.

procedure TfjfsglForm.SpeedButton4Click (Sender: TObject); var MSWord: Variant; str: string; begin if trim (. DataModule1.adoquery27.fieldbyname ( 'fjmc') asstring) <> '' then begin str: = trim (DataModule1.ADOQuery27 .fieldbyname ('fjmc'); asstring); msword: = CreateoleObject ('word.application'); // msword.documents.open ('d: / program files / commun files / sfa /' str, true); // msword.visible: = 1; // str: = '; msword.activeDocument.range (0, 0); // msword.activedocument.range.insertafter (str); //? Úword? D ??? ó ×?? 'title' msword.activedocument.range.insertparagraphafter; end else showMessage (''); end; (23) .word file incoming and outgoing database.

uses IdGlobal; procedure TdjhyForm.SpeedButton2Click (Sender: TObject); var sfilename: string; function BlobContentTostring (const Filename: string): string; begin with Tfilestream.Create (filename, fmopenread) do try setlength (result, size); read ( pointer (result) ^, size); finally free; end; end; begin if opendialog1.Execute then begin sfilename: = opendialog1.FileName; DataModule1.ADOQuery14.Edit; DataModule1.ADOQuery14.FieldByName ( 'word') AsString:. = blobcontenttostring (sfilename); DataModule1.ADOQuery14.Post; end; end; procedure TdjhyForm.SpeedButton1Click (Sender: TObject); var sfilename: string; bs: Tadoblobstream; begin bs: = Tadoblobstream.Create (TBLOBfield (DataModule1.ADOQuery14.FieldByName ( 'word')), bmread); try sfilename: = extractfilepath (application.ExeName) trim (DataModule1.adoquery14.fieldbyname ( 'hybh') AsString); sfilename:. '.' = sfilename 'doc'; bs.SaveToFile (sfilename); try djhyopenform: = Tdjhyopenform.Create (self); djhyopenform.olecontainer1.CreateObjectFromFile (sfilename, false); djhyopenform.OleContainer1.Iconic: = true; djhyopenform.ShowModal; finally djhyopenform.Free; end; finally BS.FREE; END; END; (24). Tips for the Chinese title. Procedure Tdjhyform.SpeedButton5Click (Sender: Tobject); Begin if Application.MessageBox ('', MB_YESNO MB_ICONWARNING) = ID_YES THEN DATAMODULE1.ADOQUERY14.DELETE; END; (25). Run an application file.

Winexec ('HH.EXE D: / Program Files / Common Files / MyshipperCRM E-Sales Help / MyshipperCRM E-Sales Help.chm', SW_NORMAL); 1. About MDI Main Factory Background New Solution Add Image Control to Form BMP image Name writes self.brush.bitmap: = img_bk.picture.bitmap; = img_bk.picture.bitmap; = img_bk.picture.bitmap;

2. Painting VCL controls at the title bar (a line to solve the problem !!!) In the ONPAINT event in the ONPAINT event .PointTo (GETDC (0), LEFT, TOP); 3 EDIT Enter only setwindowlong (Edit1.Handle, GWL_Style GetWindowlong (edit1.handle, gwl_style) or es_number); 4. Similar to the MDI mode new solution to the oncreate mode to set: Self.Parent: = 'To set to Mainform's Form';

5. Refresh (only one line!) RedRawwindow (0, nil, 0, rdw_eredw_allchildren); | | - ---------------------------------------------------- The Windows Directive of the Directive! PaintDesktop (GetDC (0));

7. Extended control new features In programming, we often control the action of the control, but the control does not provide this method.

At this time, you can give this control by sending a message to achieve our goal!

Such as: Button1.Perform (WM_KeyDown, 13, 0);

ListBox1.Perform (WM_VScroll, SB_LINEDOWN, 0);

Waiting for it, you can go to overload !!!!! 8. Flashing title, such as printer timeout (one line) Form put a Timer control

Write in the Time event; FlashWindow (Application.handle, True);

9. Add a VCL control on the desktop! (Not painted, not refresh) Windows.SetParent (control .handle, 0);

Note: I want to put it, such as 'start status bar')

10. About the 'similar MDI mode new solution (one line !!!!)' correcting Windows.SetParent (Self.Handle, 'to set to Mainform's Form'); 11 Ordinary Form Impons MDI MDI MAINFORM always at the bottom setActiveWindow (0); or setwindowpos (...); 12 Perform the following statement to start the Windows screen saver sendMessage (hwnd_broadcast, wm_sysCommand, sc_screensave, 0); 13 Button's CAPTION Multi-line display: setWindowlong (Button1.Handle, GWL_Style, getWindowlong Button1.handle, GWL_Style) OR BS_MULTILINE); if necessary, add button1.invalidate; 14. Whole death windows98 :) ASM INT $ 19 End

// Implement the shutdown of the window (H: window handle) function tfrmpublic.grayedCloseItem (h: hwnd): boolean; var hm: hmenu; begin if hm: hmenu; begin if h <> 0 THEN // valid handle Begin HM: = GetSystemMenu h, False); result: = EnableMenuItem (hM, SC_CLOSE, MF_BYCOMMAND MF_DISABLED MF_GRAYED); end else result: = False; end; // Close realized that the effective (h: the window handle) function TFrmPublic.EnableCloseItem ( H: hwnd): boolean; var hm: hmenu; begin if h <> 0 dam // Effective handle Begin HM: = GetSystemMenu (H, false); Result: = EnableMenuItem (HM, SC_Close, MF_BYCOMMAND MF_ENABED); ELSE Result: = FALSE;

Function getkbstatus (): String; // Returns the current keyboard status, including Numloce, Caps Lock, INSERT / / Each status information takes two characters, order: Numloce, Caps Lock, Insert // Copy Right 549 @ 11: 29 2003-7-22var Status: string; keyStates: TKeyboardState; begin GetKeyboardState (keyStates); if Odd (keyStates [VK_NUMLOCK]) then Status: = 'digital' else Status: = 'cursor'; if Odd (keyStates [VK_CAPITAL]) The Status: = Status 'uppercase' else status: = status 'lowercase'; if ing = status 'insert' else status: = status '; result: = status;

Add background to MDI main window

In the MDI program, since the MDI's main window general function is to provide the position of the sub-window displayed and provide menus, toolbars, status bars, etc., the customer area of ​​the window generally does not have other purposes, if you draw it here Some software signs, corporate logos or other background patterns, not only make MDI's main window more fulfilling, beautiful, but also highlight the company's image and increase the status of the company logo in the customer's heart.

Due to the characteristics of the MDI main window, use normal onpaint and use timage and other methods. Here, you will use a simple MDI program to describe how to implement it.

The first step: Open Delphi (Delphi 1, 2, 3 can be created, create a new project. Step 2: Set Form1's FormStyle to FSMDIFORM, set to the MDI's main window. Step 3: Add an image component to Form1 and select the background to be set to the image of Image. Step Four: Private Form1 defined in: FClientInstance, FPrevClientProc: TFarProc; PROCEDURE ClientWndProc (VAR Message: TMessage); Fifth Step: Add the contents of the above-described process, particularly in the implementation (Implementation) in: PROCEDURE TForm1.ClientWndProc (VAR Message : TMessage); var mydc: hdc; ro, co: word; begin with message do case msg of wm_eratedbkgn: begin mydc: = twmesebkgnd (message) .dc; for ro: = 0 to clientheight div iMage1.Picture.Height Do for Co: = 0 TO clientWIDTH DIV Image1.Picture.Width DO BitBlt (MyDC, Co * Image1.Picture.Width, Ro * Image1.Picture.Height, Image1.Picture.Width, Image1.Picture.Height, Image1.Picture.Bitmap .Canvas.handle, 0, 0, srccopy; result: = 1; End; Else Result: = CallWindowProc (FPREVCLIENTPROC, ClientHandle, MSG, WPARAM, LPARAM); END; END; Step 6: In Form1's creation event Join: fclientInstance: = makeObjectInstance (ClientWndProc); fprevclientproc: = Pointer (getWindowlong ClientHandle, GWL_WndProc); SetWindowlong (ClientHandle, GWL_WndProc, Longint (fclientInstance));

The above steps have completed the setting of the MDI main window background pattern, and one of the MDICHILD windows can be added to implement the MDI program.

Step 7: Add a Form and set the FormStyle to FSMDichild.

Now you can compile this program, you will find that the image component does not display it on the Form, but the entire Form's customer area is covered by images in Image. ]

Changes in the amount: function Xtod (i: real): string; const d = 'zero 壹 叁 伍 柒捌 柒捌 元 元 元 万 万 万 万 佰;;;;;; 万 万;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Integer; Begin K: = ''; M: = FLOATTOSTR (INT (I * 100)); for j: = length (m) Downto 1 Do Begin K: = K D [(STRTOINT (M [LENGTH (M) - J 1])) * 2 1] D [(STRTOINT (M [LENGTH (M) - J 1])) * 2 2] D [(10 J) * 2 - 1] D [10 J) * 2]; End; Result: = K; END;

转载请注明原文地址:https://www.9cbs.com/read-105095.html

New Post(0)