[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DocumentView confusion
[Thread Prev] | [Thread Next]
- Subject: Re: DocumentView confusion
- From: Lee <t.lee.davidson@xxxxxxxxx>
- Date: Sat, 15 Nov 2025 14:28:13 -0500
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On 11/15/25 5:56 AM, gbWilly wrote:
On Saturday, November 15th, 2025 at 00:09, Lee <t.lee.davidson@xxxxxxxxx> wrote:I thought I might investigate this but ...... How in the world does one load a document into DocumentView?
[snip]
Public Sub DocumentView1_Draw(Page As Integer, Width As Integer, Height As Integer) Paint.DrawImage($hPdfFile[Page].Render(0, 0, Width, Height), 0, 0) End
[snip]Okay. So one does not "load" a document into DocumentView. It must be rendered in the Draw event with code customized for the particular type of document being viewed. I did not find that mentioned on the Wiki.
Now, I think there are a couple of issues here: 1. The existence of one or more bugs,2. The documentation is confusing due to the redundancy of the FirstVisible-Document/Page properties (they represent the same values) and their conflicting descriptions. The Document-Height/Width properties also represent the same values as Page-Height/Width.
From a cursory look at the DocumentView code, it seems apparent that a document's page number, in its properties and methods, is referenced by its index (starting at 0) not its visual page number. This would mean that the value for LastVisibleDocument, and LastVisiblePage, may always be incorrect.
Document.Goto's integer parameter is obviously to be a page's index. If I use that method to go to the page at index 5, the view displays visual Page 6 of the document as it should. However, the ShowPage display says that the view is on page 5 even though only Page 6 is visible.
Also while still on the page at index 5, the value of FirstVisibleDocument is 4 while the value of LastVisibleDocument is 6. Both are incorrect.
The above results were obtained with a PDF document of size US Letter (8.5 x 11 inch) with .DocumentHeight and .DocumentWidth set to 280 and 215, respectively, and with a view port size that can show only a partial page at a time.
-- Lee --- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ---- --- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----
| Re: DocumentView confusion | Fabien Bodard <gambas.fr@xxxxxxxxx> |
| Re: DocumentView confusion | gbWilly <gbWilly@xxxxxxxxxxxxxx> |
| DocumentView confusion | gbWilly <gbWilly@xxxxxxxxxxxxxx> |
| Re: DocumentView confusion | Lee <t.lee.davidson@xxxxxxxxx> |
| Re: DocumentView confusion | gbWilly <gbWilly@xxxxxxxxxxxxxx> |