📄 ieview.pas
字号:
(*
Copyright (c) 1998-2007 by HiComponents. All rights reserved.
This software comes without express or implied warranty.
In no case shall the author be liable for any damage or unwanted behavior of any
computer hardware and/or software.
HiComponents grants you the right to include the compiled component
in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE,
BUT YOU MAY NOT DISTRIBUTE THIS SOURCE CODE OR ITS COMPILED .DCU IN ANY FORM.
ImageEn, IEvolution and ImageEn ActiveX may not be included in any commercial,
shareware or freeware libraries or components.
email: support@hicomponents.com
http://www.hicomponents.com
*)
unit ieview;
{$R-}
{$Q-}
{$HINTS OFF}
{$I ie.inc}
interface
uses Windows, Messages, SysUtils, controls, forms, classes, graphics, hyieutils;
{$IFDEF FPC}
uses SysUtils,Classes,hyieutils,hyiedefs;
{$ENDIF}
type
// called to notify that Bitmap has changed
TIEBitmapChangeEvent = procedure(Sender: TObject; destroying: boolean) of object;
PIEBitmapChangeEvent = ^TIEBitmapChangeEvent;
{!!
<FS>TIEView
<FM>Description<FN>
TIEView is the base abstract class for TImageEnView and TImageEnMView.
!!}
// Base class for TImageEnView and TImageEnMView
TIEView = class(TCustomControl)
private
FBorderStyle: TBorderStyle;
fBmpChange: TList; // methods list to call when Bitmap changes
fOnMouseEnter: TNotifyEvent;
fOnMouseLeave: TNotifyEvent;
procedure SetBorderStyle(Value: TBorderStyle);
function GetCtl3D: boolean;
procedure SetCtl3D(v: boolean);
protected
fBackGround: TColor;
fDPIX, fDPIY: integer; // horizontal and vertical dpi
procedure SetBackGround(cl: TColor); virtual;
function GetFBitmap: TBitmap; virtual;
function GetIEBitmap: TIEBitmap; virtual;
procedure CreateParams(var Params: TCreateParams); override;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
function GetAlphaChannel: TIEBitmap; virtual; abstract;
function GetHasAlphaChannel: boolean; virtual; abstract;
public
{$IFDEF OCXVERSION}
ReplyMessageTo: HWND;
{$ENDIF}
procedure RemoveAlphaChannel(Merge: boolean); virtual; abstract;
procedure LockPaint; virtual; abstract;
function UnLockPaint: integer; virtual; abstract;
function NPUnLockPaint: integer; virtual; abstract;
procedure SetDPIX(dpiX: integer); virtual;
procedure SetDPIY(dpiY: integer); virtual;
procedure SetDPI(dpiX, dpiY: integer); virtual;
procedure ImageChange; virtual;
constructor Create(Owner: TComponent); override;
destructor Destroy; override;
property DpiX: integer read fDpiX write SetDPIX;
property DpiY: integer read fDpiY write SetDPIY;
property Bitmap: TBitmap read GetFBitmap;
property IEBitmap: TIEBitmap read GetIEBitmap;
procedure CallBitmapChangeEvents; virtual;
function RegisterBitmapChangeEvent(v: TIEBitmapChangeEvent): integer;
procedure RemoveBitmapChangeEvent(idx: integer);
function GetCanvas: TCanvas;
property AlphaChannel: TIEBitmap read GetAlphaChannel;
property HasAlphaChannel: boolean read GetHasAlphaChannel;
{$IFDEF OCXVERSION}
procedure WndProc(var Message: TMessage); override;
{$ENDIF}
published
property Background: TColor read fBackGround write SetBackGround default clBtnFace;
property Ctl3D read GetCtl3D write SetCtl3d default true;
property ParentCtl3D;
{!!
<FS>TIEView.OnMouseEnter
<FM>Declaration<FC>
property OnMouseEnter:TNotifyEvent;
<FM>Description<FN>
OnMouseEnter occurs when the mouse pointer moves over the component. Write an OnMouseEnter event handler to take specific action when the user moves the mouse over the component.
!!}
property OnMouseEnter: TNotifyEvent read fOnMouseEnter write fOnMouseEnter;
{!!
<FS>TIEView.OnMouseLeave
<FM>Declaration<FC>
property OnMouseLeave:TNotifyEvent;
<FM>Description<FN>
OnMouseLeave occurs when the mouse pointer moves off of the component. Write an OnMouseLeave event handler to take specific action when the user moves the mouse off the component.
!!}
property OnMouseLeave: TNotifyEvent read fOnMouseLeave write fOnMouseLeave;
property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle;
end;
// GLOBAL FIELDS
var
gSystemColors: integer; // display colors number (bit per pixel)
gIsRemoteSession: boolean; // this is a RDP session
gSystemDPIX, gSystemDPIY: integer; // system's DPIX and DPIY
{!!
<FS>gDefaultDPIX
<FM>Declaration<FC>
gDefaultDPIX: integer;
<FM>Description<FN>
Specify the default DPI X value assigned when a loaded image doesn't contain this information. Default value is 300 for both X and Y.
!!}
gDefaultDPIX: integer;
{!!
<FS>gDefaultDPIY
<FM>Declaration<FC>
gDefaultDPIY: integer;
<FM>Description<FN>
Specify the default DPI Y value assigned when a loaded image doesn't contain this information. Default value is 300 for both X and Y.
!!}
gDefaultDPIY: integer;
gMMX: boolean; // CPU supports MMX
gEdgeX, gEdgeY: integer; // system border edges (3d)
gBorderX, gBorderY: integer; // system border edges
gVScrollWidth, gHScrollHeight: integer; // system scrollbar sizes
implementation
uses iemview;
/////////////////////////////////////////////////////////////////////////////////////
procedure TIEView.ImageChange;
begin
//
end;
/////////////////////////////////////////////////////////////////////////////////////
constructor TIEView.Create(Owner: TComponent);
begin
{$IFDEF OCXVERSION}
ReplyMessageTo := 0;
{$ENDIF}
inherited;
{$ifdef IEDELPHI11}
ControlStyle := ControlStyle + [csOpaque, csAcceptsControls, csReplicatable, csNeedsBorderPaint];
{$endif}
{$ifdef IEDELPHI10}
ControlStyle := ControlStyle + [csOpaque, csAcceptsControls, csReplicatable, csNeedsBorderPaint];
{$endif}
{$ifdef IEDELPHI9}
ControlStyle := ControlStyle + [csOpaque, csAcceptsControls, csReplicatable, csNeedsBorderPaint];
{$endif}
{$ifdef IEDELPHI7}
ControlStyle := ControlStyle + [csOpaque, csAcceptsControls, csReplicatable, csNeedsBorderPaint];
{$else}
ControlStyle := ControlStyle + [csOpaque, csAcceptsControls, csReplicatable];
{$endif}
if not NewStyleControls then
ControlStyle := ControlStyle + [csFramed];
fOnMouseEnter := nil;
fOnMouseLeave := nil;
controlstyle := controlstyle + [csOpaque];
fBackground := clBtnFace;
FBorderStyle := bsSingle;
fBmpChange := TList.Create;
Ctl3D := true;
end;
destructor TIEView.Destroy;
begin
while fBmpChange.Count > 0 do
begin
if assigned(fBmpChange[0]) then
PIEBitmapChangeEvent(fBmpChange[0])^(self, true);
dispose(fBmpChange[0]);
fBmpChange.Delete(0);
end;
FreeAndNil(fBmpChange);
inherited;
end;
{!!
<FS>TIEView.SetDPI
<FM>Declaration<FC>
procedure SetDPI(dpiX, dpiY: integer);
<FM>Description<FN>
The SetDPI method sets the horizontal (DpiX) and vertical (DpiY) dots per inch of the current image. These values will be saved together with the image.
!!}
procedure TIEView.SetDPI(dpiX, dpiY: integer);
begin
SetDPIX(dpiX);
SetDPIY(dpiY);
end;
{!!
<FS>TIEView.DpiX
<FM>Declaration<FC>
property DpiX: integer;
<FM>Description<FN>
DpiX is the number of horizontal dots (pixels) per inch of the image. This value is loaded and saved to file in TImageEnIO component.
!!}
procedure TIEView.SetDPIX(dpiX: integer);
begin
if dpiX <> 0 then
fDPIX := dpiX;
end;
{!!
<FS>TIEView.DpiY
<FM>Declaration<FC>
property DpiY: integer;
<FM>Description<FN>
DpiY is the number of vertical dots (pixels) per inch of the image. This value is loaded and saved to file in TImageEnIO component.
!!}
procedure TIEView.SetDPIY(dpiY: integer);
begin
if dpiY <> 0 then
fDPIY := dpiY;
end;
function TIEView.GetFBitmap: TBitmap;
begin
result := nil;
end;
function TIEView.GetIEBitmap: TIEBitmap;
begin
result := nil;
end;
/////////////////////////////////////////////////////////////////////////////////////
// La propriet
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -