C# TreeView.EnsureVisible() - how else can I scroll? -


on treeview here: left treeview before ensurevisible(), , right after

the icon neglected. can't figure out how show icon after using ensurevisible() , use alternative ensurevisible() can't find way manually scroll. there? maybe nativemethods user32.dll or ?

enter image description here

"left: treeview before ensurevisible, , right: after"

you'll have use little external wizardry:

using system.runtime.interopservices; //..  [dllimport("user32.dll", charset = charset.auto)] public static extern int getscrollpos(intptr hwnd, int nbar);  [dllimport("user32.dll")] static extern int setscrollpos(intptr hwnd, int nbar, int npos, bool bredraw);  private const int sb_horz = 0x0; private const int sb_vert = 0x1;   // bring node display somenode.ensurevisible();  // can scroll way left: setscrollpos(treeview1.handle, sb_horz, 0, true); // ..or few pixels: int spos = getscrollpos( treeview1.handle, sb_horz); setscrollpos(treeview1.handle, sb_horz, spos - 20, true); 

or whole scrolling function using sb_vert constant. you'd have calculate position in pixels chosen node, though, may pain..

if see flicker should wrap scrolling in suspendlayout() , resumelayout() block.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -