Display pictures one after the other - c#

I have a question concerning listbox or something similar that could help me. I read lots of pictures from an json and I display them into a list box, I made the image as it’s could fit the page and I scroll them horizontally ,so that I can display them as an album of pictures.
The problem is when you scroll in a listbox, the scroll just keeps going it doesn’t stop, what I want to do is I can display only one picture each, and the scroll stops each time a display a picture.
Do you have any idea how can I do this? Thank you!

Have you looked at the RadSlideView from telerik?
RadSlideView is a unique control that allows you to navigate through a
sequence of items slide-by-slide. It works in data-bound mode only and
offers exceptional performance with smooth transitions among slides.

It may not be pretty but here's one solution -
Add a slider and use it instead of scroll-bar
Have just one image control
Set Slider's Minimum = 0 and Maximum = number of images
Set Slider's TickFrequency="1", IsMoveToPointEnabled="True" and IsSnapToTickEnabled="True"
Change your image when slider's value changes
Additionally, you can handle scroll events to ++ or -- the slider's value

Related

HighCharts Pie chart gets box around selected slices

When rendering my HighChart I sometimes get a blue box around one of the slices. This seems to represent the selected slice. If I use the keyboard arrows the box moves to the other slices.
This is how it looks when it renders (sometimes)
And then if this happens I can then use the arrow key to change which slice has the box around it like below
I don't see any reference to this in the documentation for HighCharts or any settings to turn this off.
This also only seems to happen when rendering inside of Microsoft.Web.WebView2.WinForms.WebView2 control but I can't be certain. It does not let me cycle through all elements on the control. Once Opera has been selected the next time I hit the right arrow Chrome is selected again so I don't think it's the browser cycling through DOM elements.
Does anyone have any advice on this?
According to the comments - it seems that the issue was related to the accessibility module - https://www.highcharts.com/docs/accessibility/accessibility-module

Visual Studio 2017 Community button size greater than images in image list

I'm trying to precisely align an array of buttons within the rows and columns of a table layout panel. Each button is assigned to the same image list. The image list contains three images, all the same pixel dimensions (200px wide X 18px high). I want the buttons to exactly stack one on top of one another vertically, with no vertical gaps.
The problem is, when I look at the button properties, the size of the image is described as 206x24. It looks like somewhere VS is adding a 3 pixel boundary around the images, and I can't figure out how to get rid of that.
Margins for the button are all set to zero. Padding for the button is all set to zero. FlatStyle is set to "Flat".
What button properties do I set to get the images to stack exactly?
Is there a parameter in the table layout panel that might be causing this?
Here is an image of the button property box:
Image of property box
Any help would be much appreciated.
Would using a picturebox with a clickable change of image work better than a button?
You've only talked about your button styling. Look at padding and margins for your table elements, such as TD, TR, etc. A quick way to see this visually is to add colors for these elements in css. If you make a TD red and see a 3 pixel red space, you've got your culprit. Try this with ANY elements that are in your markup. ANYTHING could be a culprit.
BTW, I've noticed a downvote on your post. I think folks here appreciate if you post your code so they can see what you've tried so far. Just a friendly reminder.
I continued researching the best way to handle the look I was going for, and others that have tried to use buttons, and had similar problems. I have abandoned the button, and will use a picturebox instead in each of the cells of the table view control.
My apologies for the imprecise question.

Rendering same text for multiple TextBlocks in WPF

So I have a ListView with a UniformGrid of 16 rows and 32 columns as it's ItemsPanelTemplate. ItemsSource is bound to an ObservableCollection of objects that have two properties: IsSelected and Value. Each cell in the UniformGrid contains a TextBlock whose Text property is bound to the Value Property of its respective item. Below this construct, I have a ScrollBar whose value ranges from 0 to 255. Adjusting this ScrollBar changes the Value Property of the selected items in this grid.
Now that I've painted that picture, here is the problem. The issue is when I have many slots selected, and change the value of the ScrollBar, it updates all of the TextBlocks at once, causing visible lag. I scoured the internet for a solution to this problem, reading many articles on improving rendering performance and such. I have tried using Glyphs to try and increase the speed of text rendering, which showed improvement, but the lag was still painfully visible.
If I can somehow render the text only once per value change, and copy it to all other selected slots, I think this would improve performance. Is there a way to do this? If not, is there a different way I should be doing this kind of thing?
If not all of them are visible you could look at reducing your lag by looking into using VirtualizingStackPanel property.
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
http://miteshsureja.blogspot.com/2011/05/virtualizing-stack-panel-in-wpf.html
Additionally, if it's because of the speed at which a scrollbar can change value, and the draw of the UI just can't keep up....you could use a Timer that gets restarted anytime the scrollbar/slider changed event is called.
Once the timer elapses (lets say you pick 1 second) without being restarted by the change event, then it updates the value that the boxes are all binded to so that it only updates once the user stops moving the scrollbar/slider.
There does not seem to be a a way to easily copy the rendered text to other TextBlocks. The only way to increase render performance whilst maintaining immediate response was to switch to Glyphs. Will update answer if I find a way to render text once, and copy it to the remaining Glyphs.

Alignment of text when column width is changed from GUI in winform application

I have developed a winform application. It has a listview with multiple columns having different texts. Initially, I have set the column width = -2 to take the size of longest text in the column.
The issue is that sometime text overshoots the laptop screen and a horizontal scroll bar appeared in the list view.
To fit all the columns in a screen, I manually modified the columns widths using column boundaries in the GUI. When I modify the column width, the column text starts disappearing from right. I want it to disappeared from left.
I have searched goggle a lot but did not find the answer.
Question might look weird or may be I have not explained it properly. Please let me know if more information is needed.
Thanks in advance.
The Listbox columns in Windows Forms are not exactly a high level control, I've used it some times but just for simple lists, It certainly has not a builtin function to make what you want, to obtain it you probably need to subclass the control, create a new class for the item managed in the list and write some code to perform what you need.
I think you can find some hints on how to achieve all this in Charles Petzold book about windows forms where he shows how to measure a string and how to draw directly on your control.

Send to back object that created at run time

I have a page that in this page i have one image and at run time i add 3 buttons but these button come to front of image. how can i send these button to back. i use Panel.SetZindex but not works. thank you.
Have you also used Panel.SetZindex for image control? I think you would have used it just for buttons not for image thats why buttons are still coming in front of image control.
You should set z-index of buttons to least possible value and the z-index of image to highest possible value so that image would comes in front.
Use following code:
Panel.SetZindex(button1,0);
Panel.SetZindex(button2,1);
Panel.SetZindex(button3,2);
Panel.SetZindex(image,3);
Set buttons z-index property to lowest possible number and then add it at run time.

Categories

Resources