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.
Related
I'm trying to create an image matching game in C#.
My idea was to load all the pictures when I create the form. Then, when I launch the program and the form loads, I wanted to turn all those icons to black, hiding the pictures.
I've tried changing icon.BackColor = Color.Black but it doesn't do anything. Setting the visibility to hidden is also not an option.
Is there a way, or do I need to load the pictures individually using image.fromFile... went he form loads?
EDIT : As I was not able to find a way to answer this question, I took another approach. simply loading only black colored pictureboxes, attributing a random assigned name to each of them corresponding to an image. And on click, this image is shown.
As I was not able to find a way to answer this question, I took another approach. Simply loading only black-colored picture boxes, attributing a randomly assigned name to each of them corresponding to an image. And on click, this image is shown.
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.
I have 3 pages in my application.
First page: 5 Buttons, each navigates to different page (currently, only the first button works).
Second page: Back Button and ListView, the ListViewItems are UserControlItems with Button, Image and TextBlock. When you click on the Button (of the UserControlItem) it Navigates to the third page, which is Media Player Page with alot of controls.
Third page: Media Player page with alot of controls such as MediaElement, Slider, Buttons and more
When I navigate from Third Page to Second Page using the Back Button, sometimes the screen stays black (the color of the theme) and sometimes it loads too much time. In addition, the ListView has visible vertical scrollbar (always) which is not shown unless you move your mouse on the ListView.
How to fix these problems?
EDIT 1:
link to my project - put some .wmv/.mp3/.mp4 files in the Videos Library folder.
EDIT 2:
I investigated the black page issue abit more and I found that the MediaElement is the cause.
The MediaElement stores the stream and it slows the computer.
In order to resolve to problem, when you click on the GoBack Button, it first set the source of the MediaElement to null, and only when the MediaElementState == Closed, I go back - seems to solve my problem (since I applied the solution I didnt experience more black screens).
About the scrollbar - I think I'll be able to solve it if I simulate MouseOver over the ListView - no idea how to do it
Ok Ill List out the issue one by one.
List View Scroll Bar : Since we are developing for a potential touch surface so scrollbars are not meant to be visible every time.
Blank Page : When you press the back button then Big page Ie third page gets stored in the forward navigation property of the history element. Additionally all the resources that were being used in the third page is disposed. So the time taken to go to second page becomes huge.
Please try havig a fourth page which will have less controls. And see if any Black background issue is occuring or not. It will give a better and clear picture.
--- Update Code for permanent visibility of scroll bar---
Please download the code for listview styling from
Listview styles
add your code to the project
and replace all FadeOutAnimation By FadeInAnimation.
This was the quickest I could do for a solution. For a Better one you can always play with the styles.
Ohh one more thing please add
Style="{StaticResource ListViewStyle1}"
To your list view. please try and let me know.
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
I have a panel that displays database information in labels (a lot of labels).
Now, the labels extend the size of the panel and you need to scroll down to see them all. Everything is working, and you can see the labels if you scroll down.
How do I print the form and the panel with all its content? I tried to capture the screen, but it's bigger than the screen.
Is there a function like panel.printAllContent().IntoAnA4Paper;?
I don't think that's the right way. As you said you display information taken from a database so you already have your data model. You should print the data, not the interface.
But, if you want to print the UI, I think you should first put the interface inside a Bitmap, and then print the Bitmap.
Here's a link with an example: http://www.codeproject.com/Answers/200887/How-to-print-part-of-the-window-form-in-c-window-a#answer4