I want to be able to reproduce something like this image (taken from NBA.com )
What I have :
- A court with the white lines
- A list of Position for each shot and I know if they are made or missed.
But I'm stuck on the method to realize the image :
Should I create images for each part of the field using photoshop/paint.net and then color it in c# ?
Of course the best way would be to have an equation for each part so I can check easily if the position is in and I could also draw it.
How would you do it ?
You need to first decide on how replicable you need the solution. If you need it for a 1-10 pictures, then don't bother with code- it will most surely take much longer to fine tune it.
If was to work on this specific image, I would probably take my time to find expressions for all lines to make calculations more precise though.
I have a Picturebox with...content approximately 2000x1080 pixel (yes, this makes sense for me)
Now I need to get the old content, replace it 1 pixel down and fill the empty line on the top with new data.
BUT I have to do this in a very short time ~5ms maybe a little bit more.
I get the trigger and the new data to do so.
So now the question is:
What is the fastest and cleanest way to do this?
Maybe I need to buffer the new data and write them in a more "human" time!?
You didn't mention what kind of app it is... I'm more of a web developer, but in jquery, the trick to this is to load all images with zero visibility, and then use logic to determine which to display; I would think that even if this isn't web based, you could use a similar approach... just line them all up on the screen, set the left most to be visible, and then every 5ms, make the next visible... if you were constantly adding images, just make sure you're loading them earlier, maybe during the 5ms between switches?
I would have thought this was a common desire, but I'll be damned if I can find this.
I simply want to Animate an image by swapping two images back and forth. I tried StoryBoard, but apparently you can't change the source in a storyboard. The only answer I can come up with is a Timer, which I don't think is the best way.
Edit: How do I animate image content in WPF? Came up in the "Similiar Questions" window. And while this will do what I want, it is "hackish" as the OP of it says, and it only swaps two images, what if I wanted a whole sequence of 10 or 20 or 100.
I found another post here on SO whose answer sounds like it could solve your problem: Change an image during animation using storyboard
The problem with this approach is that it also doesn't satify your request for supporting an arbitrary number of images.
I was going to propose a different method that involves databinding the Image Source to the image path, and then in code behind simply changing the path, but I haven't gotten it to work yet.
Here's an article that seems to have an elegant way to handle your requirements: http://www.codeproject.com/Articles/364529/Animation-using-Storyboards-in-WPF
Hopefully that will work for you.
It's my first time trying to make anything really interesting in C# and I was trying to make a simple form or game screen where the user could define a custom resolution/screen ratio etc. or to automatically detect the max screen size/ratio and output? its my first game, so I was wondering if it was possible or if there would be any major issues with such, rather than just setting it to 1366x768 (the resolution of all of my computers).
Thanks in advance for any assistance.
You could enumerate through the default GraphicAdapter's DisplayModeCollection property to find the DisplayMode with the max width/height/aspect ratio.
Something like:
GraphicsAdapter defaultAdapter = GraphicsAdapter.DefaultAdapter;
DisplayMode maxMode = defaultAdapter.DisplayModeCollection[0];
foreach (DisplayMode enumeratedDisplay in defaultAdapter.DisplayModeCollection)
{
//Test enumeratedDisplay against maxMode, setting maxMode to enumeratedDisplay if enumeratedDisplay is better
}
Maybe there's a better way, but that's certainly one way you could find the max.
Or, you could take the same DisplayModeCollection and populate a comboBox of sorts or a list, letting the user choose for themselves.
My apologies if the above code doesn't work in that exact form. I can't test it where I am currently
Just set the PreferredBackBuffer to 1366x768 and if the graphics device can handle that resolution you'll get it. otherwise you'll get something scaled down. the xbox will automatically scale if nescessary to support the television being used as well.
I have a very specific problem using C# and a Windows MDI Form application. I want to display two (or more) images to the user, a 'left' and a 'right' image. The names of the images are concealed from the user, and then the user selects which image they prefer (this is part of a study involving medical image quality, so the user has to be blinded from possibly relevant capture parameters which might be revealed in the image name). Instead of showing the actual names, substitute names like 'image 0' and 'image 1' (etc) are shown to the user.
Whenever I use the standard MDILayout.TileVertical or TileHorizontal, the images are loaded in reverse order. For example, if I have image 0 and image 1, they are displayed
Image 1 Image 0
Three or more images would be something like
2 1 0
or
3 2
1 0
And so forth. The problem is, my users are confused by this right to leftness, and if I have another dialog box that asks them which image is better (or to rate the displayed images), they always confuse the order of images on the screen with the order of images in the dialog box. That is, if I just order the images 0 1 2 3 etc in a ratings dialog, they assume that image 3 as it's displayed is image 0 in the MDI parent window, image 2 is image 1, etc-- they read left to right, and the images are being displayed right to left. If I reorder the tabs in the ratings dialog box to reflect the order on the screen, that just confuses them further ("Why is image 3 before image 2?") and the results come out in the wrong order, and are generally unusable.
So, how do I force the ordering of displayed windows using MDILayout in C#? Do I have to do it by hand, or is there some switch I can send to the layout manager?
Thanks!
Why are you using an MDI interface? Surely a single window with a TableLayoutPanel or similar providing layout would be more suitable. The only reason you'd want to use a MDI layout is to allow the users to move the windows, which as far as I can tell from your description of the problem isn't desirable anyway?
Another idea would be to put the actual rating mechanism at the bottom of each child window. So the answer is actually attached to the picture on their child windows instead of having the answers in their own area.
Could you avoid this problem by (before displaying the images) you:
Put the image references in a structure (array or similar).
Have a recursive function build a reverse order structure (or reorder the original).
Use the new reversed order structure to build your child windows as before.
It would add one more layer but might solve your problem if no one finds the reverse layout order switch soon enough.
I strongly recommend following Groky's advice and using a single-form interface rather than MDI for this.
If you must use MDI, you need to know that the MDI layout methods use the Z-order of MDI forms to determine where the forms end up. For example, if image 2 is behind image 1, then image 1 will be on the left and image 2 will be on the right. The most logical way to cause this to happen would be to load image 2's form, then image 1's form, then do the MDI layout. You can also use the ActivateMdiChild method to put the forms in a particular order (activating one form puts the other forms behind it).
It's complicated and error-prone, and I strongly recommend having a two-pane interface on a single form instead, but this will work.
Thanks Owen and Groky, but the Single-Form interface is just not going to work. First, I already have the display code in the MDI format, so that rewrite would require a very, very large rewrite of the code. It took me about three weeks to write the basics of the app a while ago; these aren't jpgs I'm showing here, these are DCM images, and each one is a good 30 mb, with a variety of support tools that I haven't seen outside of medical imaging.
Second, some radiologists don't like split screening for image comparison, and others require it. As such, to accommodate both kinds of users, I set this up with tiling, but then the user can maximize images and then switch between them. So, MDI is the right approach for that differing set of tastes; a single interface with a very complicated set of tab controls just sounds like a nightmare compared to an already extant and (for the most part) working system.
However, since I do control the way in which images are displayed, I can force the z-ordering, and then that should work, right? That's the basis of Fred and Owen's answers, if I'm reading them properly. The user enters 'evaluation mode', and then the program loads the images, shows them, and only once the user has entered an evaluation are the images closed. Given that constraint, I can probably enforce a particular z ordering (maybe by looping from length to 0 rather than from 0 to length).