亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vrshapebtn.pas

?? 作工控的好控件
?? PAS
字號:
{*****************************************************}
{                                                     }
{     Varian Component Workshop                       }
{                                                     }
{     Varian Software NL (c) 1996-2000                }
{     All Rights Reserved                             }
{                                                     }
{*****************************************************}

unit VrShapeBtn;

{$I VRLIB.INC}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  VrControls, VrSysUtils;

type
  TVrShapeBtn = class(TVrGraphicImageControl)
  private
    FBitmap: TBitmap;
    FBitmapUp: TBitmap;
    FBitmapDown: TBitmap;
    FMaskBitmap: TBitmap;
    FDown, FPressed: Boolean;
    procedure AdjustBounds;
    function BevelColor(Pressed: Boolean; const TopLeft: Boolean): TColor;
    procedure Create3DBitmap(Source: TBitmap; Pressed: Boolean; Target: TBitmap);
    procedure SetBitmap(Value: TBitmap);
    procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR;
    procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
    procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
    procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE;
    function PtInMask(const X, Y: Integer): Boolean;
    procedure BitmapChanged(Sender: TObject);
  protected
    procedure DefineProperties(Filer: TFiler); override;
    function GetPalette: HPALETTE; override;
    procedure Loaded; override;
    procedure CreateMaskBitmap;
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState;  X, Y: Integer); override;
    procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
    procedure MouseUp(Button: TMouseButton; Shift: TShiftState;  X, Y: Integer); override;
    procedure Paint; override;
    procedure Click; override;
    procedure ReadBitmapData(Stream: TStream); virtual;
    procedure WriteBitmapData(Stream: TStream); virtual;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
  published
    property Bitmap: TBitmap read FBitmap write SetBitmap;
    property Transparent;
{$IFDEF VER110}
    property Anchors;
    property Constraints;
{$ENDIF}
    property Caption;
    property DragCursor;
{$IFDEF VER110}
    property DragKind;
{$ENDIF}
    property DragMode;
    property Enabled;
    property Font;
    property ParentFont default false;
    property ParentShowHint;
    property PopupMenu;
    property ShowHint;
    property Visible;
    property OnClick;
{$IFDEF VER130}
    property OnContextPopup;
{$ENDIF}
    property OnDragDrop;
    property OnDragOver;
{$IFDEF VER110}
    property OnEndDock;
{$ENDIF}
    property OnEndDrag;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
{$IFDEF VER110}
    property OnStartDock;
{$ENDIF}
    property OnStartDrag;
  end;


implementation

type
  Apair = array[0..1] of Integer;


function MakeBorder(Source, NewSource: TBitmap; const OffsetPts: array of Apair;
  TransparentColor: TColor): TBitmap;
var
  I : Integer;
  R, NewR: TRect;
  SmallMask, BigMask, NewSourceMask: TBitmap;

  function GetMask(Source: TBitmap; TransColor: TColor): TBitmap;
  begin
    Result := TBitmap.Create;
    try
      Result.Assign(Source);
      Result.Mask(TransColor);
    except
      Result.Free;
      raise;
    end;
  end;

begin
  Result := TBitmap.Create;
  try
    R := Rect(0, 0, Source.Width, Source.Height);
    Result.Monochrome := True;
    Result.Width := Source.Width;
    Result.Height := Source.Height;

    SmallMask := GetMask(Source, TransparentColor);
    NewSourceMask := GetMask(NewSource, TransparentColor);
    BigMask := GetMask(NewSourceMask, TransparentColor);
    try
      BigMask.Canvas.CopyMode := cmSrcCopy;
      BigMask.Canvas.CopyRect(R, NewSourceMask.Canvas, R);

      for I := Low(OffsetPts) to High(OffsetPts) do
      begin
        if (OffsetPts[I, 0] = 0) and (OffsetPts[I, 1] = 0) then
          Break;
        NewR := R;
        OffsetRect(NewR, OffsetPts[I, 0], OffsetPts[I, 1]);
        BigMask.Canvas.CopyMode := cmSrcAnd;
        BigMask.Canvas.CopyRect(NewR, SmallMask.Canvas, R);
      end;

      BigMask.Canvas.CopyMode := cmSrcCopy;
      with Result do
      begin
        Canvas.CopyMode := cmSrcCopy;
        Canvas.CopyRect(R, NewSourceMask.Canvas, R);
        Canvas.CopyMode := $00DD0228;
        Canvas.CopyRect(R, BigMask.Canvas, R);
      end;

    finally
      SmallMask.Free;
      NewSourceMask.Free;
      BigMask.Free;
    end;

  except
    Result.Free;
    Raise;
  end;
