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

鑫淼梦园的博客

圆你的梦想 从这里开始

 
 
 

日志

 
 

Delphi Xe4 奇门布局修改后的源代码  

2013-07-01 18:27:09|  分类: delphi xe4 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
unit Umain;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, cxGraphics,
  cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
  Vcl.ComCtrls, dxCore, cxDateUtils, cxTextEdit, cxMaskEdit, cxDropDownEdit,
  cxCalendar, TransDate, System.StrUtils, System.DateUtils, typinfo;
type
   Ttiangan = (甲, 乙, 丙, 丁, 戊, 己, 庚, 辛, 壬, 癸);

   Tdizhi = (子, 丑, 寅, 卯, 辰, 巳, 午, 未, 申, 酉, 戌, 亥);

   T24JieQi = (小寒, 大寒, 立春, 雨水, 惊蛰, 春分, 清明, 谷雨, 立夏, 小满, 芒种, 夏至, 小暑, 大暑,
               立秋, 处暑, 白露, 秋分, 寒露, 霜降, 立冬, 小雪, 大雪, 冬至);

   T24JQyjb = (b285, c396, b852, b963, b174, b396, b417, b528, c417, c528, b639, b936, b825, c714,
               b258, b147, c936, b714, b693, b582, c693, c582, b471, c174);
type
  TFmain = class(TForm)
    BitBtn1: TBitBtn;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    Label20: TLabel;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Label26: TLabel;
    Label27: TLabel;
    Label28: TLabel;
    Label29: TLabel;
    Label30: TLabel;
    Label31: TLabel;
    Label32: TLabel;
    Label33: TLabel;
    Label34: TLabel;
    Label35: TLabel;
    Label36: TLabel;
    Label37: TLabel;
    Label38: TLabel;
    Label39: TLabel;
    Label40: TLabel;
    Label41: TLabel;
    Label56: TLabel;
    Label58: TLabel;
    Label60: TLabel;
    Label61: TLabel;
    Label62: TLabel;
    Label63: TLabel;
    Label42: TLabel;
    cxDateEdit1: TcxDateEdit;
    TransDate1: TTransDate;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Fmain: TFmain;

implementation

{$R *.dfm}

function GetCurJQ(aDate: Tdatetime): String; //获取当前时间的节气
var
  tmdata: String;
  aPaths: String;
  I: Integer;
  ayear: Integer;
  tmjieqi, Resultlist: TStringList;
  tm: String;
begin
  tmjieqi := TStringList.Create;
  Resultlist := TStringList.Create;
  tm := ExtractFilePath(Application.ExeName) + 'data\' + '%.2d' + '.dat';
  ayear := YearOf(adate);
  //添加上年度的小寒大寒
  for I := 22 to 23 do
  begin
    aPaths := Format(tm, [i]);
    tmjieqi.LoadFromFile(apaths);
    tmdata := tmjieqi.Strings[ayear];
    Resultlist.Add(tmdata);
  end;
  for I := 0 to 21 do //前22位24节气
  begin
    aPaths := Format(tm, [i]);
    tmjieqi.LoadFromFile(apaths);
    tmdata := tmjieqi.Strings[ayear];
    Resultlist.Add(tmdata);
  end;

  Result := '冬至';
  for I := 0 to 22 do //不能为23,这里必须比实际小1
  if (adate >= StrToDateTime(Resultlist.Strings[i])) and (adate < StrToDateTime(Resultlist.Strings[i + 1])) then
  begin
    Result := GetEnumName(Typeinfo(T24jieqi), i); //必须添加typinfo
    Break;
  end;

  tmjieqi.Free;
  Resultlist.Free;
end;

function GetJuValue(aDate: TDateTime): String;//获取局数
var
  curJQ: String;//阴阳局
  JieqiIndex: Integer;    //节气序号
  shangzhongxia: String;  //上中下三元值
  I: Integer;
  Curdizhi: String;
  Jushu: String;
  New1: TTransDate;
