公告

个人网站:www.fxh7622.com
技术论坛:www.88dev.com
QQ群号:89810124
QQ:513479626

博客统计信息

51cto博客之星
用户名:fxh7622
文章数:104
评论数:466
访问量:370142
无忧币:2328
博客积分:2981
博客等级:7
注册日期:2006-11-03

我独力开发的棋牌网络游戏“憨仔游戏”第一个版本总算初步完成了。因为时间和精力的限制,这个版本只能说是实现了一些基本的功能,但内测效果还是比较稳定的。目前内测已基本结束,我把安装包放到这里,衷心希望..

Linux  TCP 连接数修改

 

一、           文件数限制修改


(1)   vi /etc/security/limits.conf ..
标记一下,便于以后下代码使用。呵呵




溜码网:http://www.iocp8.com




使用Delphi2010开发的一个GDI+界面类,可以做出非常漂亮的界面。



unit xDUISkinPanel;

interface

uses

  Windows, Messages, SysUtils, Graphics, Classes, stdctrls, Buttons, GDIPlusUse, GdiPlus,

  GdiPlusHelpers, Controls, ExtCtrls, Math;

type

  TxDUISkinPanel = class(TGraphicControl)

  private

    FMouseOverButton: Boolean;

    FState: TButtonState;

    FOnReSize: TNotifyEvent;

    FAutoSize: Boolean;

    FParentCanvas: TCanvas;

    FSetParentCanvas: Boolean;

    FOffSetX, FOffSetY: Integer;

    FCaptionOffX: Integer;

    FCaptionOffY: Integer;

    FAlignment: TAlignment;

    FLayout: TTextLayout;

    FDrawFrame: Boolean;

    FDrawFrameColor: TColor;

    FIsCreateDisabledImg: Boolean;

    FBmp: TBitmap;

    FDivisionImg: Boolean;

    FDivisionCol: Integer;

    FDivisionRow: Integer;

    FDivisionFocused: Integer;

    FDivisionHot: Integer;

    FDivisionDown: Integer;

    FDivisionCount: Integer;

    FDivisionDisabled: Integer;

    FDivisionUp: Integer;

    FDivisionHighlight: Integer;

    FDivisionSelected: Integer;

    FImgSelectedHot: TGPBitmap;

    FCaptionShow: Boolean;

    FAlphaDrawImg: Integer;

    FData: Pointer;

    FTabStyle: Boolean;

    FIconSize: Integer;

    FReSizeLeft: Integer;

    FReSizeRight: Integer;

    FDivisionType: Integer;

    FTileRect: TRect;

    FMainImg: String;

    FBottomShading: String;

    FTopShading: String;

    FTileRectBottom: Integer;

    FTileRectTop: Integer;

    FTileRectLeft: Integer;

    FTileRectRight: Integer;

    FTopShowPic: String;

    procedure ReSizeImage(var ImgSrc: IGPBitmap);

    procedure ReSizeAllImg;

    procedure ReDraw;

    procedure ImgCopyRect(var Img: IGPBitmap; Value: Boolean);

    procedure CMEnabledChanged(var Msg: TMessage); message cm_EnabledChanged;

    procedure CMFontChanged(var Msg: TMessage); message cm_FontChanged;

    procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;

    procedure SetAutoSize(const Value: Boolean);

    procedure SetAlignment(const Value: TAlignment);

    procedure SetLayout(const Value: TTextLayout);

    procedure SetDrawFrame(const Value: Boolean);

    procedure SetDrawFrameColor(const Value: TColor);

    procedure SetImgUp(const Value: IGPBitmap);

    procedure SetImgMain(const Value: IGPBitmap);

    procedure SetAlphaDrawImg(const Value: Integer);

    procedure SetTabStyle(const Value: Boolean);

    procedure SetReSizeLeft(const Value: Integer);

    procedure SetReSizeRight(const Value: Integer);

    procedure SetDivisionImg(const Value: Boolean);

    procedure SetTileRect(const Value: TRect);

    procedure SetBottomShading(const Value: String);

    procedure SetMainImg(const Value: String);

    procedure SetTopShading(const Value: String);

    procedure SetTopShowPic(const Value: String);

    { Private declarations }

  protected

    { Protected declarations }

    procedure AdjustBounds; dynamic;

    procedure Paint; override;

  public

    { Public declarations }

    ImgMain, ImgUp: IGPBitmap;

    constructor Create(AOwner: TComponent); override;

    destructor Destroy; override;

    property Canvas;

    procedure Clone(Btn: TxDUISkinPanel; IsFont: Boolean = True);

    procedure CreateDisabledImg;

    property Data: Pointer read FData write FData;

  published

    { Published declarations }

    property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;

    property Layout: TTextLayout read FLayout write SetLayout default tlTop;

    property AutoSize: Boolean read FAutoSize write SetAutoSize;

    property DivisionImg: Boolean read FDivisionImg write SetDivisionImg;

    property OnReSize: TNotifyEvent read FOnReSize write FOnReSize;

    property AlphaDrawImg: Integer read FAlphaDrawImg write SetAlphaDrawImg;

    property DrawFrame: Boolean read FDrawFrame write SetDrawFrame;

    property DrawFrameColor: TColor read FDrawFrameColor write SetDrawFrameColor;

    //平铺区域

    property TileRect: TRect read FTileRect write SetTileRect;

    //图片

    property MainImg: String read FMainImg write SetMainImg;

    property TopShading: String read FTopShading write SetTopShading;

    property BottomShading: String read FBottomShading write SetBottomShading;

    property TopShowPic: String read FTopShowPic write SetTopShowPic;

    property Color;

    property Enabled;

    property Visible;

    property Align;

    property Action;

    property Anchors;

    property Constraints;

    property DragCursor;

    property DragKind;

    property DragMode;

    property Height default 25;

    property ParentFont;

    property ParentShowHint;

    property PopupMenu;

    property ShowHint;

    property Width default 75;

    property OnMouseDown;

    property OnMouseMove;

    property OnMouseUp;

  end;

