注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

鑫淼梦园的博客

圆你的梦想 从这里开始

 
 
 

日志

 
 

Delphi xe4 奇门布局源代码  

2013-06-30 08:43:10|  分类: delphi xe4 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
procedure TForm1.BitBtn1Click(Sender: TObject);
var
  days: Integer;
  day: Integer;
  a, J, Ju: Integer;
  sq: array [0..8] of string;
  xunshou: array [0..5] of String;
  star: array [0..7] of string;
  godsend: array [0..7] of String;
  door: array [0..7] of String;
  sky: array [0..9] of String;
  di: array [0..11] of String;
  one,two,three,four,five,six,seven,eight,nine: Integer;
  rg,rz,sg,sz,bb,b,p: Integer;
  e,f,d: Integer;
  m,n: Integer;
  zf: Integer;
  h: Integer;
  k: Integer;
  y: Integer;
begin
  days :=StrToInt(Edit2.Text);
  if (Edit1.Text= '1') and (Edit4.Text = '2006') then
    days := days
  else if (Edit1.Text = '2') and (Edit4.Text = '2006') then
    days := days + 30
  else if (Edit1.Text = '3') and (Edit4.Text = '2006') then
    days := days + 59
  else if (Edit1.Text = '4') and (Edit4.Text = '2006') then
    days := days + 89
  else if (Edit1.Text = '5') and (Edit4.Text = '2006') then
    days := days + 118
  else if (Edit1.Text = '6') and (Edit4.Text = '2006') then
    days := days + 148
  else if (Edit1.Text = '7') and (Edit4.Text = '2006') then
    days := days + 177
  else if (Edit1.Text = '+7') and (Edit4.Text = '2006') then
    days := days + 207
  else if (Edit1.Text = '8') and (Edit4.Text = '2006') then
    days := days + 236
  else if (Edit1.Text = '9') and (Edit4.Text = '2006') then
    days := days + 266
  else if (Edit1.Text = '10') and (Edit4.Text = '2006') then
    days := days + 296
  else if (Edit1.Text = '11') and (Edit4.Text = '2006') then
    days := days + 325
  else if (Edit1.Text = '12') and (Edit4.Text = '2006') then
    days := days + 355
  else if (Edit1.Text = '1') and (Edit4.Text = '2007') then
    days := days + 385
  else if (Edit1.Text = '2') and (Edit4.Text = '2007') then
    days := days + 414
  else if (Edit1.Text = '3') and (Edit4.Text = '2007') then
    days := days + 443
  else if (Edit1.Text = '4') and (Edit4.Text = '2007') then
    days := days + 473
  else if (Edit1.Text = '5') and (Edit4.Text = '2007') then
    days := days + 502
  else if (Edit1.Text = '6') and (Edit4.Text = '2007') then
    days := days + 531
  else if (Edit1.Text = '7') and (Edit4.Text = '2007') then
    days := days + 561
  else if (Edit1.Text = '8') and (Edit4.Text = '2007') then
    days := days + 590
  else if (Edit1.Text = '9') and (Edit4.Text = '2007') then
    days := days + 620
  else if (Edit1.Text = '10') and (Edit4.Text = '2007') then
    days := days + 650
  else if (Edit1.Text = '11') and (Edit4.Text = '2007') then
    days := days + 680
  else if (Edit1.Text = '12') and (Edit4.Text = '2007') then
    days := days + 709
  else
    days := 0;
  day :=days - 1;

  a := day mod 5;

  if a = 0 then
    j := Trunc(day * 0.2)
  else
    j := Trunc((day - 1 - a) * 0.2 + 1);

  if (j mod 72 = 8) or (j mod 72 = 15) or (j mod 72 = 21) or (j mod 72 = 65) then
    Ju := 1
  else if (j mod 72 = 4) or (j mod 72 = 18) or (j mod 72 = 24) or (j mod 72 = 68) then
    Ju := 2
  else if (j mod 72 = 7) or (j mod 72 = 11) or (j mod 72 = 27) or (j mod 72 = 71) then
    Ju := 3
  else if (j mod 72 = 10) or (j mod 72 = 14) or (j mod 72 = 20) or (j mod 72 = 67) then
    Ju := 4
  else if (j mod 72 = 3) or (j mod 72 = 17) or (j mod 72 = 23) or (j mod 72 = 70) then
    Ju := 5
  else if (j mod 72 = 1) or (j mod 72 = 6) or (j mod 72 = 13) or (j mod 72 = 26) then
    Ju := 6
  else if (j mod 72 = 9) or (j mod 72 = 16) or (j mod 72 = 22) or (j mod 72 = 66) then
    Ju := 7
  else if (j mod 72 = 2) or (j mod 72 = 19) or (j mod 72 = 25) or (j mod 72 = 69) then
    Ju := 8
  else if (j mod 72 = 5) or (j mod 72 = 12) or (j mod 72 = 28) or (j mod 72 = 0) then
    Ju := 9
  else if (j mod 72 = 36) or (j mod 72 = 41) or (j mod 72 = 48) or (j mod 72 = 64) then
    Ju := -1
  else if (j mod 72 = 33) or (j mod 72 = 38) or (j mod 72 = 55) or (j mod 72 = 61) then
    Ju := -2
  else if (j mod 72 = 30) or (j mod 72 = 45) or (j mod 72 = 52) or (j mod 72 = 58) then
    Ju := -3
  else if (j mod 72 = 37) or (j mod 72 = 42) or (j mod 72 = 49) or (j mod 72 = 62) then
    Ju := -4
  else if (j mod 72 = 34) or (j mod 72 = 39) or (j mod 72 = 53) or (j mod 72 = 59) then
    Ju := -5
  else if (j mod 72 = 31) or (j mod 72 = 64) or (j mod 72 = 50) or (j mod 72 = 56) then
    Ju := -6
  else if (j mod 72 = 35) or (j mod 72 = 43) or (j mod 72 = 47) or (j mod 72 = 63) then
    Ju := -7
  else if (j mod 72 = 32) or (j mod 72 = 40) or (j mod 72 = 54) or (j mod 72 = 60) then
    Ju := -8
  else if (j mod 72 = 29) or (j mod 72 = 44) or (j mod 72 = 51) or (j mod 72 = 57) then
    Ju := -9
  else
    Ju := 0;

  //AnsiString sq[10];
  sq[0] := '戊';
  sq[1] := '己';
  sq[2] := '庚';
  sq[3] := '辛';
  sq[4] := '壬';
  sq[5] := '癸';
  sq[6] := '丁';
  sq[7] := '丙';
  sq[8] := '乙';
  //int one,two,three,four,five,six,seven,eight,nine;
  if ju > 0 then
  begin
    one := (10 - ju) mod 9;
    two := (11 - ju) mod 9;
    three := (12 - ju) mod 9;
    four := (13 - ju) mod 9;
    five := (14 - ju) mod 9;
    six := (15 - ju) mod 9;
    seven := (16 - ju) mod 9;
    eight := (17 - ju) mod 9;
    nine := (18 - ju) mod 9;
  end else
  begin
    one := (8 - ju) mod 9;
    two := (7 - ju) mod 9;
    three := (6 - ju) mod 9;
    four := (5 - ju) mod 9;
    five := (4 - ju) mod 9;
    six := (3 - ju) mod 9;
    seven := (2 - ju) mod 9;
    eight := (1 - ju) mod 9;
    nine := (0 - ju) mod 9;
  end;
  Label1.Caption := sq[one];
  Label2.Caption := sq[two];
  Label3.Caption := sq[three];
  Label4.Caption := sq[four];
  Label5.Caption := sq[five];
  Label6.Caption := sq[six];
  Label7.Caption := sq[seven];
  Label8.Caption := sq[eight];
  Label9.Caption := sq[nine];