end;

constructor TVrShapeBtn.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Width := 50;
  Height := 50;
  ControlStyle := ControlStyle + [csCaptureMouse, csOpaque] - [csDoubleClicks];
  FBitmap := TBitmap.Create;
  FBitmap.OnChange := BitmapChanged;
  FBitmapUp := TBitmap.Create;
  FBitmapDown := TBitmap.Create;
  FMaskBitmap := TBitmap.Create;
  ParentFont := True;
end;

destructor TVrShapeBtn.Destroy;
begin
  FBitmap.Free;
  FBitmapUp.Free;
  FBitmapDown.Free;
  FMaskBitmap.Free;
  inherited Destroy;
end;

procedure TVrShapeBtn.Loaded;
begin
  inherited Loaded;
  CreateMaskBitmap;
end;

procedure TVrShapeBtn.CreateMaskBitmap;
begin
  if not FBitmap.Empty then
  begin
    FMaskBitmap.Assign(FBitmap);
    FMaskBitmap.Mask(FBitmap.TransparentColor);
  end;
end;

procedure TVrShapeBtn.AdjustBounds;
begin
  SetBounds(Left, Top, Width, Height);
end;

procedure TVrShapeBtn.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
var W, H: Integer;
begin
  W := AWidth;
  H := AHeight;
  if FBitmap <> nil then
    if not (csLoading in ComponentState) and (not FBitmap.Empty) then
    begin
      W := FBitmap.Width;
      H := FBitmap.Height;
    end;
  inherited SetBounds(ALeft, ATop, W, H);
end;

procedure TVrShapeBtn.Paint;
var
  R: TRect;
  CurrentBmp: TBitmap;
begin
  ClearBitmapCanvas;

  if (not FPressed) then CurrentBmp := FBitmapUp
  else CurrentBmp := FBitmapDown;

  with BitmapCanvas do
  begin
    if not CurrentBmp.Empty then
    begin
      R := BitmapRect(BitmapImage);
      if FPressed then OffsetRect(R, 1, 1);
      Brush.Color := FBitmap.TransparentColor;
      if Transparent then Brush.Style := bsClear
      else Brush.Style := bsSolid;
      BrushCopy(R, CurrentBmp, BitmapRect(CurrentBmp),
        FBitmap.TransparentColor);
    end;

    if Length(Caption) > 0 then
    begin
      R := ClientRect;
      Font := Self.Font;
      Brush.Style := bsClear;
      if FPressed then OffsetRect(R, 1, 1);
      DrawText(BitmapCanvas.Handle, PChar(Caption), -1, R,
        DT_CENTER or DT_VCENTER or DT_SINGLELINE);
    end;
  end;

  ShowDesignFrame(BitmapCanvas);
  inherited Paint;
end;

procedure TVrShapeBtn.Click;
begin
end;

function TVrShapeBtn.PtInMask(const X, Y: Integer): Boolean;
begin
  Result := True;
  if FMaskBitmap <> nil then
    Result := (FMaskBitmap.Canvas.Pixels[X, Y] = clBlack);
end;

