Thursday, January 14, 2016
SmartPhone how to control ListView scrollbar trigger an event when it rolling?
Is when the ListView scrollbar slide to the bottom, when adding a new ListView value.
If you are using keys to control it is possible. However, if the stylus to slide the scroll bar just key irrelevant.
I know Windows can be achieved under the
Rewriting ListView class:
public class MyListView: ListView
{
public MyListView ()
: Base ()
{
unsafe
{
SCROLLINFO_SIZE = sizeof (Win32API.tagSCROLLINFO);
}
}
public int SCROLLINFO_SIZE;
unsafe protected override void WndProc (ref Message msg)
{
base.WndProc (ref msg);
if (msg.Msg == 0x0115)
{
Win32API.tagSCROLLINFO info = new Win32API.tagSCROLLINFO ();
info.cbSize = (uint) SCROLLINFO_SIZE;
info.fMask = (uint) (Win32API.fMask.SIF_POS | Win32API.fMask.SIF_PAGE | Win32API.fMask.SIF_RANGE);
Win32API.GetScrollInfo (msg.HWnd, (int) Win32API.fnBar.SB_VERT, new IntPtr (& amp; info));
// You can get the scrollbar position here.
//MessageBox.Show (Info.nMin.ToString () + "," + info.nPos.ToString () + "," + info.nMax.ToString () + "," + info.nPage.ToString ()) ;
if (info.nPos + info.nPage - 1 == info.nMax)
{
for (int i = 0; i & lt; 3; i ++)
{
this.Items.Add ("thisismore" + i.ToString ());
}
}
}
}
}
public class Win32API
{
[StructLayout (LayoutKind.Sequential)]
public struct tagSCROLLINFO
{
public uint cbSize;
public uint fMask;
public int nMin;
public int nMax;
public uint nPage;
public int nPos;
public int nTrackPos;
}
public enum fnBar
{
SB_HORZ = 0,
SB_VERT = 1,
SB_CTL = 2
}
public enum fMask
{
SIF_ALL,
SIF_DISABLENOSCROLL = 0X0010,
SIF_PAGE = 0X0002,
SIF_POS = 0X0004,
SIF_RANGE = 0X0001,
SIF_TRACKPOS = 0X0008
}
[DllImport ("USER32.DLL", EntryPoint = "GetScrollInfo")]
public static extern bool GetScrollInfo (IntPtr hwnd, int fnBar, IntPtr lpscrollinfo);
}
To accept the message and then determine the ListView scrollbar position is not the end to add the new data.
But when I do the same to the SP, but found no System.Windows.Forms.Message this structure?!
So is there any way to achieve it?
Or use other methods to achieve this function?
Reply:
Is not enough points ah? I can add ah.
I now find the following smartphone plus Microsoft.WindowsCE.Forms, there is a Message.
But it reported WndProc error.
I think it might be caused by two Forms space, it removed System.Windows.Forms
But it reported ListView error ...
Now head fog, have not encountered similar problems ah?
Reply:
You mainly want to solve too many entries listview disposable add more time-consuming problem?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment