visual studio 2005 - Detect Autoscrollposition value change in panel -
how detect if autoscrollposition value changes in panel1?
for example,
textbox1 , textbox2.
which added in panel1. autoscroll property set true.
i interested in detecting when value of panel autoscrollposition changes.
the above dynamic textboxes incremented.
software in use: c#, visual studio 2005.
the component required it. is:
- listbox1
- listbox2
- panel
- button.
the namespace class:
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.text; using system.windows.forms; using system.collections;
here complete solution code:
namespace detectpanelvalue { public partial class form1 : form { private point tbpoint = new point(10, 14); private point tbbpoint = new point(300, 14); private arraylist arylst; private arraylist arylst1; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { panel1.paint += new painteventhandler(panel1_paint); } void panel1_paint(object sender, painteventargs e) { system.drawing.point pnlpt; pnlpt = panel1.autoscrollposition; if (tbpoint !=null || pnlpt != null ) { pnlpt = tbpoint; } arylst1 = new arraylist(); arylst1.add(pnlpt); } private void runtime() { foreach (point pt in arylst) { listbox1.items.add(pt); } foreach (point ptt in arylst1) { listbox2.items.add(ptt); } } private void button1_click(object sender, eventargs e) { textbox tb = new textbox(); tb.location = tbpoint; this.panel1.controls.add(tb); tbpoint.y += 30; textbox bb = new textbox(); bb.location = tbbpoint; this.panel1.controls.add(bb); tbbpoint.y += 30; arylst = new arraylist(); arylst.add(tbpoint); runtime(); } } }
it helpful adjust panel autoscrollposition.
Comments
Post a Comment