//int rg,rz,sg,sz,bb,b,p;
  rg := (days + 4) mod 10;
  rz := (days + 6) mod 12;
  sz := trunc((StrToInt(Edit3.Text) + 3) * 0.5);
  sg := (rg * 2 + sz - 2) mod 10;
  bb := sz - sg;
  if bb = 0 then
  begin
    b := 0;
    p := 1;
  end
  else if (bb = 10) or (bb = -2) then
  begin
    b := 1;
    p := 11;
  end
  else if (bb = 8) or (bb = -4) then
  begin
    b := 2;
    p := 9;
  end
  else if (bb = 6) or (bb = -6) then
  begin
    b := 3;
    p := 7;
  end
  else if (bb = 4) or (bb = -8) then
  begin
    b := 4;
    p := 5;
  end
  else
  begin
    b := 5;
    p := 3;
  end;
//AnsiString  xunshou[6];
  xunshou[0] := '甲子戊 ';
  xunshou[1] := '甲戌己 ';
  xunshou[2] := '甲申庚 ';
  xunshou[3] := '甲午辛 ';
  xunshou[4] := '甲辰壬 ';
  xunshou[5] := '甲寅癸 ';
//int e,f,d;
  if sg = 1 then
    d := b
  else if (sg = 2) then
    d := 8
  else if (sg = 3) then
    d := 7
  else if (sg = 4) then
    d := 6
  else if (sg = 5) then
    d := 0
  else if (sg = 6) then
    d := 1
  else if (sg = 7) then
    d := 2
  else if (sg = 8) then
    d := 3
  else if (sg = 9) then
    d := 4
  else
    d := 5;

  if ju > 0 then
  begin
    e := (b+ju) mod 9;
    f := (d+ju) mod 9;
  end
  else
  begin
    e :=  (18-b-ju) mod 9;
    f :=  (18-d-ju) mod 9;
  end;
//int m,n;
  if f = 1 then
  begin
    m := 0;
    n := 0;
  end
  else if (f = 2) then
  begin
    m := 5;
    n :=  3;
  end
  else if (f = 3) then
  begin
    m :=  2;
    n :=  6;
  end
  else if (f = 4) then
  begin
    m :=  3;
    n :=  5;
  end
  else if (f = 5) then
  begin
    m :=  5;
    n :=  3;
  end
  else if (f = 6) then
  begin
    m :=  7;
    n :=  1;
  end
  else if (f = 7) then
  begin
    m :=  6;
    n :=  2;
  end
  else if (f = 8) then
  begin
    m :=  1;
    n :=  7;
  end
  else
  begin
    m := 4;
    n := 4;
  end;
//int zf;
  if (e = 0) then
    zf := 7
  else if (e = 1) then
    zf := 3
  else if (e = 2) then
    zf := 0
  else if (e = 3) then
    zf := 5
  else if (e = 4) then
    zf := 6
  else if (e = 5) then
    zf := 0
  else if (e = 6) then
    zf := 2
  else if (e = 7) then
    zf := 1
  else
    zf := 4;
  h := m - zf;
//AnsiString  star[8];
  if (e = 5) then
    star[0] := '天禽 '
  else
    star[0] := '天芮 ';
  star[1] := '天柱 ';
  star[2] := '天心 ';
  star[3] := '天蓬 ';
  star[4] := '天任 ';
  star[5] := '天冲 ';
  star[6] := '天辅 ';
  star[7] := '天英 ';
  Label10.Caption := star[(8 - h) mod 8];
  Label11.Caption := star[(9 - h) mod 8];
  Label12.Caption := star[(10 - h) mod 8];
  Label13.Caption := star[(11 - h) mod 8];
  Label14.Caption := star[(12 - h) mod 8];
  Label15.Caption := star[(13 - h) mod 8];
  Label16.Caption := star[(14 - h) mod 8];
  Label17.Caption := star[(15 - h) mod 8];

  if ((8-h) mod 8 = 1) then
  begin
    Label18.Caption := sq[seven];
    Label19.Caption := sq[six];
    Label20.Caption := sq[one];
    Label21.Caption := sq[eight];
    Label22.Caption := sq[three];
    Label23.Caption := sq[four];
    Label24.Caption := sq[nine];
    Label25.Caption := sq[two];
  end
  else if ((8-h) mod 8 = 2) then
  begin
    Label18.Caption := sq[six];
    Label19.Caption := sq[one];
    Label20.Caption := sq[eight];
    Label21.Caption := sq[three];
    Label22.Caption := sq[four];
    Label23.Caption := sq[nine];
    Label24.Caption := sq[two];
    Label25.Caption := sq[seven];
  end
  else if ((8-h) mod 8 = 3) then
  begin
    Label18.Caption := sq[one];
    Label19.Caption := sq[eight];
    Label20.Caption := sq[three];
    Label21.Caption := sq[four];
    Label22.Caption := sq[nine];
    Label23.Caption := sq[two];
    Label24.Caption := sq[seven];
    Label25.Caption := sq[six];
  end
  else if ((8-h) mod 8 = 4) then
  begin
    Label18.Caption := sq[eight];
    Label19.Caption := sq[three];
    Label20.Caption := sq[four];
    Label21.Caption := sq[nine];
    Label22.Caption := sq[two];
    Label23.Caption := sq[seven];
    Label24.Caption := sq[six];
    Label25.Caption := sq[one];
  end
  else if ((8-h) mod 8 = 5) then
  begin
    Label18.Caption := sq[three];
    Label19.Caption := sq[four];
    Label20.Caption := sq[nine];
    Label21.Caption := sq[two];
    Label22.Caption := sq[seven];
    Label23.Caption := sq[six];
    Label24.Caption := sq[one];
    Label25.Caption := sq[eight];
  end
  else if ((8-h) mod 8 = 6) then
  begin
    Label18.Caption := sq[four];
    Label19.Caption := sq[nine];
    Label20.Caption := sq[two];
    Label21.Caption := sq[seven];
    Label22.Caption := sq[six];
    Label23.Caption := sq[one];
    Label24.Caption := sq[eight];
    Label25.Caption := sq[three];
  end
  else if ((8-h) mod 8 = 7) then
  begin
    Label18.Caption := sq[nine];
    Label19.Caption := sq[two];
    Label20.Caption := sq[seven];
    Label21.Caption := sq[six];
    Label22.Caption := sq[one];
    Label23.Caption := sq[eight];
    Label24.Caption := sq[three];
    Label25.Caption := sq[four];
  end
  else
  begin
    Label18.Caption := sq[two];
    Label19.Caption := sq[seven];
    Label20.Caption := sq[six];
    Label21.Caption := sq[one];
    Label22.Caption := sq[eight];
    Label23.Caption := sq[three];
    Label24.Caption := sq[four];
    Label25.Caption := sq[nine];
  end;

