目前分類:Dephi (3)

瀏覽方式: 標題列表 簡短摘要

GUID (Globally Unique IDentifier) 是一個 128-bit Integer (16 bytes) 的數值。

在 Delphi IDE 中可以按下 Ctrl + Shift + G 快捷鍵會出現類似下列的 GUID 值:

KevinYoung 發表在 痞客邦 留言(0) 人氣()

{方法一}

function TForm1.GetMACAdress: string;

KevinYoung 發表在 痞客邦 留言(0) 人氣()

  • Apr 10 Sun 2011 19:54
  • Edit

{讓Edit只接受數字} 

{方法1}
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin 
  if  not (Key in [ '0'  .. '9' ]) then
    Key := Chr( 0 );
end ;

{方法2} 
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin 
  if  not (Byte(Key) in [ 48 .. 57 ]) then   // 0的Ascii是48
    Key := Chr( 0 );
end ;

{方法3}
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin 
  if  not CharInSet(Key, [ '1' .. '5' ]) then Key : = #0 ;
end ;



{Edit文本的選擇與由游標位置} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.SetFocus;                           
  SendMessage(Edit1.Handle,EM_SETSEL, 0 , 1 );  //選擇第一個字符
  SendMessage(Edit1.Handle,EM_SETSEL, 0 ,- 1 ); //全選
  SendMessage(Edit1.Handle,EM_SETSEL, 1 , 1 );  //光標移到第一個字符後面
  SendMessage(Edit1.Handle,EM_SETSEL, 0 , 0 ) ; //光標移到開始
  SendMessage(Edit1.Handle,EM_SETSEL,- 1 , 0 ); //光標移到開始 
end ;


KevinYoung 發表在 痞客邦 留言(0) 人氣()