begin
  curJQ := GetCurJQ(aDate);//获得符头日属于哪一个节气
  JieqiIndex := GetEnumValue(TypeInfo(T24jieqi), curJQ);//获得节气序号值
  shangzhongxia := MidStr(GetEnumName(TypeInfo(T24JQyjb), JieqiIndex), 2, 3);//节气上中下三元
  Curdizhi := Fmain.TransDate1.LunarDate.cDay;

  //寻找符头即日干的甲己开头的干支
  New1 := TTransDate.Create(nil);
  New1.BookOfChanges := True;//执行次行New1.date就没有time信息了
  New1.Date := aDate;//必须重复赋值一次否则没有时间信息只有日期
  Jushu := '';
  for I := 1 to 5 do
  begin
    if (LeftStr(curdizhi, 1) = '甲') or (LeftStr(curdizhi, 1) = '己') then
    begin
      if AnsiContainsText('子卯午酉', RightStr(Curdizhi, 1)) then
        Jushu := MidStr(shangzhongxia, 1, 1)
      else
      if AnsiContainsText('寅巳申亥', RightStr(Curdizhi, 1)) then
        Jushu := MidStr(shangzhongxia, 2, 1)
      else
      if AnsiContainsText('丑辰未戌', RightStr(Curdizhi, 1)) then
        Jushu := MidStr(shangzhongxia, 3, 1);
      Break;
    end else
    begin
      New1.Date := IncDay(New1.Date, -1);//减少1天即往前倒推一天
      Curdizhi := New1.LunarDate.cDay;
      curJQ := GetCurJQ(New1.Date);//获得符头日属于哪一个节气
      JieqiIndex := GetEnumValue(TypeInfo(T24jieqi), curJQ);//获得节气序号值
      shangzhongxia := MidStr(GetEnumName(TypeInfo(T24JQyjb), JieqiIndex), 2, 3);//节气上中下三元
    end;
  end;
  Result := Jushu;
  New1.Free;
end;

function TianganStrToEnum(IStr: string): Ttiangan; //天干
begin
  Result := Ttiangan(GetEnumValue(TypeInfo(Ttiangan), IStr));
end;

function EnumToStrTiangan(IEnum: Ttiangan): string;
begin
  Result := GetEnumName(TypeInfo(Ttiangan), Ord(IEnum));
end;

function DizhiStrToEnum(IStr: string): Tdizhi; //地支
begin
  Result := Tdizhi(GetEnumValue(TypeInfo(Tdizhi), IStr));
end;

function EnumToStrDizhi(IEnum: Tdizhi): string;
begin
  Result := GetEnumName(TypeInfo(Tdizhi), Ord(IEnum));
end;

function DateToShichen(aDate: TDatetime): Integer; //获取时间时辰值
begin
  Result := -1;
  case HourOf(aDate) of
    01, 02:  Result := 1;
    03, 04:  Result := 2;
    05, 06:  Result := 3;
    07, 08:  Result := 4;
    09, 10:  Result := 5;
    11, 12:  Result := 6;
    13, 14:  Result := 7;
    15, 16:  Result := 8;
    17, 18:  Result := 9;
    19, 20:  Result := 10;
    21, 22:  Result := 11;
    23, 00:  Result := 0;
  end;
end;

function GetHour(aDate: Tdatetime): String;
const
  tiangan = '甲乙丙丁戊己庚辛壬癸甲乙丙丁戊己庚辛壬癸甲乙';
var
  tmRiGan: String;
  tmdzInd: Integer;
  tm, tms: String;
begin

  tm := String(Fmain.TransDate1.LunarDate.cDay);
  tmRiGan := LeftStr(tm, 1);
  tmdzInd := DateToShichen(aDate); //获取时辰值
  case Ord(TianganStrToEnum(tmRiGan)) of
    0, 5: tms := MidStr(tiangan, 1 + tmdzInd, 1);//甲、己,还加甲;
    1, 6: tms := MidStr(tiangan, 3 + tmdzInd, 1);//乙、庚,丙作初;
    2, 7: tms := MidStr(tiangan, 5 + tmdzInd, 1);//丙、辛,从戊起;
    3, 8: tms := MidStr(tiangan, 7 + tmdzInd, 1);//丁、壬,庚子居;
    4, 9: tms := MidStr(tiangan, 9 + tmdzInd, 1);//戊、癸何方发,壬子是真途
  end;

  Result := tms + GetEnumName(TypeInfo(Tdizhi), tmdzind);
end;

procedure TFmain.BitBtn1Click(Sender: TObject);
var
  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;
  Jg: array [0..8] of Integer;
  rg, rz, sg, sz, bb, b, p: Integer;
  e, f, d: Integer;
  m, n: Integer;
  zf: Integer;
  h: Integer;
  k: Integer;
  y: Integer;
  I: Integer;
  Rgz: String;
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 := 
  TransDate1.Date := cxDateEdit1.Date;
  Ju := StrToInt(GetJuValue(TransDate1.Date));

  sq[0] := '戊';
  sq[1] := '己';
  sq[2] := '庚';
  sq[3] := '辛';
  sq[4] := '壬';
  sq[5] := '癸';
  sq[6] := '丁';
  sq[7] := '丙';
  sq[8] := '乙';

  if ju > 0 then
  begin
    for I := 0 to 8 do
      Jg[i] := (i + 10 - Ju) mod 9;//顺排戊己庚辛壬癸丁丙乙
  end else
  begin
    for I := 8 downto 0 do
      Jg[8 - i] := (i - Ju) mod 9;//逆排乙丙丁癸壬辛庚己戊
  end;
  Label1.Caption := sq[Jg[0]];
  Label2.Caption := sq[Jg[1]];
  Label3.Caption := sq[Jg[2]];
  Label4.Caption := sq[Jg[3]];
  Label5.Caption := sq[Jg[4]];
  Label6.Caption := sq[Jg[5]];
  Label7.Caption := sq[Jg[6]];
  Label8.Caption := sq[Jg[7]];
  Label9.Caption := sq[Jg[8]];

  Rgz := GetHour(TransDate1.Date);
  sg := Ord(Tdizhi(GetEnumValue(TypeInfo(Ttiangan), LeftStr(Rgz, 1)))) + 1;
  sz := Ord(Tdizhi(GetEnumValue(TypeInfo(Tdizhi), RightStr(Rgz, 1)))) + 1;

  Rgz := TransDate1.LunarDate.cDay;
  rg := Ord(Tdizhi(GetEnumValue(TypeInfo(Ttiangan), LeftStr(Rgz, 1)))) + 1;
  rz := Ord(Tdizhi(GetEnumValue(TypeInfo(Tdizhi), RightStr(Rgz, 1)))) + 1;

  bb := sg - sz;
  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 = -4) then//甲辰或己酉
  begin
    b := 4;
    p := 5;
  end
  else if (bb = 2) or (bb = -2) then//甲寅或己未
  begin
    b := 5;
    p := 3;
  end;

  xunshou[0] := '甲子戊 ';
  xunshou[1] := '甲戌己 ';
  xunshou[2] := '甲申庚 ';
  xunshou[3] := '甲午辛 ';
  xunshou[4] := '甲辰壬 ';
  xunshou[5] := '甲寅癸 ';

  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 if sg = 10 then
    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;

  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;

  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;

  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[(08 - h) mod 8];
  Label11.Caption := star[(09 - 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[Jg[6]];
    Label19.Caption := sq[Jg[5]];
    Label20.Caption := sq[Jg[0]];
    Label21.Caption := sq[Jg[7]];
    Label22.Caption := sq[Jg[2]];
    Label23.Caption := sq[Jg[3]];
    Label24.Caption := sq[Jg[8]];
    Label25.Caption := sq[Jg[1]];
  end
  else if (8 - h) mod 8 = 2 then
  begin
    Label18.Caption := sq[Jg[5]];
    Label19.Caption := sq[Jg[0]];
    Label20.Caption := sq[Jg[7]];
    Label21.Caption := sq[Jg[2]];
    Label22.Caption := sq[Jg[3]];
    Label23.Caption := sq[Jg[8]];
    Label24.Caption := sq[Jg[1]];
    Label25.Caption := sq[Jg[6]];
  end
  else if (8 - h) mod 8 = 3 then
  begin
    Label18.Caption := sq[Jg[0]];
    Label19.Caption := sq[Jg[7]];
    Label20.Caption := sq[Jg[2]];
    Label21.Caption := sq[Jg[3]];
    Label22.Caption := sq[Jg[8]];
    Label23.Caption := sq[Jg[1]];
    Label24.Caption := sq[Jg[6]];
    Label25.Caption := sq[Jg[5]];
  end
  else if (8 - h) mod 8 = 4 then
  begin
    Label18.Caption := sq[Jg[7]];
    Label19.Caption := sq[Jg[2]];
    Label20.Caption := sq[Jg[3]];
    Label21.Caption := sq[Jg[8]];
    Label22.Caption := sq[Jg[1]];
    Label23.Caption := sq[Jg[6]];
    Label24.Caption := sq[Jg[5]];
    Label25.Caption := sq[Jg[0]];
  end
  else if (8 - h) mod 8 = 5 then
  begin
    Label18.Caption := sq[Jg[2]];
    Label19.Caption := sq[Jg[3]];
    Label20.Caption := sq[Jg[8]];
    Label21.Caption := sq[Jg[1]];
    Label22.Caption := sq[Jg[6]];
    Label23.Caption := sq[Jg[5]];
    Label24.Caption := sq[Jg[0]];
    Label25.Caption := sq[Jg[7]];
  end
  else if (8 - h) mod 8 = 6 then
  begin
    Label18.Caption := sq[Jg[3]];
    Label19.Caption := sq[Jg[8]];
    Label20.Caption := sq[Jg[1]];
    Label21.Caption := sq[Jg[6]];
    Label22.Caption := sq[Jg[5]];
    Label23.Caption := sq[Jg[0]];
    Label24.Caption := sq[Jg[7]];
    Label25.Caption := sq[Jg[2]];
  end
  else if (8 - h) mod 8 = 7 then
  begin
    Label18.Caption := sq[Jg[8]];
    Label19.Caption := sq[Jg[1]];
    Label20.Caption := sq[Jg[6]];
    Label21.Caption := sq[Jg[5]];
    Label22.Caption := sq[Jg[0]];
    Label23.Caption := sq[Jg[7]];
    Label24.Caption := sq[Jg[2]];
    Label25.Caption := sq[Jg[3]];
  end
  else
  begin
    Label18.Caption := sq[Jg[1]];
    Label19.Caption := sq[Jg[6]];
    Label20.Caption := sq[Jg[5]];
    Label21.Caption := sq[Jg[0]];
    Label22.Caption := sq[Jg[7]];
    Label23.Caption := sq[Jg[2]];
    Label24.Caption := sq[Jg[3]];
    Label25.Caption := sq[Jg[8]];
  end;

  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;

  if ju > 0 then
    y := (e + k) mod 9
  else
    y := (e + 18 - k) mod 9;

  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;

  sky[0] := '甲 ';
  sky[1] := '乙 ';
  sky[2] := '丙 ';
  sky[3] := '丁 ';
  sky[4] := '戊 ';
  sky[5] := '己 ';
  sky[6] := '庚 ';
  sky[7] := '辛 ';
  sky[8] := '壬 ';
  sky[9] := '癸 ';

  di[00] := '子 ';
  di[01] := '丑 ';
  di[02] := '寅 ';
  di[03] := '卯 ';
  di[04] := '辰 ';
  di[05] := '巳 ';
  di[06] := '午 ';
  di[07] := '未 ';
  di[08] := '申 ';
  di[09] := '酉 ';
  di[10] := '戌 ';
  di[11] := '亥 ';

  Label56.Caption := sky[rg - 1] + di[rz - 1];
  Label58.Caption := sky[sg - 1] + 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;

procedure TFmain.FormCreate(Sender: TObject);
begin
  cxDateEdit1.Date := Now;
end;

end.
  评论这张
 
阅读(457)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

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

页脚

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