www.pudn.com > 短信发送2.0.rar > modiform.pas


unit modiform; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, ExtCtrls, Buttons; 
 
type 
  Tmodifrm = class(TForm) 
    GroupBox1: TGroupBox; 
    edtname: TLabeledEdit; 
    edtphone: TLabeledEdit; 
    Label1: TLabel; 
    rb1: TRadioButton; 
    rb2: TRadioButton; 
    Label2: TLabel; 
    Memo1: TMemo; 
    SpeedButton1: TSpeedButton; 
    SpeedButton2: TSpeedButton; 
    Shape6: TShape; 
    Shape1: TShape; 
    Shape2: TShape; 
    Shape3: TShape; 
    procedure SpeedButton2Click(Sender: TObject); 
    procedure FormActivate(Sender: TObject); 
    procedure SpeedButton1Click(Sender: TObject); 
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, 
      Y: Integer); 
    procedure Shape2MouseMove(Sender: TObject; Shift: TShiftState; X, 
      Y: Integer); 
    procedure Shape3MouseMove(Sender: TObject; Shift: TShiftState; X, 
      Y: Integer); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  modifrm: Tmodifrm; 
 
implementation 
  uses smsform,smsdll,loginform; 
{$R *.dfm} 
 
procedure Tmodifrm.SpeedButton2Click(Sender: TObject); 
begin 
  close; 
end; 
 
procedure Tmodifrm.FormActivate(Sender: TObject); 
begin 
  edtname.Text :=smsfrm.sg2.Cells[1,cr1]; 
  edtphone.Text :=smsfrm.sg2.Cells[3,cr1]; 
  if trim(smsfrm.sg2.Cells[2,cr1])='男' then 
     rb1.Checked :=true 
  else 
     rb2.Checked :=true; 
  memo1.Text :=smsfrm.sg2.Cells[4,cr1]; 
  modifrm.OnMouseMove(sender,[ssleft],0,0); 
end; 
 
procedure Tmodifrm.SpeedButton1Click(Sender: TObject); 
var 
  i:integer; 
  b:boolean; 
begin 
   if trim(edtname.Text)='' then 
   begin 
       messagebox(handle,'请输入姓名。','警告',mb_ok or mb_iconwarning); 
       edtname.SetFocus; 
       exit; 
   end; 
   if (trim(edtphone.Text)='')or(length(trim(edtphone.Text))<>11) then 
   begin 
       messagebox(handle,'请输入朋友的手机号码(11位)。','警告',mb_ok or mb_iconwarning); 
       edtphone.SetFocus; 
       exit; 
   end; 
   b:=false; 
   for i:=1 to cr1-1 do 
      if (trim(edtname.Text)=userlist[i-1].name)and(trim(edtphone.Text)=userlist[i-1].phone) then 
      begin 
          b:=true; 
          break; 
      end; 
   if not b then 
   for i:=cr1+1 to usercount do 
      if (trim(edtname.Text)=userlist[i-1].name)and(trim(edtphone.Text)=userlist[i-1].phone) then 
      begin 
          b:=true; 
          break; 
      end; 
    if b then 
    begin 
        messagebox(handle,'该用户名已存在,请重新输入。','警告',mb_ok or mb_iconwarning); 
        edtname.SetFocus; 
        edtname.SelectAll; 
        exit; 
    end; 
    b:=rb1.Checked; 
    ini.WriteString('user'+inttostr(cr1),'name',passwordstring(trim(edtname.Text))); 
    ini.Writebool('user'+inttostr(cr1),'sex',b); 
    ini.WriteString('user'+inttostr(cr1),'phone',passwordstring(trim(edtphone.Text))); 
    ini.WriteString('user'+inttostr(cr1),'memo',trim(memo1.Text)); 
    close; 
end; 
 
procedure Tmodifrm.FormMouseMove(Sender: TObject; Shift: TShiftState; X, 
  Y: Integer); 
begin 
  shape2.Visible :=true; 
  shape3.Visible :=true; 
  shape6.Pen.Color :=bkcolor; 
  shape1.Pen.Color :=bkcolor; 
end; 
 
procedure Tmodifrm.Shape2MouseMove(Sender: TObject; Shift: TShiftState; X, 
  Y: Integer); 
begin 
  shape2.Visible :=false; 
  shape1.Pen.Color :=clblue; 
end; 
 
procedure Tmodifrm.Shape3MouseMove(Sender: TObject; Shift: TShiftState; X, 
  Y: Integer); 
begin 
  shape3.Visible :=false; 
  shape6.Pen.Color :=clblue; 
 
end; 
 
end.