There are no other ways of displaying picture selection supported.
Ok, I'll include the following changes in the next update.
1) New procedure
Code: Select all
procedure ShadeRectangle(Canvas: TCanvas; const R: TRect; Color: TColor);
const
Bits: array[0..7] of Word =
($55, $aa, $55, $aa,
$55, $aa, $55, $aa);
var
Bitmap: HBitmap;
SaveBrush: HBrush;
SaveTextColor, SaveBkColor: TColorRef;
DC: HDC;
begin
DC := Canvas.Handle;
Bitmap := CreateBitmap(8, 8, 1, 1, @Bits);
SaveBrush := SelectObject(DC, CreatePatternBrush(Bitmap));
try
SaveTextColor := SetTextColor(DC, clBlack);
SaveBkColor := SetBkColor(DC, clWhite);
with R do
PatBlt(DC, Left, Top, Right - Left, Bottom - Top, $00A000C9); // and
SetTextColor(DC, ColorToRGB(Color));
SetBkColor(DC, clBlack);
with R do
PatBlt(DC, Left, Top, Right - Left, Bottom - Top, $00FA0089); // or
SetBkColor(DC, SaveBkColor);
SetTextColor(DC, SaveTextColor);
finally
DeleteObject(SelectObject(DC, SaveBrush));
DeleteObject(Bitmap);
end;
end;
2) Changes in RVItem.pas:
Code: Select all
procedure TRVGraphicItemInfo.Paint(x, y: Integer; Canvas: TCanvas;
State: TRVItemDrawStates; Style: TRVStyle; dli: TRVDrawLineInfo);
var w,h: Integer;
SelColor: TColor;
{...............................................}
<subprocedures here>
{...............................................}
begin
w := GetImageWidth(Style);
h := GetImageHeight(Style);
inc(x, Spacing); inc(y, Spacing);
{$IFNDEF RVDONOTUSEANIMATION}
if FAnimator<>nil then
TRVAnimator(FAnimator).Draw(x,y,Canvas, False)
else
{$ENDIF}
if ImageCopy<>nil then
if ImageCopy is TBitmap then
DrawBmp
else
DrawImage(ImageCopy)
else
DrawImage(Image);
if (rvidsSelected in State) then begin
if rvidsControlFocused in State then
SelColor := Style.SelColor
else
SelColor := Style.InactiveSelColor;
{$IFDEF RVSHADESELECTION}
ShadeRectangle(Canvas, Bounds(x,y,w,h), SelColor);
{$ELSE}
Canvas.Pen.Color := SelColor;
Canvas.Brush.Style := bsClear;
if Canvas.Pen.Color<>clNone then begin
Canvas.Pen.Style := psSolid;
Canvas.Pen.Width := 1;
Canvas.Rectangle(x-Spacing,y-Spacing, x+w+Spacing, y+h+Spacing);
end;
{$ENDIF}
end;
if (rvidsCurrent in State) and (Style.CurrentItemColor<>clNone) then begin
Canvas.Pen.Width := 1;
Canvas.Pen.Color := Style.CurrentItemColor;
Canvas.Pen.Style := psSolid;
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(x-Spacing-1,y-Spacing-1, x+w+Spacing+1, y+h+Spacing+1);
end;
end;
If the project is compiled with RVSHADESELECTION define (you can add it in RV_Defs.inc or in the project options), selected pictures will be shown shaded with selection color.
Problems:
- animation is not supported, selection will not be shown properly for animated pictures;
- selected picture is shaded even when resize handles are shown