procedure GrayScale(var Image: IGPBitmap);

procedure Register;

implementation

procedure Register;

begin

  RegisterComponents('Standard', [TxDUISkinPanel]);

end;

procedure CloneGDIImg(var Img: IGPBitmap; Source: IGPBitmap);

var

  g: IGPGraphics;

begin

  Img := TGPBitmap.Create(Source.GetWidth, Source.GetHeight, PixelFormat32bppARGB);

  g := TGPGraphics.Create(Img);

  try

    g.DrawImage(Source, 0, 0, Source.GetWidth, Source.GetHeight);

  finally

  end;

end;

procedure GrayScale(var Image: IGPBitmap);

var

  Data: TGPBitmapData;

  W, H, y0: Integer;

  Gray, X, Y, { a, } r, g, b: Integer;

  ScanLines: array of Byte;

begin

  W := Image.GetWidth;

  H := Image.GetHeight;

  Data := Image.LockBits(MakeRect(0, 0, W, H), [ImageLockModeRead, ImageLockModeWrite],

    PixelFormat32bppARGB);

  SetLength(ScanLines, Data.Height * Data.Stride);

  Move(Data.Scan0^, ScanLines[0], Data.Height * Data.Stride);

  for Y := 0 to H - 1 do

  begin

    y0 := Y * Data.Stride;

    for X := 0 to W - 1 do

    begin

      r := ScanLines[y0 + X * 4];

      g := ScanLines[y0 + X * 4 + 1];

      b := ScanLines[y0 + X * 4 + 2];

      Gray := Round(r * 0.3 + g * 0.59 + b * 0.11);

      ScanLines[y0 + X * 4] := Gray;

      ScanLines[y0 + X * 4 + 1] := Gray;

      ScanLines[y0 + X * 4 + 2] := Gray;

    end;

  end;

  Move(ScanLines[0], Data.Scan0^, Data.Height * Data.Stride);

  SetLength(ScanLines, 0);

  Image.UnlockBits(Data);

end;

function IntToByte(i: Integer): Byte;

begin

  if i > 255 then

    Result := 255

  else if i < 0 then

    Result := 0

  else

    Result := i;

end;

procedure ChangeAlpha(var Image: IGPBitmap; alpha: Integer); // alpha=0--255

type

  PRGBAType = ^TRGBAType;

  TRGBAType = record

    Red: Byte;

    Green: Byte;

    Blue: Byte;

    alpha: Byte;

  end;

var

  Data: TGPBitmapData;

  W, H: Integer;

  X, Y, y0: Integer;

  p: PRGBAType;

begin

  W := Image.GetWidth;

  H := Image.GetHeight;

  Data := Image.LockBits(MakeRect(0, 0, W, H), [ImageLockModeRead, ImageLockModeWrite],

    PixelFormat32bppARGB);

  for Y := 0 to H - 1 do

  begin

    y0 := Y * Data.Stride;

    for X := 0 to W - 1 do

    begin

      p := PRGBAType(PChar(Data.Scan0) + y0 + X * 4);

      if p^.alpha <> 0 then

        p^.alpha := IntToByte((p^.alpha * alpha) div 255);

    end;

  end;

  Image.UnlockBits(Data);

end;

procedure DrawAlphaImage(g: IGPGraphics; Img: IGPBitmap; X, Y, alpha: Integer); overload;

var

  ImageAttributes: IGPImageAttributes;

  ColorMatrix: TGPColorMatrix;

begin

  ImageAttributes := TGPImageAttributes.Create;

  try

    { TColorMatrix 数组的 [3,3] 决定透明度 }

    ColorMatrix.M[3, 3] := alpha / 100;

    ImageAttributes.SetColorMatrix(ColorMatrix);

    g.DrawImage(Img, MakeRect(X, Y, Img.GetWidth, Img.GetHeight), 0, 0, Img.GetWidth,

      Img.GetHeight, UnitPixel, ImageAttributes);

  finally

    // ImageAttributes.Free;

  end;

end;

procedure DrawAlphaImage(g: IGPGraphics; Img: IGPBitmap; r: TRect; alpha: Integer); overload;

var

  ImageAttributes: IGPImageAttributes;

  ColorMatrix: TGPColorMatrix;

begin

  ImageAttributes := TGPImageAttributes.Create;

  try

    { TColorMatrix 数组的 [3,3] 决定透明度 }

    ColorMatrix.M[3, 3] := alpha / 100;

    ImageAttributes.SetColorMatrix(ColorMatrix);

    g.DrawImage(Img, MakeRect(r), // MakeRect(x, y, img.GetWidth, img.GetHeight),

      0, 0, Img.GetWidth, Img.GetHeight, UnitPixel, ImageAttributes);

  finally

    // ImageAttributes.Free;

  end;

end;

function ColorToGDIColor(Color: TColor; a: Byte): TGPColor;

var

  r, g, b: Byte;

begin

  r := GetRValue(Color);

  g := GetGValue(Color);

  b := GetBValue(Color);

  Result := MakeColor(a, r, g, b);

end;

function GetStretchRect(SourceWidth, SourceHeigth, StretchWidth, StretchHeigth: Integer): TRect;

var

  W, H, cw, ch: Integer;

  xyaspect: Double;

begin

  try

    W := SourceWidth;

    H := SourceHeigth;

    cw := StretchWidth;

    ch := StretchHeigth;

    begin

      xyaspect := W / H;

      if W > H then

      begin

        W := cw;

        H := Trunc(cw / xyaspect);

        if H > ch then // woops, too big

        begin

          H := ch;

          W := Trunc(ch * xyaspect);

        end;

      end

      else

      begin

        H := ch;

        W := Trunc(ch * xyaspect);

        if W > cw then // woops, too big

        begin

          W := cw;

          H := Trunc(cw / xyaspect);

        end;

      end;

    end;

    with Result do

    begin

      Left := 0;

      Top := 0;

      Right := W;

      Bottom := H;

    end;

    OffsetRect(Result, (cw - W) div 2, (ch - H) div 2);

  except

  end;

end;

constructor TxDUISkinPanel.Create(AOwner: TComponent);