procedure TVrShapeBtn.MouseDown(Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
var
  Clicked: Boolean;
begin
  if (Button = mbLeft) and Enabled then
  begin
    Clicked := PtInMask(X, Y);
    if Clicked then
    begin
      FDown := True;
      FPressed := True;
      UpdateControlCanvas;
    end;
  end;
  inherited MouseDown(Button, Shift, X, Y);
end;

procedure TVrShapeBtn.MouseMove(Shift: TShiftState; X, Y: Integer);
var
  OldValue: Boolean;
begin
  OldValue := FPressed;
  FPressed := FDown and PtInMask(X, Y);
  if FPressed <> OldValue then
    UpdateControlCanvas;
  inherited MouseMove(Shift, X, Y);
end;

procedure TVrShapeBtn.MouseUp(Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
var
  DoClick: Boolean;
begin
  DoClick := false;
  if FDown then
  begin
    DoClick := PtInMask(X, Y);
    FDown := false;
    FPressed := false;
    UpdateControlCanvas;
  end;
  inherited MouseUp(Button, Shift, X, Y);
  if DoClick then inherited Click;
end;

function TVrShapeBtn.GetPalette: HPALETTE;
begin
  Result := FBitmap.Palette;
end;

procedure TVrShapeBtn.SetBitmap(Value: TBitmap);
begin
  FBitmap.Assign(Value);
end;

procedure TVrShapeBtn.BitmapChanged(Sender: TObject);
var
  OldCursor: TCursor;
  W, H: Integer;
begin
  AdjustBounds;
  if not ((csReading in ComponentState) or (csLoading in ComponentState)) then
  begin
    if FBitmap.Empty then
    begin
      FBitmapUp.Assign(nil);
      FBitmapDown.Assign(nil);
    end
    else
    begin
      W := FBitmap.Width;
      H := FBitmap.Height;
      OldCursor := Screen.Cursor;
      Screen.Cursor := crHourGlass;
      try
        FBitmapUp.Width := W;
        FBitmapUp.Height := H;
        FBitmapDown.Width := W;
        FBitmapDown.Height := H;
        Create3DBitmap(FBitmap, False, FBitmapUp);
        Create3DBitmap(FBitmap, True, FBitmapDown);
        CreateMaskBitmap;
      finally
        Screen.Cursor := OldCursor;
      end;
    end;
  end;
  UpdateControlCanvas;
end;

procedure TVrShapeBtn.CMDialogChar(var Message: TCMDialogChar);
begin
  with Message do
    if IsAccel(CharCode, Caption) and Enabled then
    begin
      Click;
      Result := 1;
    end else
      inherited;
end;

procedure TVrShapeBtn.CMFontChanged(var Message: TMessage);
begin
  inherited;
  UpdateControlCanvas;
end;

procedure TVrShapeBtn.CMTextChanged(var Message: TMessage);
begin
  inherited;
  UpdateControlCanvas;
end;

procedure TVrShapeBtn.CMSysColorChange(var Message: TMessage);
begin
  inherited;
  BitmapChanged(Self);
end;

function TVrShapeBtn.BevelColor(Pressed: Boolean; const TopLeft: Boolean): TColor;
begin
  if (not Pressed) then
  begin
    if TopLeft then Result := clBtnHighlight
    else Result := clBtnShadow
  end
  else { bsDown }
  begin
    if TopLeft then Result := clBtnShadow
    else Result := clBtnHighlight;
  end;
end;

procedure TVrShapeBtn.Create3DBitmap(Source: TBitmap;
  Pressed: Boolean; Target: TBitmap);
type
  OutlineOffsetPts = array[1..3, 0..1, 0..12] of Apair;
const
  OutlinePts: OutlineOffsetPts =
    ( (((1,-1),(1,0),(1,1),(0,1),(-1,1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)),
       ((-1,0),(-1,-1),(0,-1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))),
      (((2,-2),(2,-1),(2, 0),(2, 1),(2, 2),(1, 2),(0, 2),(-1,2),(-2,2),(0,0),(0,0),(0,0),(0,0)),
       ((-2,1),(-2,0),(-2,-1),(-2,-2),(-1,-2),(0,-2),(1,-2),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))),
      (((3,-3),(3,-2),(3,-1),(3,0),(3,1),(3,2),(3,3),(2,3),(1,3),(0,3),(-1,3),(-2,3),(-3,3)),
       ((-3,2),(-3,1),(-3,0),(-3,-1),(-3,-2),(-3,-3),(-2,-3),(-1,-3),(0,-3),(1,-3),(2,-3),(0,0),(0,0)))
    );
var
  I, J, W, H, Outlines: Integer;
  R: TRect;
  OutlineMask, Overlay, NewSource: TBitmap;
begin
  if (Source = nil) or (Target = nil) then
    Exit;

  W := Source.Width;
  H := Source.Height;
  R := Rect(0, 0, W, H);

  Overlay := TBitmap.Create;
  NewSource := TBitmap.Create;
  try
    NewSource.Width := W;
    NewSource.Height := H;

    Target.Canvas.CopyMode := cmSrcCopy;
    Target.Canvas.CopyRect(R, Source.Canvas, R);

    Overlay.Width := W;
    Overlay.Height := H;

    Outlines := 2;

    for I := 1 to Outlines do
    begin
      with NewSource.Canvas do
      begin
        CopyMode := cmSrcCopy;
        CopyRect(R, Target.Canvas, R);
      end;

      for J := 0 to 1 do
      begin
        if (Pressed) and (I = Outlines) and (J = 0) then
          Continue;

        OutlineMask := MakeBorder(Source, NewSource, OutlinePts[I, J],
                        FBitmap.TransparentColor);
        try
          with Overlay.Canvas do
          begin
            if (I = Outlines)  then
              Brush.Color := clBlack
            else
              Brush.Color := BevelColor(Pressed, (J = 1));
            CopyMode := $0030032A; { PSna }
            CopyRect(R, OutlineMask.Canvas, R);
          end;

          with Target.Canvas do
          begin
            CopyMode := cmSrcAnd; { DSa }
            CopyRect(R, OutlineMask.Canvas, R);

            CopyMode := cmSrcPaint; { DSo }
            CopyRect(R, Overlay.Canvas, R);
            CopyMode := cmSrcCopy;
          end;
        finally
          OutlineMask.Free;
        end;
      end;
    end;
  finally
    Overlay.Free;
    NewSource.Free;
  end;
end;

procedure TVrShapeBtn.DefineProperties(Filer: TFiler);
begin
  inherited DefineProperties(Filer);
  Filer.DefineBinaryProperty('BitmapData', ReadBitmapData, WriteBitmapData, True);
end;

procedure TVrShapeBtn.ReadBitmapData(Stream: TStream);
begin
  FBitmapUp.LoadFromStream(Stream);
  FBitmapDown.LoadFromStream(Stream);
end;

procedure TVrShapeBtn.WriteBitmapData(Stream: TStream);
begin
  FBitmapUp.SaveToStream(Stream);
  FBitmapDown.SaveToStream(Stream);
end;



end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品国产综合久久久久久| 偷拍与自拍一区| 成人免费看视频| 亚洲色图欧美偷拍| 欧美日韩一区视频| 免费在线观看视频一区| 久久影院电视剧免费观看| 国产成人综合在线观看| 中文字幕在线不卡一区| 欧洲亚洲国产日韩| 日本成人中文字幕在线视频| 日韩欧美国产成人一区二区| 国内精品视频一区二区三区八戒 | 91片黄在线观看| 亚洲一区二区美女| 日韩免费观看高清完整版在线观看| 国产美女精品在线| 亚洲视频在线观看三级| 欧美日本一区二区三区四区| 日韩激情一二三区| 国产精品你懂的在线欣赏| 91九色02白丝porn| 日韩电影在线免费看| 日本一区二区三级电影在线观看 | 蜜臀va亚洲va欧美va天堂| 久久久亚洲午夜电影| 色播五月激情综合网| 蜜臀av一区二区| 亚洲人吸女人奶水| 日韩视频在线你懂得| www.欧美日韩| 蜜桃av噜噜一区二区三区小说| 国产精品美女久久久久av爽李琼| 欧美色区777第一页| 国产激情视频一区二区在线观看 | 在线看国产日韩| 黄色日韩三级电影| 亚洲午夜激情av| 国产午夜亚洲精品理论片色戒| 欧美日韩在线精品一区二区三区激情| 精品一区二区免费看| 一区二区三区资源| 国产人伦精品一区二区| 91精品在线一区二区| 91麻豆精东视频| 国产成人精品一区二区三区四区 | 国产一区999| 丝袜a∨在线一区二区三区不卡 | 中文字幕一区视频| 欧美大白屁股肥臀xxxxxx| 91视视频在线直接观看在线看网页在线看| 日韩专区欧美专区| 亚洲欧美乱综合| 国产精品视频第一区| 欧美哺乳videos| 日韩一区二区电影网| 欧美亚洲国产怡红院影院| 国产成a人亚洲精| 国产美女精品人人做人人爽| 日韩经典一区二区| 性做久久久久久久久| 亚洲免费在线视频| 中文字幕一区二区三区色视频| www久久精品| 欧美成人性福生活免费看| 5566中文字幕一区二区电影| 欧美性大战久久久久久久蜜臀| 成人激情小说网站| 国产成人av电影在线播放| 麻豆国产欧美日韩综合精品二区 | 91电影在线观看| 99视频在线精品| 99久久99久久精品国产片果冻 | 欧美疯狂做受xxxx富婆| 欧美一a一片一级一片| 色综合久久久久| 91麻豆自制传媒国产之光| 91啪九色porn原创视频在线观看| heyzo一本久久综合| 99久久99久久综合| 色综合亚洲欧洲| 在线观看网站黄不卡| 欧美在线短视频| 91国偷自产一区二区开放时间 | 欧美日韩久久不卡| 欧美三级午夜理伦三级中视频| 欧美又粗又大又爽| 欧美精品日韩综合在线| 欧美一区二区国产| 337p粉嫩大胆噜噜噜噜噜91av | 国产午夜亚洲精品不卡| 国产精品青草久久| 综合中文字幕亚洲| 亚洲永久免费av| 日本亚洲天堂网| 国精品**一区二区三区在线蜜桃| 国产一区二区三区综合| 成人av在线观| 欧美日韩dvd在线观看| 欧美欧美欧美欧美首页| 日韩欧美国产一二三区| 国产农村妇女精品| 亚洲欧美视频一区| 男人的j进女人的j一区| 国产成人午夜99999| 91老司机福利 在线| 51午夜精品国产| 亚洲国产成人在线| 亚洲一区在线播放| 韩日av一区二区| 一本大道久久a久久精二百| 欧美日韩大陆一区二区| 国产拍揄自揄精品视频麻豆| 亚洲欧美日韩国产成人精品影院| 日产国产欧美视频一区精品 | 日韩毛片高清在线播放| 亚洲午夜视频在线观看| 韩国一区二区三区| 色猫猫国产区一区二在线视频| 欧美剧情片在线观看| 久久蜜臀中文字幕| 亚洲韩国一区二区三区| 国产麻豆一精品一av一免费 | 日韩精品一二三四| 高清视频一区二区| 在线不卡一区二区| 国产精品国产三级国产专播品爱网| 日韩国产高清在线| 91首页免费视频| 久久久不卡影院| 日韩成人dvd| 在线观看亚洲专区| 国产日韩成人精品| 免费看日韩精品| 色菇凉天天综合网| 国产日韩精品一区二区三区 | 国产成人精品一区二| 欧美精品三级在线观看| 一区二区三区四区高清精品免费观看| 久久成人免费网| 欧美色综合网站| 亚洲欧洲在线观看av| 国产精品99久久久久久久vr| 欧美日韩一卡二卡| 亚洲日本护士毛茸茸| 国产成人在线电影| 精品国产99国产精品| 日韩不卡一区二区| 欧美亚洲动漫另类| 日韩理论片中文av| 成人激情免费视频| 久久久99精品免费观看不卡| 免费xxxx性欧美18vr| 欧美日韩精品电影| 亚洲老司机在线| 91免费视频网| 亚洲欧美日韩系列| 日本韩国欧美一区| 中文字幕一区av| 99久久婷婷国产精品综合| 国产欧美日韩精品a在线观看| 久久精品国产亚洲高清剧情介绍 | 日韩欧美精品在线| 日本亚洲一区二区| 日韩欧美中文字幕一区| 爽好久久久欧美精品| 在线播放欧美女士性生活| 亚洲香蕉伊在人在线观| 欧美日韩国产一级片| 日本欧美一区二区| 欧美电视剧在线观看完整版| 美脚の诱脚舐め脚责91| 精品国产一区二区国模嫣然| 蜜臀久久久久久久| 久久久噜噜噜久久中文字幕色伊伊| 精品一区二区成人精品| 国产情人综合久久777777| 成人性色生活片免费看爆迷你毛片| 日本一区二区三区久久久久久久久不| 国产高清精品在线| 亚洲日本一区二区| 欧美日韩在线播放一区| 日本不卡一二三区黄网| 精品国产伦理网| 成人性色生活片| 亚洲综合久久久| 欧美一卡二卡三卡| 国产福利视频一区二区三区| 国产精品色哟哟| 91国在线观看| 麻豆一区二区99久久久久| 久久久久久久综合狠狠综合| 99精品视频在线播放观看| 亚洲综合精品久久| 日韩欧美在线123| 成人免费视频一区二区| 亚洲国产一区二区视频| 日韩精品中文字幕一区| av在线免费不卡| 蜜桃精品视频在线|