dxskinscore.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 2,155 行 · 第 1/5 页
PAS
2,155 行
begin
FGradient := AValue;
DoChange;
end;
end;
procedure TdxSkinImage.SetImageLayout(AValue: TdxSkinImageLayout);
begin
if ImageLayout <> AValue then
begin
FImageLayout := AValue;
DoChange;
end;
end;
procedure TdxSkinImage.SetMargins(AValue: TcxRect);
begin
FMargins.Assign(AValue);
end;
procedure TdxSkinImage.SetStates(AValue: TdxSkinElementStates);
begin
if FStates <> AValue then
begin
FStates := AValue;
DoChange;
end;
end;
procedure TdxSkinImage.SetStretch(AValue: TdxSkinStretchMode);
begin
if Stretch <> AValue then
begin
FStretch := AValue;
DoChange;
end;
end;
procedure TdxSkinImage.SetTransparentColor(AValue: TColor);
begin
if AValue <> TransparentColor then
begin
FTransparentColor := AValue;
DoChange;
end;
end;
procedure TdxSkinImage.SetName(const AValue: string);
begin
LoadFromFile(AValue);
end;
procedure TdxSkinImage.SubItemHandler(Sender: TObject);
begin
DoChange;
end;
{ TdxSkinCustomPersistentObject }
constructor TdxSkinCustomPersistentObject.Create(
AOwner: TPersistent; const AName: string);
begin
FName := AName;
FOwner := AOwner;
end;
function TdxSkinCustomPersistentObject.Clone: TdxSkinCustomPersistentObject;
var
AClass: TdxSkinCustomPersistentObjectClass;
begin
AClass := TdxSkinCustomPersistentObjectClass(ClassType);
Result := AClass.Create(nil, Name);
Result.Assign(Self);
end;
procedure TdxSkinCustomPersistentObject.DoChange;
begin
if Assigned(FOnChange) then
FOnChange(Self);
end;
function TdxSkinCustomPersistentObject.GetOwner: TPersistent;
begin
Result := FOwner;
end;
{ TdxSkinProperty }
class procedure TdxSkinProperty.Register;
begin
RegisteredPropertyTypes.Add(Self);
RegisterClass(Self);
end;
class procedure TdxSkinProperty.Unregister;
begin
UnRegisterClass(Self);
RegisteredPropertyTypes.Remove(Self);
end;
class function TdxSkinProperty.Description: string;
begin
Result := StringReplace(ClassName,
'TdxSkin', '', [rfReplaceAll, rfIgnoreCase]);
Result := StringReplace(Result, 'Property', '', [rfReplaceAll, rfIgnoreCase]);
end;
function TdxSkinProperty.Compare(AProperty: TdxSkinProperty): Boolean;
begin
Result := False;
end;
procedure TdxSkinProperty.ReadData(Stream: TStream);
begin
end;
procedure TdxSkinProperty.ReadFromStream(Stream: TStream);
begin
Name := ReadStringFromStream(Stream);
ReadData(Stream);
end;
procedure TdxSkinProperty.WriteData(Stream: TStream);
begin
end;
procedure TdxSkinProperty.WriteToStream(Stream: TStream);
begin
WriteStringToStream(Stream, ClassName);
WriteStringToStream(Stream, Name);
WriteData(Stream);
end;
{ TdxSkinIntegerProperty }
procedure TdxSkinIntegerProperty.Assign(Source: TPersistent);
begin
if Source is TdxSkinIntegerProperty then
Value := TdxSkinIntegerProperty(Source).Value
else
inherited Assign(Source);
end;
function TdxSkinIntegerProperty.Compare(AProperty: TdxSkinProperty): Boolean;
begin
Result := (AProperty.Name = Name) and (AProperty is TdxSkinIntegerProperty) and
(TdxSkinIntegerProperty(AProperty).Value = Value);
end;
procedure TdxSkinIntegerProperty.ReadData(Stream: TStream);
begin
Stream.ReadBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinIntegerProperty.WriteData(Stream: TStream);
begin
Stream.WriteBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinIntegerProperty.SetValue(AValue: Integer);
begin
if AValue <> FValue then
begin
FValue := AValue;
DoChange;
end;
end;
{ TdxSkinBooleanProperty }
procedure TdxSkinBooleanProperty.Assign(Source: TPersistent);
begin
if Source is TdxSkinBooleanProperty then
Value := TdxSkinBooleanProperty(Source).Value
else
inherited Assign(Source);
end;
function TdxSkinBooleanProperty.Compare(AProperty: TdxSkinProperty): Boolean;
begin
Result := (AProperty.Name = Name) and (AProperty is TdxSkinBooleanProperty) and
(TdxSkinBooleanProperty(AProperty).Value = Value)
end;
procedure TdxSkinBooleanProperty.ReadData(Stream: TStream);
begin
Stream.ReadBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinBooleanProperty.WriteData(Stream: TStream);
begin
Stream.WriteBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinBooleanProperty.SetValue(AValue: Boolean);
begin
if AValue <> FValue then
begin
FValue := AValue;
DoChange;
end;
end;
{ TdxSkinColor }
constructor TdxSkinColor.Create(AOwner: TPersistent; const AName: string);
begin
inherited Create(AOwner, AName);
FValue := clDefault;
end;
procedure TdxSkinColor.Assign(Source: TPersistent);
begin
if Source is TdxSkinColor then
Value := TdxSkinColor(Source).Value
else
inherited Assign(Source);
end;
function TdxSkinColor.Compare(AProperty: TdxSkinProperty): Boolean;
begin
Result := (AProperty.Name = Name) and (AProperty is TdxSkinColor) and
(TdxSkinColor(AProperty).Value = Value);
end;
procedure TdxSkinColor.ReadData(Stream: TStream);
begin
Stream.ReadBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinColor.WriteData(Stream: TStream);
begin
Stream.WriteBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinColor.SetValue(AValue: TColor);
begin
if AValue <> FValue then
begin
FValue := AValue;
DoChange;
end;
end;
{ TdxSkinRectProperty }
constructor TdxSkinRectProperty.Create(AOwner: TPersistent; const AName: string);
begin
inherited Create(AOwner, AName);
FValue := TcxRect.Create(Self);
FValue.OnChange := InternalHandler;
end;
destructor TdxSkinRectProperty.Destroy;
begin
FValue.Free;
inherited Destroy;
end;
procedure TdxSkinRectProperty.Assign(Source: TPersistent);
begin
if Source is TdxSkinRectProperty then
Value := TdxSkinRectProperty(Source).Value
else
inherited Assign(Source);
end;
function TdxSkinRectProperty.Compare(AProperty: TdxSkinProperty): Boolean;
begin
Result := (AProperty.Name = Name) and (AProperty is TdxSkinRectProperty) and
TdxSkinRectProperty(AProperty).Value.IsEqual(Value);
end;
procedure TdxSkinRectProperty.ReadData(Stream: TStream);
var
ARect: TRect;
begin
Stream.ReadBuffer(ARect, SizeOf(TRect));
FValue.Rect := ARect;
end;
procedure TdxSkinRectProperty.WriteData(Stream: TStream);
begin
Stream.WriteBuffer(FValue.Rect, SizeOf(TRect));
end;
function TdxSkinRectProperty.GetValueByIndex(Index: Integer): Integer;
begin
Result := FValue.GetValue(Index);
end;
procedure TdxSkinRectProperty.SetValue(Value: TcxRect);
begin
FValue.Assign(Value);
end;
procedure TdxSkinRectProperty.SetValueByIndex(Index, Value: Integer);
begin
FValue.SetValue(Index, Value);
end;
procedure TdxSkinRectProperty.InternalHandler(Sender: TObject);
begin
DoChange;
end;
{ TdxSkinSizeProperty }
procedure TdxSkinSizeProperty.Assign(Source: TPersistent);
begin
if Source is TdxSkinSizeProperty then
Value := TdxSkinSizeProperty(Source).Value
else
inherited Assign(Source);
end;
function TdxSkinSizeProperty.Compare(AProperty: TdxSkinProperty): Boolean;
begin
Result := (AProperty.Name = Name) and (AProperty is TdxSkinSizeProperty);
if Result then
with TdxSkinSizeProperty(AProperty) do
Result := ((Self.Value.cx) = Value.cx) and ((Self.Value.cy) = Value.cy);
end;
function TdxSkinSizeProperty.GetValueByIndex(Index: Integer): Integer;
begin
if Index = 0 then
Result := FValue.cx
else
Result := FValue.cy
end;
procedure TdxSkinSizeProperty.SetValueByIndex(Index, Value: Integer);
var
AValue: TSize;
begin
AValue := FValue;
if Index = 0 then
AValue.cx := Value
else
AValue.cy := Value;
SetValue(AValue);
end;
procedure TdxSkinSizeProperty.ReadData(Stream: TStream);
begin
Stream.ReadBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinSizeProperty.WriteData(Stream: TStream);
begin
Stream.WriteBuffer(FValue, SizeOf(FValue));
end;
procedure TdxSkinSizeProperty.SetValue(const Value: TSize);
begin
if (Value.cx <> FValue.cx) or (Value.cy <> FValue.cy) then
begin
FValue := Value;
DoChange;
end;
end;
{ TdxSkinBorder }
constructor TdxSkinBorder.Create(AOwner: TPersistent; const AName: string);
begin
inherited Create(AOwner, AName);
FColor := clNone;
FThin := 1;
end;
procedure TdxSkinBorder.Assign(Source: TPersistent);
var
ASource: TdxSkinBorder;
begin
if not (Source is TdxSkinBorder) then Exit;
ASource := TdxSkinBorder(Source);
Color := ASource.Color;
FKind := ASource.Kind;
Thin := ASource.Thin;
end;
function TdxSkinBorder.Compare(AProperty: TdxSkinProperty): Boolean;
begin
Result := (AProperty is TdxSkinBorder);
if Result then
with TdxSkinBorder(AProperty) do
begin
Result := (Color = Self.Color) and (Thin = Self.Thin) and
(Kind = Self.Kind);
end;
end;
procedure TdxSkinBorder.Draw(DC: HDC; const ABounds: TRect);
var
ACanvas: TdxSkinCanvas;
begin
if Color = clNone then Exit;
ACanvas := TdxSkinCanvas.Create;
try
ACanvas.BeginPaint(DC, ABounds);
DrawEx(ACanvas, ABounds);
ACanvas.EndPaint;
finally
ACanvas.Free;
end;
end;
procedure TdxSkinBorder.DrawEx(ACanvas: TdxSkinCanvas; const ABounds: TRect);
begin
if Color = clNone then Exit;
with ABounds do
case Kind of
bLeft:
ACanvas.FillRectByColor(Rect(Left, Top, Left + Thin, Bottom), Color);
bTop:
ACanvas.FillRectByColor(Rect(Left, Top, Right, Top + Thin), Color);
bRight:
ACanvas.FillRectByColor(Rect(Right - Thin, Top, Right, Bottom), Color);
bBottom:
ACanvas.FillRectByColor(Rect(Left, Bottom - Thin, Right, Bottom), Color);
end;
end;
procedure TdxSkinBorder.ReadData(Stream: TStream);
var
AColor: TColor;
begin
Stream.Read(AColor, SizeOf(FColor));
Stream.Read(FThin, SizeOf(FThin));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?