begin

  inherited Create(AOwner);

  ControlStyle := ControlStyle - [csOpaque];

  ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents, csSetCaption, csDoubleClicks,

    csReplicatable];

  FAutoSize := True;

  FIconSize := 32;

  FCaptionShow := True;

  FCaptionOffX := 0;

  FCaptionOffY := 0;

  Width := 75;

  Height := 25;

  ImgUp := nil;

  FMouseOverButton := False;

  ImgMain := nil;

  FDivisionType:=0;

  FDivisionImg := False;

  FDivisionCount := 1;

  FDivisionUp := -1;

  FDivisionDown := -1;

  FDivisionHot := -1;

  FDivisionSelected := -1;

  FDivisionDisabled := -1;

  FDivisionFocused := -1;

  FDivisionHighlight := -1;

  FAlphaDrawImg := 100;

  FReSizeLeft := 0;

  FReSizeRight := 0;

  FTabStyle := True;

  FBmp := nil;

  if not(csDesigning in ComponentState) then

  begin

    FBmp := TBitmap.Create;

  end;

end;

destructor TxDUISkinPanel.Destroy;

begin

  inherited;

  if FBmp <> nil then

    FreeAndNil(FBmp);

end;

procedure TxDUISkinPanel.AdjustBounds;

var

  DC: HDC;

  X: Integer;

  Rect: TRect;

  AAlignment: TAlignment;

begin

  if not(csReading in ComponentState) and FAutoSize then

  begin

    Rect := ClientRect;

    DC := GetDC(0);

    Canvas.Handle := DC;

    ReDraw;

    Canvas.Handle := 0;

    ReleaseDC(0, DC);

    X := Left;

  end;

end;

procedure TxDUISkinPanel.ReDraw;

var

  r, DestRect, ImgRect, SkinRect, SrcRect: TRect;

  g: IGPGraphics;

  Img: IGPBitmap;

  ImgBottom: Integer;

  DivisionIndex: Integer;

  DC: HDC;

  DTFormat: UINT;

  W, H: Integer;

  aCanvas: TCanvas;

  procedure DrawImg(ImgRect, DestRect: TRect);

  var

    ImgDes: IGPBitmap;

  begin

    g := TGPGraphics.Create(FBmp.Canvas.Handle);

    try

      ReSizeImg(ImgDes, Img, DestRect, 0, 0, Point(0, Img.Width - 0));

      g.DrawImage(ImgDes,

                  MakeRect(DestRect.Left, DestRect.Top, DestRect.Right - DestRect.Left, DestRect.Bottom - DestRect.Top),

                  ImgRect.Left,

                  ImgRect.Top,

                  ImgRect.Right - ImgRect.Left,

                  ImgRect.Bottom - ImgRect.Top,

                  UnitPixel);

    finally

    end;

  end;

  //平铺绘制

  procedure TileDrawImg(ImgRect, DestRect: TRect);

  var

    ImgDes: IGPBitmap;

    cx, cy, x, y, i, j: Integer;

    DestWidth, DestHeight: Integer;

    cRect: TRect;

  begin

    g := TGPGraphics.Create(FBmp.Canvas.Handle);

    try

      DestWidth:=DestRect.Right - DestRect.Left;

      DestHeight:=DestRect.Bottom - DestRect.Top;

      cx:=(DestWidth + (Img.Width - 1))  div Img.Width;

      cy:=(DestHeight + (Img.Height - 1)) div Img.Height;

      for I := 0 to cx - 1 do

      begin

        for j := 0 to cy - 1 do

        begin

          x:=i * Img.Width;

          y:=j * Img.Height;

          g.DrawImage(img, x, y, Img.width, Img.height);

        end;

      end;

    finally

    end;

  end;

