Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hello,
 
I use a trackbar to select a certain image out of a list of images.
This works fine so far. But as there are many images it is impossible to get the correct immage just by scrolling. The sensitivity is too poor.
In a pictureBox I show the selected image using the trackbar value as index to get the path to the image file from the list of images.
 
To do the fine adjustment I added a Plus 1 and a Minus 1 button to step one by one through the list entries.
 
But now I have a problem, I want the trackbar to show the adjusted position.
 
Question: is that possible. I have not found a method nor a property that adjusts teh trackbar position. Value just gives you the actual value but does not change the bar. And what TabIndex does ist not clear to me.
The lines commented out in the short example below both do not yield the desired effect.
 
 
private void btnEM1_Click(object sender, EventArgs e)
{
    actEnd = actEnd - 1;
    if ((actEnd < numberFiles) && (actEnd > -1))
    {
        txtBxStartFrame.Text = fileListS[actEnd];
        showFrame(actEnd, true);
    }
    else
    {
        actEnd = 0;
    }
    // trackBarEnd.TabIndex = actEnd;   this does not work
    // trackBarEnd.Value = actEnd;    and this does not work either.
}
 

 
Many thanks in advance for any hint.
Posted 2-Mar-12 8:48am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try this:
 
trackBarEnd.Value = actEnd;
trackBarEnd.Update();
  Permalink  
Comments
Ed Nutting at 2-Mar-12 15:34pm
   
Assuming it works (which given your status it probably does!), my 5+ - a solution though I think OP would be wise to use ListView for display image lists. Anyway, good solution :)
Member 5654129 at 3-Mar-12 2:18am
   
Hello John,
I am sorry, it does not work. The scroll position is not updated when stepping through the list. I will have to look at ListView.
 
Anyway many thanks for giving a hint
Wolfgang
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Well TabIndex will never help you - look at MSDN: MSDN Tab Index - Tab index is what order controls are selected in when the user uses the tab key to jump through controls on your form. As for Value, it should change the TrackBar (assuming you mean ScrollBar control?) to the desired position. I have not found a problem with this whenever I have used it. However, have you considered using a ListView which will display images as list items - it is far better than trying to write your own and has everything that you want. This page may help you out: MSDN - About the List View Control[^]
 
Hope this helps,
Ed
  Permalink  
v2
Comments
Member 5654129 at 3-Mar-12 2:18am
   
Hello Ed,
I will give ListView a try. But I am not very hopefull, that this might be the solution. In my case I must select a start image and an end image from a list of thousands of images created by my program MovieExtractor. This program uses a flatbed scanner to scan 35 mm movies in strips of about 18 cm (about 9 frames). From these strips the images and the light sound track are extracted in order to finally create a video using ffmpg.
And such a movie piece (e.g. a trailer of a blockbuster as published by entertainment companies for advertisment) might have up to 10 000 images.
 
If you are interested in details, you can look at
http://hosting.aktionspotenzial.de/CineToVidWiki/index.php/Hauptseite
which is primaryly about CineFilms. But this is in principle the same process.
 
Many thanks for the hint
Wolfgang

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 200
1 Kamal Rocks 184
2 PIEBALDconsult 150
3 BillWoodruff 148
4 Jochen Arndt 135
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 2 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100