[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DocumentView confusion
[Thread Prev] | [Thread Next]
- Subject: Re: DocumentView confusion
- From: gbWilly <gbWilly@xxxxxxxxxxxxxx>
- Date: Sun, 16 Nov 2025 00:05:21 +0000
- To: Lee <t.lee.davidson@xxxxxxxxx>
- Cc: user@xxxxxxxxxxxxxxxxxxxxxx
On Saturday, November 15th, 2025 at 20:28, Lee <t.lee.davidson@xxxxxxxxx> wrote: > 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. That is what I meant with loading the document ;-) > > 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. I have to agree with both points, the documentation is confusing and there are bugs, but where? > 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. Thanks Lee, for checking. What I learned is that DocumentView acts correctly when using the index (not the page), but will bring you to the correct page, so if I stick to indexes all works as expected. The First... and Last... properties make no sense and are strange at least when observing what they produce. The property ShowPage can be strange too at times. I have seen strange results returned by setting ShowPage. To clarify going to index 1 should show page 1 (using ShowPage), going to page 2 should show page 2. I have had cases where going to index 1 showed page 1 and I could NOT go to index 0 (which is actually page 1) although in the beginning it did, This happens when using mouse wheel at times, it seems. I'm glad you are discovering strangeness as well. If the both First... properties are the same and the both Last... properties are the same and are both the index then that should be clear on the wiki. Do you even need both and is FirstVisiblePage and LastVisiblePage not a misleading term? Could FirstVisibleDocument state that it is the index and make FirstVisiblePage return (FirstVisibleDocument + 1), so the page as the name indicates? What do FirstVisibleDocument and LastVisibleDocument actually represent. FirstVisibleDocument.correctly returns the page shown and indicated by ShowPage that it is the active page. But what is LastVisibleDocument as its value is always 2 more that FirstVisibleDocument and I can ensure you that when FirstVisibleDocument is active only part of the next page (and not 2 pages down) can be seen (seeing something means visible, right?) So 2 pages down I can't see (NOT visible, right?). Trouble seems to be in the DocumentView, so maybe some TLC (Tender Love and Care) would be in place. gbWilly
| DocumentView confusion | gbWilly <gbWilly@xxxxxxxxxxxxxx> |
| Re: DocumentView confusion | Lee <t.lee.davidson@xxxxxxxxx> |
| Re: DocumentView confusion | gbWilly <gbWilly@xxxxxxxxxxxxxx> |
| Re: DocumentView confusion | Lee <t.lee.davidson@xxxxxxxxx> |