begin

  try

    if csDesigning in ComponentState then

      with Canvas do

      begin

        Brush.Color := Color;

        Pen.Style := psDash;

        Brush.Style := bsClear;

        Rectangle(0, 0, Width, Height);

        r := ClientRect;

        OffsetRect(r, FCaptionOffX, FCaptionOffY);

        Exit;

      end;

    with FBmp do

    begin

      Width := Self.Width;

      Height := Self.Height;

      Canvas.CopyRect(ClientRect, Self.Canvas, ClientRect);

      Img:=ImgUp;

      ImgBottom := r.Top;

      if Img = nil then

        Img := ImgUp;

      if Img <> nil then

      begin

        ImgRect:=Rect(0, 0, ImgUp.Width, ImgUp.Height);

        SkinRect:=ClientRect;

        {绘制顶部}

        //加载左上图像并绘制

        DestRect:=Rect(0, 0, FTileRect.Left, FTileRect.Top);

        SrcRect:=Rect(0, 0, FTileRect.Left, FTileRect.Top);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        //加载右上图像并绘制

        DestRect:=Rect(SkinRect.Right - (ImgRect.Right - FTileRect.Right), 0, SkinRect.Right, FTileRect.Top);

        SrcRect:=Rect(FTileRect.Right, 0, ImgRect.Right, FTileRect.Top);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        //拉伸上边的图像

        DestRect:=Rect(FTileRect.Left, 0, SkinRect.Right - (ImgRect.Right - FTileRect.Right), FTileRect.Top);

        SrcRect:=Rect(FTileRect.Left, 0, FTileRect.Right, FTileRect.Top);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        {绘制底部}

        //加载下上图像并绘制

        DestRect:=Rect(0, SkinRect.Bottom - (ImgRect.Bottom - FTileRect.Bottom), FTileRect.Left, SkinRect.Bottom);

        SrcRect:=Rect(0, FTileRect.Bottom, FTileRect.Left, ImgRect.Bottom);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        //加载右下图像并绘制

        DestRect:=Rect(SkinRect.Right - (ImgRect.Right -
FTileRect.Right), SkinRect.Bottom - (ImgRect.Bottom - FTileRect.Bottom),
SkinRect.Right, SkinRect.Bottom);

        SrcRect:=Rect(FTileRect.Right, FTileRect.Bottom, ImgRect.Right, ImgRect.Bottom);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        //拉伸下边的图像

        DestRect:=Rect(FTileRect.Left, SkinRect.Bottom - (ImgRect.Bottom
- FTileRect.Bottom), SkinRect.Right - (ImgRect.Right -
FTileRect.Right), SkinRect.Bottom);

        SrcRect:=Rect(FTileRect.Left, FTileRect.Bottom, FTileRect.Right, ImgRect.Bottom);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        {绘制左边}

        DestRect:=Rect(0, FTileRect.Top, FTileRect.Left, SkinRect.Bottom - (ImgRect.Bottom - FTileRect.Bottom));

        SrcRect:=Rect(0, FTileRect.Top, FTileRect.Left, FTileRect.Bottom);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        {绘制右边}

        DestRect:=Rect(SkinRect.Right - (ImgRect.Right -
FTileRect.Right), FTileRect.Top, SkinRect.Right, SkinRect.Bottom -
(ImgRect.Bottom - FTileRect.Bottom));

        SrcRect:=Rect(FTileRect.Right, FTileRect.Top, ImgRect.Right, FTileRect.Bottom);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        {绘制中间}

        DestRect.Left:=FTileRect.Left;

        DestRect.Top:=FTileRect.Top;

        DestRect.Right:=SkinRect.Right - (ImgRect.Right - FTileRect.Right);

        DestRect.Bottom:=SkinRect.Bottom - (ImgRect.Bottom - FTileRect.Bottom);

        SrcRect:=Rect(FTileRect.Left, FTileRect.Top, FTileRect.Right, FTileRect.Bottom);

        if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

        begin

          Exit;

        end;

        DrawImg(SrcRect, DestRect);

        {绘制上底纹}

        if FileExists(FTopShading) then

        begin

          SkinRect:=ClientRect;

          Img:=TGPBitmap.Create(FTopShading);

          SkinRect.Bottom:=Img.Height;

          SkinRect.Right:=Img.Width;

          DestRect:=SkinRect;

          SrcRect:=Rect(0, 0, Img.Width, Img.Height);

          if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

          begin

            Exit;

          end;

          DrawImg(SrcRect, DestRect);

        end;

        {绘制下底纹}

        if FileExists(FBottomShading) then

        begin

          SkinRect:=ClientRect;

          Img:=TGPBitmap.Create(FBottomShading);

          SkinRect.Left:=SkinRect.Right - Img.Width;

          SkinRect.Top:=SkinRect.Bottom - Img.Height;

          DestRect:=SkinRect;

          SrcRect:=Rect(0, 0, Img.Width, Img.Height);

          if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

          begin

            Exit;

          end;

          DrawImg(SrcRect, DestRect);

        end;

        {绘制顶部显示图片(游戏名称)}

        if FileExists(FTopShowPic) then

        begin

          SkinRect:=ClientRect;

          Img:=TGPBitmap.Create(FTopShowPic);

          SkinRect.Bottom:=Img.Height;

          SkinRect.Right:=Img.Width;

          DestRect:=Rect(60, 15, Img.Width + 60, Img.Height + 15);

          SrcRect:=Rect(0, 0, Img.Width, Img.Height);

          if (DestRect.Bottom = 0) or (DestRect.Top < 0) then

          begin

            Exit;

          end;

          DrawImg(SrcRect, DestRect);

        end;

      end;

    end;

    Canvas.Draw(0, 0, FBmp);

  finally

  end;

end;

procedure TxDUISkinPanel.ReSizeAllImg;

begin

  if (FReSizeLeft = 0) or (FReSizeRight = 0) then

    Exit;

  ReSizeImage(ImgUp);

end;

procedure TxDUISkinPanel.ReSizeImage(var ImgSrc: IGPBitmap);

var

  Img: IGPBitmap;

  r: TRect;

begin

  if (ImgSrc <> nil) and (FReSizeLeft <> 0) and (FReSizeRight <> 0) then

  begin

    r := ClientRect;

    ReSizeImg(Img, ImgSrc, r, FReSizeLeft, FReSizeRight,

      Point(FReSizeLeft, ImgSrc.Width - FReSizeLeft - FReSizeRight));

    ImgSrc := Img;

  end;

end;

procedure TxDUISkinPanel.Paint;

begin

  ReDraw;

end;

procedure TxDUISkinPanel.SetAutoSize(const Value: Boolean);

begin

  FAutoSize := Value;

  Invalidate;

end;

procedure TxDUISkinPanel.SetBottomShading(const Value: String);

begin

  FBottomShading := Value;

end;

procedure TxDUISkinPanel.SetAlignment(const Value: TAlignment);

begin

  FAlignment := Value;

  Invalidate;

end;

procedure TxDUISkinPanel.SetLayout(const Value: TTextLayout);

begin

  FLayout := Value;

  Invalidate;

end;

procedure TxDUISkinPanel.SetMainImg(const Value: String);

begin

  FMainImg := Value;

end;

procedure TxDUISkinPanel.SetReSizeLeft(const Value: Integer);

begin

  FReSizeLeft := Value;

  ReSizeAllImg;

  Invalidate;

end;

procedure TxDUISkinPanel.SetReSizeRight(const Value: Integer);

begin

  FReSizeRight := Value;

  ReSizeAllImg;

  Invalidate;

end;

procedure TxDUISkinPanel.CMEnabledChanged(var Msg: TMessage);

begin

  inherited;

  Invalidate;

end;

procedure TxDUISkinPanel.CMFontChanged(var Msg: TMessage);

begin

  Invalidate;

end;

procedure TxDUISkinPanel.Clone(Btn: TxDUISkinPanel; IsFont: Boolean = True);

begin

  ImgUp := Btn.ImgUp;

  if IsFont then

    Font := Btn.Font;

  Alignment := Btn.Alignment;

  Layout := Btn.Layout;

end;

procedure TxDUISkinPanel.CMColorChanged(var Message: TMessage);

begin

end;

procedure TxDUISkinPanel.SetDrawFrame(const Value: Boolean);

begin

  FDrawFrame := Value;

end;

procedure TxDUISkinPanel.SetDrawFrameColor(const Value: TColor);

begin

  FDrawFrameColor := Value;

