Re: ListView Column Resize



FYI - For anyone that reads through our conversation I said that the
GetWindowLong API with theGWL_STYLE parameter retrieves the correct state of
the Vertical scroll bar in lvwReport mode. This is an incorrect statement.
This control does not properly respond to this message.

For vertical scroll bar presence I retrieved the ListView per page count
with LVM_GETCOUNTPERPAGE and compared it to the total count in the list
view.

Using your code below and taking into account the scroll bar presence and
all the original colomn totalling logic I can somewhat accurately determine
both the full size of the control and the totalled components.

I now have to use all this information and combine it with all the column
resize hooking I did plus the mouse tracking.

Thanks Ken the following sample does clear up some of the gaps in my memory
on how some of this stuff works.



"Ken Halter" <Ken_Halter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:eiEM7mOqFHA.1324@xxxxxxxxxxxxxxxxxxxxxxx
> "Dave" <KingOfTheBeach@xxxxxxxxxxxxxxxx> wrote in message
> news:uMRD2SOqFHA.712@xxxxxxxxxxxxxxxxxxxxxxx
> > Ken,
> >
> > Were you confirming my statement "Some controls like the Picture control
> > have Properties called Width and ScaleWidth, so if I cheated and used
the
> > delta between the picture controls width and scale width would that be a
> > reliable fudge factor to use in my calculations to accommodate for this
> > border width." ?
> >
> > Dave
>
> This looks pretty accurate. Basically, it's GetWindowRect - GetClientRect
> '===============
> Option Explicit
>
> Private Declare Function GetClientRect _
> Lib "user32.dll" (ByVal hwnd As Long _
> , ByRef lpRect As RECT) As Long
>
> Private Declare Function GetWindowRect _
> Lib "user32.dll" (ByVal hwnd As Long _
> , ByRef lpRect As RECT) As Long
>
> Private Type RECT
> Left As Long
> Top As Long
> Right As Long
> Bottom As Long
> End Type
>
>
> Private Sub Command1_Click()
> Dim r1 As RECT
> Dim r2 As RECT
>
> Call GetClientRect(ListView1.hwnd, r1)
> Call GetWindowRect(ListView1.hwnd, r2)
>
> 'Debug.Assert False
>
> With r2
> .Bottom = .Bottom - .Top
> .Right = .Right - .Left
> End With
>
> 'Shows 3 pixels per side difference (border single and 3d)
> 'Shows 1 pixel per side difference (border single and flat)
> 'Shows 0 pixels per side difference (border none and flat)
> Debug.Print r2.Right, r1.Right, r2.Right - r1.Right
> Debug.Print r2.Bottom, r1.Bottom, r2.Bottom - r1.Bottom
>
> Debug.Assert False 'stops here (for setting a watch/etc)
>
> End Sub
> '===============
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> Please keep all discussions in the groups..
>
>


.



Relevant Pages

  • Re: If statement problem
    ... To show full width without a horizontal scroll bar, ... Do you have a Default Value set for the checkbox control? ... "Knowlton" wrote in message ... >>> figure out why it isn't working in the Sub. ...
    (microsoft.public.access.formscoding)
  • RE: Multi Page Scroll Bar
    ... When you enter a tab page, the first control in the tab sequence will have ... Private Sub MultiPage2_Scroll(ByVal Index As Long, ... I am trying to get the horizontal scroll bar on a MultiPage page to work. ...
    (microsoft.public.excel.programming)
  • Re: ActiveX Calendar control on a modal form
    ... let's call it "behaviour by design" or something.... ... scroll bar was one of the first things I added. ... I can do without the scroll bar, but yet, this smells a bit like a bug. ... You appear to have copied the control from another form. ...
    (microsoft.public.fox.helpwanted)
  • Re: Create a label with scroll bars?
    ... "Jeff Boyce" wrote: ... If you use a textbox control to hold the contents of an underlying table ... You've described a "how" (label with scroll bar). ...
    (microsoft.public.access.forms)
  • Re: How to add a Dialog in a View
    ... That, is, a POINTER TO A RECT STRUCTURE! ... That causes the framework to call OnDraw. ... void CPreviewDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT ... Resizing a picture control in a formview ...
    (microsoft.public.vc.mfc)

Loading