|
private void listViewEx1_Scroll(object Sender, LifeHouse.ListViewEx.ListViewEx.MyScrollEventArgs e)<br />
{<br />
try<br />
{<br />
Int16 hi = (Int16)((int)e.WParam >> 16);<br />
Int16 lo = (Int16)(int)e.WParam;<br />
IntPtr temp;<br />
if (e.Orientation == ScrollOrientation.VerticalScroll)<br />
{<br />
if (lo == 5)<br />
{<br />
if (SetScrollPos(this.listViewEx2.Handle, SBS_VERT, hi, true) != 0)<br />
{<br />
temp = (IntPtr)(4 + 0x10000 * hi);<br />
PostMessage(this.listViewEx2.Handle, WM_VSCROLL, temp, IntPtr.Zero);<br />
}<br />
}<br />
else<br />
{<br />
PostMessage(this.listViewEx2.Handle, WM_VSCROLL, e.WParam, IntPtr.Zero);<br />
}<br />
}<br />
<br />
if (e.Orientation == ScrollOrientation.HorizontalScroll)<br />
{<br />
if (lo == 5)<br />
{<br />
SetScrollPos(this.listViewEx2.Handle, SBS_HORZ, hi, true);<br />
PostMessage(this.listViewEx2.Handle, WM_HSCROLL, (IntPtr)(4 + 0x10000 * hi), IntPtr.Zero);<br />
}<br />
else<br />
{<br />
PostMessage(this.listViewEx2.Handle, WM_HSCROLL, e.WParam, IntPtr.Zero);<br />
}<br />
}<br />
}<br />
<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString());<br />
}<br />
}
This is my code that is supposed to scroll ListViewEx2 when ListViewEx1 is clicked. I am able to achieve a scroll with the thumbtrack of ListViewEx1 but when i hold and drag the scrollbar there is no change in ListViewEx2's scroll in contents (that is, only the scroll bar moves while the content staying put).
Mouse's wat scroll event could trigger a similar scroll?
How to get both scrolls to sync?
|
|
|
|
|
|
If you want to sync the scrolling of two lists, here might be the right way to get it:
- for each item in the master list, identify the corresponding item in the slave list,
and add a (masterItem, slaveItem) to a Hashtable/Dictionary;
- whenever the master list scrolls, determine the new top master item, look up the
corresponding slave item, and scroll the slave list using ListView.TopItem,
ListBox.TopIndex or a similar property.
When the master list does not offer a scrollChanged event, use a Windows.Forms.Timer to do
the above periodically.
That should be much simpler than manipulating Windows messages, WndProc and the like.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
That's the first way that i went by but that aint what the project requires!
When the user clicks on the scrollbar and scrolls the other listview has to be in sync. that is behave as though the user is clicking on two listviews at once and scrolling.
That is the reason i've been trying to override WndProc()!
Can anyone figure a way?
|
|
|
|
|
can you help me guyz.How to make outset of our software through visual studio while setup deployment.I mean how change the default settings,such as showing color progressbar instead of regular one..like that.
i hope you'll get me
|
|
|
|
|
I don't believe that's possible using the standard Visual Studio setup projects. You'll need a more powerful tool to do this, such as InstallShield.
|
|
|
|
|
I have been googling for an answer on this and I just can't find it.
I have a groupbox that contains several checkboxes.
When I go through a foreach loop, the order in the groupbox.controls seems to have no order, but are in the same order everytime.
foreach(CheckBox s in grpGroup.Controls)<br />
{<br />
if(s.Checked)<br />
{<br />
blReports[intx] = true;<br />
}<br />
intx++;<br />
}<br />
What is the logical order of the groupbox.controls collection? It is not tab order, nor creation order. I just can't figure this out.
Thanx in advance!
Jude
|
|
|
|
|
This is the order in which items are inserted in the Controls collection of group box.
Only point is that you get controls in reverse order, which means if you have controls ctrl1, ctrl2 and ctrl3 added.
You will get ctrl3, ctrl2 and ctrl1 using 'for each' loop.
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
Ajay K. Singh wrote: This is the order in which items are inserted in the Controls collection of group box.
My question is what controls the order in which the items are inserted into the Controls collection.
The creation order in the code is cntl1,cntl2,cntl3,cntl4,cntl5,cntl6,cntl7.
The order of the foreach loop is 7,2,4,5,1,3,6.
Thanx for the reply!
Jude
|
|
|
|
|
Hi,
AFAIK the order of the controls is not the declaration order, not the creation order, it is
the order in which they get added to their parents Controls collection, which depends
a lot on your Designer interaction. You can modify the order by (carefully) editing
the designer-generated file (xxx.designer.cs). You can also set a new order by:
-first removing all the controls (i.e. move them from the groupbox to the form itself);
-then add them again, one by one, in the desired order (i.e. move them back from the form
to the groupbox).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
If you want to have a more logical order that you have more control of:
for(int i=0;i<grpgroup.controls.count;i++)>
{
Checkbox s=(CheckBox)grpGroup.Controls(i);
if(s.Checked)
{
blReports[intx] = true;
}
intx++;
}
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[^]
|
|
|
|
|
Thanx for all of the replies! From what I gather it is VS dependent in which order controls are added to the groupbox.controls collection.
I decided to go with a switch based on the control name:
if(s.Checked)<br />
{<br />
switch(s.Name)<br />
{<br />
case "cboDepr":<br />
blReports[0] = true;<br />
break;...
Not very elegant, but gets the job done.
Thanx again!
Jude
|
|
|
|
|
Hi
you can check in mm.designer.cs file for the answer, there one array have ur control sequence.
|
|
|
|
|
Is that some type of 2005 or + thing? I am still using VS2003..I don't program any big projects in VS and have kept the staple w/ .net 1.1.
I got it working with my non-elegant code
Thanx for the reply!
And thank you to all who have replied to this thread for not being an ass!
Jude
|
|
|
|
|
Hey I am trying to use System.Threading.Thread.Sleep() and I am not getting expected results.
I am trying to use it as a delay
turn RTS on<br />
System.Threading.Thread.Sleep(5);<br />
turn RTS off
I have an o-scope hooked to the RTS line and I would expect that the RTS should go on and off anytime over 5 milliseconds (due to windows timing issues), but I would not expect to see it take anytime less than 5 milliseconds.
However, I am seeing results anywhere from just under 1 millisecond up to 20 milliseconds. Again if it was just 4 milliseconds (because of the resolution, i thought maybe we could see something as long as it was greater than 4) to whatever, I would be fine with that, but it is returning in less than 4 milliseconds down to one millisecond even!
Just for giggles I set up this
<br />
Using System.Diagnostics;<br />
Using System.Threading;<br />
<br />
long startTime,finishTime,diff;<br />
float elapsed;<br />
<br />
for (int x = 1; x <=10 ; x++)<br />
{<br />
startTime = Stopwatch.GetTimeStamp();<br />
Thread.Sleep(x);<br />
finishTime = Stopwatch.GetTimeStamp();<br />
diff = finishTime - startTime; <br />
elapsed = diff / 10000; <br />
Console.Write(x + " > " + elapsed + "ms > " + diff);<br />
}
And am seeing very similar (and stragne) results.
Is this just a bug in the the sleep function or what? Is there another function that I can call instead? (Don't even think about writing that I should be polling---don't get me started--, I am working in an environment where milliseconds difference are noticable, polling would be such a time killer)
Thanks
Brandy
|
|
|
|
|
aei_totten wrote: Is this just a bug in the the sleep function or what?
I don't believe so. I believe it is documented to have inconsistent results for anything less that 55 mills. Granted I haven't looked at it for many years but I think that's what it said at one time. I also believe that are higher resolution timers[^] you should use for the type of requirements you have.
led mike
|
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Windows is not a real-time O/S. The resolution of those timers is not guaranteed and can vary from system to system, and even vary due to system load.
If you want to grab analog/digital data at a consistance rate, you'd have to use hardware dedicated to the task. This would be something like an Analog/Digital converter board or some other PCI/PCIx data acquisition board that comes with an API to do the data capture/buffering independant of the system CPU.
|
|
|
|
|
aei_totten wrote: Thread.Sleep() not working
Of course, it is Thread.Sleep(), it isn't Thread.Work().
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
I have a Class named Global and I'm Trying to access Form2 of my App. But sadly I can not. Normally I would use it as
Form2 frm = New Form2();
But I just cannot get Form2 on that Class
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
Different namespace? Different project? Form2 already compiled?
|
|
|
|
|
Form2 is already Added to the Project.
Code file Global.cs and Namespace Globals
And in that file I want a common procedure that I can use on any form in my App.
Hope this helps.
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
Are the Global class and the Form2 class both in the same namespace? Namespaces or reference errors could do that. Sadly without any further information the exact cause would continue to remain obscure to most non-clairvoyants. Another piece of possibly unwanted advice from me would be to avoid at all costs any type of "God Object" global type poison in your code, and please use appropriately named types.
Need more info.
Scott
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
Thanks Scott, I had a spelling mistake in namespace
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|