end;

procedure TxDUISkinPanel.CreateDisabledImg;

var

  Img: IGPBitmap;

begin

  if ImgUp <> nil then

  begin

    FIsCreateDisabledImg := True;

    CloneGDIImg(Img, ImgUp);

    GrayScale(Img);

  end;

end;

procedure TxDUISkinPanel.SetImgUp(const Value: IGPBitmap);

begin

  if ImgUp <> Value then

  begin

    ImgUp := Value;

  end;

end;

procedure TxDUISkinPanel.SetImgMain(const Value: IGPBitmap);

begin

  ImgMain := Value;

end;

procedure TxDUISkinPanel.ImgCopyRect(var Img: IGPBitmap; Value: Boolean);

var

  W, H, X, Y: Integer;

  r: TRect;

  g: IGPGraphics;

begin

  if Value and (ImgMain <> nil) then

  begin

    W := ImgMain.GetWidth;

    H := ImgMain.GetHeight;

    Y := H;

    r := Rect(0, 0, W, Y);

    OffsetRect(r, 0, 0);

    Img := TGPBitmap.Create(W, Y, PixelFormat32bppARGB);

    g := TGPGraphics.Create(Img);

    try

      g.DrawImage(ImgMain, MakeRect(0, 0, Img.GetWidth, Img.GetHeight), r.Left, r.Top, Img.GetWidth, Img.GetHeight, UnitPixel);

    finally

    end;

  end;

end;

procedure TxDUISkinPanel.SetAlphaDrawImg(const Value: Integer);

begin

  FAlphaDrawImg := Value;

  Invalidate;

end;

procedure TxDUISkinPanel.SetTabStyle(const Value: Boolean);

begin

  FTabStyle := Value;

  Invalidate;

end;

procedure TxDUISkinPanel.SetTileRect(const Value: TRect);

begin

  FTileRect := Value;

end;

procedure TxDUISkinPanel.SetTopShading(const Value: String);

begin

  FTopShading := Value;

end;

procedure TxDUISkinPanel.SetTopShowPic(const Value: String);

begin

  FTopShowPic := Value;

end;

procedure TxDUISkinPanel.SetDivisionImg(const Value: Boolean);

begin

  //开始绘制Skin

  FDivisionImg:=Value;

  if not FileExists(FMainImg) then

  begin

    Exit;

  end;

  ImgMain:=TGPBitmap.Create(FMainImg);

  ImgCopyRect(ImgUp, Value);

  Invalidate;

end;

end.
[/img]..
昨天在网上瞎逛,发现一个很不错的导航。专门可以给咱们开发者使用。挺方便的,于是马上收录下来。
 
网址:http://www.daohang18.com
 
    憨仔棋牌游戏平台目前已经顺利完成1.0版本,目前的程序包括:游戏自动更新、大厅换肤、游戏后台设置、游戏大厅和四款牌类游戏、一款休闲游戏。具备会员、道具、泡分、聊天、排行榜、房间..
对于开发棋牌游戏来说,如何开发出漂亮的界面、同时又提高开发速度,是一个困扰很多开发者的问题。今天我为大家来介绍一种我所采用的方法。我在开发自己的棋牌游戏——憨仔游戏中所使用的方法,即使用GDI+和Asphy..
1. 不管路走了多远,错了就要重新返回
文章上来就引用了一句土耳其的谚语“不管路走了多远,错了就要重新返回”, 这个说的容易, 做起来真的很难, 尤其是已经做了很多的时候, 放弃真的很不舍得…所以在开发一个..
为什么我们需要有质量的代码?
 敏捷开发方法是用来应付那些要求代码做大量改动的反馈信息的方法。
 如果程序没有用一种好的表达方式来表现,那程序会很难读,难维护,难修改。
什么是代码异味..
2011-05-19 18:47:36
    编程是一项完全靠实效说话的工作,但又有多少程序员在工作中真正注重成效呢?老实说,我做了十年编程,自问十八般武艺样样精通,却依然容易低估实效的力量。
    程序员注重..
 <<   1   2   3   4   5   >>   页数 ( 1/11 )