Scroll in image background view

Hello …
When i put a background image in a view , i need scrollbars in the document when image is bigger than the visible area…

How are you adding the background image to the view?

did u receive my e-mail …

no… don’t see anything in my Inbox.

view.BackgroundImage := Bitmap.FromFile(dlg.FileName); // this way

I know i can do this for example but i don’t want image adjustment to the
visible work area … i want scrolls, i know it appers when i move the
objects so i don’t how can i force it …
dlg: OpenFileDialog;
view: TView;
img : GoImage;

img := GoImage.Create;
img.Name := dlg.FileName; // filename
img.Bounds :=view.DocumentExtent ;
r := view.DocumentExtent;

GoView has ShowHorizontalScrollBar (and ShowVerticalScrollBar) that can be set to Hide, Show or IfNeeded.

Jake, i think u don’t understand exactly what i want … i try what u
said but the scrolls are disable … I need when i put the background
image if the picture is bigger than the visible area the scrolls enable
to see the entire image … even i have no element in the view …

Set the Document.Bounds to the size of the image.

Thank u Jake … it works perfect …

There is a problem here. If i have an image that is smaller than the document, document size is reduced.

But I have try this.

  doc.Bounds.Width = Math.Max(doc.Bounds.Width, img.Bounds.Width);
  doc.Bounds.Height = Math.Max(doc.Bounds.Height, img.Bounds.Height);

but image size is less than document size and anyway image is not visible as is in my file system.

I dont if I have to convert some cordinate whit any function ConvertoViewToDocument o ConvertDocumentToView.

Right… you don’t want to make the Document smaller than objects contained within in.

doc.ComputeBounds() will compute the bounds of the document objects.

Note documents will get larger as objects are added or moved, but don’t shrink when objects are removed or moved.

JEJE I dont know why but changing width directly with doc.Bound.Width and Height did not work. But I change it creating a temporary RectangleF variable and was set to doc.Bound and it work perfect.

the code.

img = new GoImage();
img.Name = dlg.FileName;
doc = view.Document;
RectangleF r = new RectangleF(0,0, Math.Max(doc.Bounds.Width, img.Width), Math.Max(doc.Bounds.Height, img.Height));
doc.Bounds := r;

view.BackgroundImage := Bitmap.FromFile(dlg.FileName);

I try with doc.ComputeBounds() but backgroud image is shrank too.

My solution was created in my previous post. it work perfect.