www.pudn.com > M2Server.rar > show.pas


//////////////////////////////////////////////////////////////////////////////// 
//                                                                            // 
//                       工程:  M2Server                                     // 
//                       版本:   1.0                                          // 
//                       公司:  乐都在线                                     // 
//                       网址:  http://www.hh8.net                           // 
//                       日期:  2005-05-28                                   // 
//                                                                            // 
//////////////////////////////////////////////////////////////////////////////// 
 
unit show; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, ExtCtrls; 
 
type 
  TClickPoint = record 
    rc: TRect; 
    RStr: string; 
  end; 
  PTClickPoint = ^TClickPoint; 
  TForm2 = class(TForm) 
    PaintBox1: TPaintBox; 
    procedure PaintBox1Paint(Sender: TObject); 
    procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 
      Shift: TShiftState; X, Y: Integer); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  Form2: TForm2; 
 
implementation 
 
uses MainForm, FunctionDeclaration; 
 
 
 
{$R *.dfm} 
 
procedure BoldTextOut(Canvas: TCanvas; X, Y, fcolor, bcolor: Integer; Str: 
  string); 
var 
  old: TCOlor; 
begin 
 
 
  old := Canvas.Font.Color; 
  Canvas.Font.Color := bcolor; 
  Canvas.TextOut(X - 1, Y, Str); 
  Canvas.TextOut(X + 1, Y, Str); 
  Canvas.TextOut(X, Y - 1, Str); 
  Canvas.TextOut(X, Y + 1, Str); 
  Canvas.Font.Color := fcolor; 
  Canvas.TextOut(X, Y, Str); 
  Canvas.Font.Color := old; 
 
end; 
 
procedure TForm2.PaintBox1Paint(Sender: TObject); 
var 
  Data, fdata, cmdstr, cmdparam: string; 
  lx, ly, sx: Integer; 
  drawcenter: Boolean; 
  pcp: PTClickPoint; 
begin 
  PaintBox1.Canvas.Brush.Color := Clblack; 
  PaintBox1.Canvas.FillRect(PaintBox1.ClientRect); 
  while True do 
  begin 
    if MdgStr = '' then 
      Break; 
    MdgStr := GetValidStr3(MdgStr, Data, ['\']); 
    if Data <> '' then 
    begin 
      sx := 0; 
      fdata := ''; 
      while (pos('<', Data) > 0) and (pos('>', Data) > 0) and (Data <> '') do 
      begin 
        if Data[1] <> '<' then 
        begin 
          Data := '<' + GetValidStr3(Data, fdata, ['<']); 
        end; 
        Data := ArrestStringEx(Data, '<', '>', cmdstr); 
 
        //fdata + cmdstr + data 
        if cmdstr <> '' then 
        begin 
          if UpperCase(cmdstr) = 'C' then 
          begin 
            drawcenter := True; 
            Continue; 
          end; 
          if UpperCase(cmdstr) = '/C' then 
          begin 
            drawcenter := False; 
            Continue; 
          end; 
          cmdparam := GetValidStr3(cmdstr, cmdstr, ['/']); 
            //cmdparam : 努腐 登菌阑 锭 静烙 
        end 
        else 
        begin 
 
        end; 
 
        if fdata <> '' then 
        begin 
          BoldTextOut(PaintBox1.Canvas, lx + sx, ly, clWhite, Clblack, fdata); 
          sx := sx + PaintBox1.Canvas.TextWidth(fdata); 
        end; 
        if cmdstr <> '' then 
        begin 
          if RequireAddPoints then 
          begin //茄锅父... 
            New(pcp); 
            pcp.rc := Rect(lx + sx, ly, lx + sx + 
              PaintBox1.Canvas.TextWidth(cmdstr), ly + 14); 
            pcp.RStr := cmdparam; 
            MDlgPoints.Add(pcp); 
          end; 
          PaintBox1.Canvas.Font.Style := Font.Style + [fsUnderline]; 
          if SelectMenuStr = cmdparam then 
            BoldTextOut(PaintBox1.Canvas, lx + sx, ly, clRed, Clblack, cmdstr) 
          else 
            BoldTextOut(PaintBox1.Canvas, lx + sx, ly, clYellow, Clblack, 
              cmdstr); 
          sx := sx + PaintBox1.Canvas.TextWidth(cmdstr); 
          PaintBox1.Canvas.Font.Style := PaintBox1.Canvas.Font.Style - 
            [fsUnderline]; 
        end; 
      end; 
      if Data <> '' then 
        BoldTextOut(PaintBox1.Canvas, lx + sx, ly, clWhite, Clblack, Data); 
    end; 
    ly := ly + 16; 
  end; 
  RequireAddPoints := False; 
end; 
 
procedure TForm2.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 
  Shift: TShiftState; X, Y: Integer); 
var 
  I, L, T: Integer; 
  p: PTClickPoint; 
begin 
 
  SelectMenuStr := ''; 
  L := 0; 
  T := 0; 
 
  for I := 0 to MDlgPoints.COunt - 1 do 
  begin 
    p := PTClickPoint(MDlgPoints[I]); 
    if (X >= (L + p.rc.Left)) and (X <= (L + p.rc.Right)) and 
      (Y >= (T + p.rc.Top)) and (Y <= (T + p.rc.Bottom)) then 
    begin 
      SelectMenuStr := p.RStr; 
      Break; 
    end; 
  end; 
  if SelectMenuStr <> '' then 
  begin 
    Myself.RunAct(SelectMenuStr); 
    for I := 0 to MDlgPoints.COunt - 1 do 
      Dispose(PTClickPoint(MDlgPoints[I])); 
    MDlgPoints.Clear; 
    RequireAddPoints := True; 
    PaintBox1.Refresh; 
    FormMain.InsertLogMsg(IntToStr(Myself.m_THumanRcd.dwGold)); 
  end; 
end; 
 
end.