II. Utilizing (Windows 's ) API operate right here with a couple of certain programs to illustrate : Application 1: Delphi has manage MEMO,
Office 2010 Home And Student Key, whenever you use ought to be Manage input or editing, how you can figure out the existing cursor location? Then you could phone the Windows API purpose in the EM_LINEFROMCHAR and EM_LINEINDEX MEMO manage message to decide the existing cursor row and column , the distinct technique contact is as follows : procedure TForm1.Button1Click (Sender: TObject);
var LineNum: longint; CharsBeforeLine: longint; begin LineNum: = SendMessage (Memo1.Deal with, EM_LINEFROMCHAR, Memo1.SelStart, 0); CharsBeforeLine: = SendMessage (Memo1.Handle, EM_LINEINDEX,
Office 2010 Professional Plus Key, LineNum, 0); Label1.Caption: = 'Line:' + IntToStr (LineNum + 1); Label2.Caption: = 'Position:' + IntToStr ((Memo1.SelStart - CharsBeforeLine) +1); end; Software 2: Delphi control TlistBox not provided inside the horizontal scroll bar , when you need to add A horizontal movement segment , we basically make use of the API operate to send a LB_SetHorizontalExtent TListBox message on the line. source code is as follows : SendMessage (ListBox1.Deal with, LB_SetHorizontalExtent,
Windows 7 Discount, 2000, longint (0)); Applications 3: Once we must get the resolution on the computer running the plan , there are two techniques : ① supplied by Delphi Display entry global variables ,
Office 2007 Pro Plus, specifically Display screen.WIDTH and Screen.Peak to give the screen pixel resolution. ② making use of the API function WINDOWS GetDeviceCaps () to obtain utilised towards the show resolution , supply code is as follows : Application.Initialize; Software.CreateForm (TForm1, Form1); Case GetDeviceCaps (GetDC (Form1.Deal with),
Office 2010 Home And Business Key, HORZRES) of 640: / / 640 * 480 resolution for processing the code ; 800: / / 800 * 600 resolution for processing the code ;
1024 : / / 1024 * 768 resolution for processing the code ; 1280: / / 1280 * 1024 resolution on the code for processing ; End; Software.Run;