I am working on an application that allows users to potentially select portions of text, or pictures, from within a richview document. When these various portions of the document are selected, we want to enahance them to make it obvious that they are selected. I have worked out the text part of this, but when the pictures are selected, they are marked with a thin border. Is there any way to make this border wider, or to otherwise make this graphic stand out from the rest of the contents of the document?
Any suggestions would be greatly appreciated!
Thanks
jbmmpm
Some questions about selection of pictures (or hot-pictures)
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
There are no other ways of displaying picture selection supported.
Ok, I'll include the following changes in the next update.
1) New procedure
2) Changes in RVItem.pas:
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
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;
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;
Problems:
- animation is not supported, selection will not be shown properly for animated pictures;
- selected picture is shaded even when resize handles are shown