//AnsiString  godsend[8];
  godsend[0] := '直符 ';
  godsend[1] := '螣蛇 ';
  godsend[2] := '太阴 ';
  godsend[3] := '六合 ';
  godsend[4] := '白虎 ';
  godsend[5] := '玄武 ';
  godsend[6] := '九地 ';
  godsend[7] := '九天 ';
  Label26.Caption := godsend[n];
  Label27.Caption := godsend[(n+1) mod 8];
  Label28.Caption := godsend[(n+2) mod 8];
  Label29.Caption := godsend[(n+3) mod 8];
  Label30.Caption := godsend[(n+4) mod 8];
  Label31.Caption := godsend[(n+5) mod 8];
  Label32.Caption := godsend[(n+6) mod 8];
  Label33.Caption := godsend[(n+7) mod 8];

  k := (sz + 12 - p) mod 12;
//int y;
  if (ju>0) then
    y := (e + k) mod 9
  else
    y := (e + 18 - k) mod 9;
  //AnsiString  door[8];
  door[0] := '死门 ';
  door[1] := '惊门 ';
  door[2] := '开门 ';
  door[3] := '休门 ';
  door[4] := '生门 ';
  door[5] := '伤门 ';
  door[6] := '杜门 ';
  door[7] := '景门 ';

  if (y = 1) then
  begin
    Label34.Caption := door[zf];
    Label35.Caption := door[(zf+1) mod 8];
    Label36.Caption := door[(zf+2) mod 8];
    Label37.Caption := door[(zf+3) mod 8];
    Label38.Caption := door[(zf+4) mod 8];
    Label39.Caption := door[(zf+5) mod 8];
    Label40.Caption := door[(zf+6) mod 8];
    Label41.Caption := door[(zf+7) mod 8];
  end
  else if (y = 2) or (y = 5) then
  begin
    Label34.Caption := door[(zf+3) mod 8];
    Label35.Caption := door[(zf+4) mod 8];
    Label36.Caption := door[(zf+5) mod 8];
    Label37.Caption := door[(zf+6) mod 8];
    Label38.Caption := door[(zf+7) mod 8];
    Label39.Caption := door[zf];
    Label40.Caption := door[(zf+1) mod 8];
    Label41.Caption := door[(zf+2) mod 8];
  end
  else if (y = 3) then
  begin
    Label34.Caption := door[(zf+6) mod 8];
    Label35.Caption := door[(zf+7) mod 8];
    Label36.Caption := door[zf];
    Label37.Caption := door[(zf+1) mod 8];
    Label38.Caption := door[(zf+2) mod 8];
    Label39.Caption := door[(zf+3) mod 8];
    Label40.Caption := door[(zf+4) mod 8];
    Label41.Caption := door[(zf+5) mod 8];
  end
  else if (y = 4) then
  begin
    Label34.Caption := door[(zf+5) mod 8];
    Label35.Caption := door[(zf+6) mod 8];
    Label36.Caption := door[(zf+7) mod 8];
    Label37.Caption := door[zf];
    Label38.Caption := door[(zf+1) mod 8];
    Label39.Caption := door[(zf+2) mod 8];
    Label40.Caption := door[(zf+3) mod 8];
    Label41.Caption := door[(zf+4) mod 8];
  end
  else if (y = 6) then
  begin
    Label34.Caption := door[(zf+1) mod 8];
    Label35.Caption := door[(zf+2) mod 8];
    Label36.Caption := door[(zf+3) mod 8];
    Label37.Caption := door[(zf+4) mod 8];
    Label38.Caption := door[(zf+5) mod 8];
    Label39.Caption := door[(zf+6) mod 8];
    Label40.Caption := door[(zf+7) mod 8];
    Label41.Caption := door[zf];
  end
  else if (y = 7) then
  begin
    Label34.Caption := door[(zf+2) mod 8];
    Label35.Caption := door[(zf+3) mod 8];
    Label36.Caption := door[(zf+4) mod 8];
    Label37.Caption := door[(zf+5) mod 8];
    Label38.Caption := door[(zf+6) mod 8];
    Label39.Caption := door[(zf+7) mod 8];
    Label40.Caption := door[zf];
    Label41.Caption := door[(zf+1) mod 8];
  end
  else if (y = 8) then
  begin
    Label34.Caption := door[(zf+7) mod 8];
    Label35.Caption := door[zf];
    Label36.Caption := door[(zf+1) mod 8];
    Label37.Caption := door[(zf+2) mod 8];
    Label38.Caption := door[(zf+3) mod 8];
    Label39.Caption := door[(zf+4) mod 8];
    Label40.Caption := door[(zf+5) mod 8];
    Label41.Caption := door[(zf+6) mod 8];
  end
  else
  begin
    Label34.Caption := door[(zf+4) mod 8];
    Label35.Caption := door[(zf+5) mod 8];
    Label36.Caption := door[(zf+6) mod 8];
    Label37.Caption := door[(zf+7) mod 8];
    Label38.Caption := door[zf];
    Label39.Caption := door[(zf+1) mod 8];
    Label40.Caption := door[(zf+2) mod 8];
    Label41.Caption := door[(zf+3) mod 8];
  end;
//AnsiString sky[10];
  sky[0] := '甲 ';
  sky[1] := '乙 ';
  sky[2] := '丙 ';
  sky[3] := '丁 ';
  sky[4] := '戊 ';
  sky[5] := '己 ';
  sky[6] := '庚 ';
  sky[7] := '辛 ';
  sky[8] := '壬 ';
  sky[9] := '癸 ';
//AnsiString  di[12];
  di[0] := '子 ';
  di[1] := '丑 ';
  di[2] := '寅 ';
  di[3] := '卯 ';
  di[4] := '辰 ';
  di[5] := '巳 ';
  di[6] := '午 ';
  di[7] := '未 ';
  di[8] := '申 ';
  di[9] := '酉 ';
  di[10] := '戌 ';
  di[11] := '亥 ';
  Label56.Caption := sky[rg - 1];
  Label57.Caption := di[rz - 1];
  Label58.Caption := sky[sg - 1];
  Label59.Caption := di[sz - 1];
  Label60.Caption := IntToStr(ju);
  Label61.Caption := xunshou[b];
  Label62.Caption := star[zf];
  Label63.Caption := door[zf];
  Edit5.Text := IntToStr(StrToInt(Edit3.Text)+2);
end;

只是起到抛砖引玉的启示作用。
Delphi xe4 奇门布局源代码 - 鑫淼梦园 - 鑫淼梦园的博客

Delphi xe4 奇门布局源代码 - 鑫淼梦园 - 鑫淼梦园的博客
 
  评论这张
 
阅读(391)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017