Page 1 of 1

HELP: Image Coordinates ??

Posted: Mon Feb 23, 2015 7:45 pm
by John Adams
I've been building web pages for 15 years, and not once have I ever (intentionally) used those fancy png or jpg image files that have multiple versions of themselves inside - like a link and hover image. Example:
btn-play.png
(75.89 KiB) Downloaded 203 times
Depending on the application state, one of these colored images shows up on a button. For example, not authenticated the button might be the top one (dark) but ready to play, it's Green. If an error, it's Red. Instead of 4 jpgs, they are all in a single jpg.


Problem: I have no idea what this is called (technologically speaking) so I cannot begin to Google how to do this in C# Does anyone know the official technical term for displaying a region of an image dynamically?


~blush~ I really should know this, but embarrassingly, I do not. Thanks in advance.


Edit: If this helps, here's a CSS of what the button might look like

Code: Select all

background: url('images/wrapper/window-controls.png?h=658e8dc0') repeat-x scroll 0px 0px transparent;
Oh crap, are you telling me that all this is doing is on Hover, move the margin -27 or something? heh... ok, I'm done editing. Anyone?

Re: HELP: Image Coordinates ??

Posted: Mon Feb 23, 2015 10:41 pm
by Glaxono
Here are a few links to resources on this. Is this what you needed?
http://www.w3schools.com/css/css_image_sprites.asp
http://css-tricks.com/css-sprites/

Re: HELP: Image Coordinates ??

Posted: Tue Feb 24, 2015 6:08 am
by John Adams
Hah, yup. I think that's what I am talking about, thank you. Funny, for some reason I thought there was more "magic" involved than just placing width/height/margins in CSS. Either way, that won't work for me in C#, but for my web stuff it will come in handy. Thanks again!

Re: HELP: Image Coordinates ??

Posted: Tue Feb 24, 2015 6:54 am
by Glaxono
You can use the System.Drawing namespace in .net if you need to manipulate the image sprites in c#

Re: HELP: Image Coordinates ??

Posted: Fri Feb 27, 2015 3:43 pm
by John Adams
I need a little advice on C# in general; used it for years, but never played with User Controls. I'm using a few of them in a new app I'm designing, and the thing I'm noticing is a lot of "flashing" as the app starts - even in Release. It's faster, and practically unnoticeable in Release, but annoying nonetheless.

I've tried setting all panels to Visible = false; initially, and toggling their visibility after the main control loads - but even with everything "invisible", I STILL see flashing.

Any ideas?

Re: HELP: Image Coordinates ??

Posted: Fri Feb 27, 2015 6:23 pm
by Glaxono
When do you see the flash? during the initial page load? Is the hidden panel markup still sent to the browser? Is so, set style = 'display:none;'

Re: HELP: Image Coordinates ??

Posted: Fri Feb 27, 2015 6:45 pm
by John Adams
Browser? Sorry, maybe I forgot to mention this was a WinForms app I've tried WPF and such, and it's so frustrating I cave and go back to WinForms.

Re: HELP: Image Coordinates ??

Posted: Fri Feb 27, 2015 7:07 pm
by Glaxono
Heh... I only play around with WinForms for very small internal needs. I am an asp.net app developer and stick with MVC for most of my projects.

Sorry I can give any further help on this