◇[Delphi]MEMO的自動翻頁 .. Procedure ScrollMemo(Memo : TMemo; Direction : char); begin case direction of ''''d'''': begin SendMessage(Memo.Handle, { HWND of the Memo Control } WM_VSCROLL, { Windows Message } SB_PAGEDOWN, { Scroll Command } 0) { Not Used } end; ''''u'''' : begin SendMessage(Memo.Handle, { HWND of the Memo Control } WM_VSCROLL, { Windows Message } SB_PAGEUP, { Scroll Command } 0); { Not Used } end; end; end; procedure TForm1.Button1Click(Sender: TObject); begin ScrollMemo(Memo1,''''d''''); //上翻頁 end; procedure TForm1.Button1Click(Sender: TObject); begin ScrollMemo(Memo1,''''u''''); //下翻頁 end; ◇[Delphi]DBGrid中回車到下個位置(Tab鍵) procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then if DBGrid1.Columns.Grid.SelectedIndex < DBGrid1.Columns.Count - 1 then DBGrid1.Columns[DBGrid1.Columns.grid.SelectedIndex 1].FIEld.FocusControl else begin Table1.next; DBGrid1.Columns[0].fIEld.FocusControl; 版權申明:本站文章均來自網絡,本站所有轉載文章言論不代表本站觀點 end; end; ◇[Delphi]如何安裝控件 安裝方法: 1.對於單個控件,Component-->install component..-->PAS或DCU文件-->install 2.對於帶*.dpk文件的控件包,File-->open(下拉列表框中選*.dpk)-->install即可. 3.對於帶*.dpl文件的控件包,Install Packages-->Add-->dpl文件名即可。 4.如果以上Install按鈕為失效的話,試試Compile按鈕。 5.是run time lib則在option下的packages下的runtimepackes加之. 如果編譯時提示文件找不到的話,一般是控件的安裝目錄不在Delphi的Lib目錄中,有兩種方法可以解決: 1.把安裝的原文件拷入到Delphi的Lib目錄下。 2.或者Tools-->Environment Options中把控件原代碼路徑加入到Delphi的Lib目錄中即可。 ◇[Delphi]目錄完全刪除(deltree) procedure TForm1.DeleteDirectory(strDir:String); var sr: TSearchRec; FileAttrs: Integer; strfilename:string; strPth:string; begin strpth:=Getcurrentdir(); FileAttrs := faAnyFile; if FindFirst(strpth ''''\'''' strdir ''''\*.*'''', FileAttrs, sr) = 0 then begin if (sr.Attr and FileAttrs) = sr.Attr then .. begin strfilename:=sr.Name; if fileexists(strpth ''''\'''' strdir ''''\'''' strfilename) then deletefile(strpth ''''\'''' strdir ''''\'''' strfilename); end; while FindNext(sr) = 0 do begin if (sr.Attr and FileAttrs) = sr.Attr then begin strfilename:=sr.name; if fileexists(strpth ''''\'''' strdir ''''\'''' strfilename) then deletefile(strpth ''''\'''' strdir ''''\'''' strfilename); end; end; FindClose(sr); removedir(strpth ''''\'''' strdir); end; end; ◇[Delphi]取得TMemo 控件當前光標的行和列信息到Tpoint中 1.function ReadCursorPos(SourceMemo: TMemo): TPoint; var Point: TPoint; begin point.y := SendMessage(SourceMemo.Handle,EM_LINEFROMCHAR,SourceMemo.SelStart,0); point.x := SourceMemo.SelStart-SendMessage(SourceMemo.Handle,EM_LINEINDEX,point.y,0); Result := Point; end; 2.LineLength:=SendMessage(memol.handle,EM-LINELENGTH,Cpos,0);//行長
◇[Delphi]讀硬盤序列號 function GetDiskSerial(DiskChar: Char): string; var SerialNum : pdWord; a, b : dWord; Buffer : array [0..255] of char; begin result := ""; if GetVolumeInformation(PChar(diskchar ":\"), Buffer, SizeOf(Buffer), SerialNum, a, b, nil, 0) then Result := IntToStr(SerialNum^); end; ◇[INTERNET]CSS常用綜合技巧 1。P:first-letter { font-size: 300%; float: left }//首字會比普通字體加大三倍。 2。//連接一個外部樣式表 3。嵌入一個樣式表