Solved

Drawing Parts of an Image with C#

Posted on 2004-10-18
5
210 Views
Last Modified: 2008-02-26
I'd like to use XML to draw only parts of an image using C#. That is to say ...Something like what Winamp does for its GUI, you've got your graphics stored in .jpg or .png files, and several things stored in each image ..and the images are drawn from seperate parts of the images...so ,say I want to draw my titlebar, I've got an image named "bars.png", and the title bar is in 100,100x200,400, I want to draw only that portion of the image to the screen ..any ideas?
0
Comment
Question by:derekthornton
  • 4
5 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 12344440
Are you talking about Image Strip
something like this
ImagesToolbar.Images.AddStrip((Image)Resourcer.GetObject("ImagesToolbar"));

as used in this example
http://www.codeproject.com/csharp/webbrowser.asp#xx915175xx

0
 
LVL 2

Author Comment

by:derekthornton
ID: 12346648
Eeh, No. I'm talking about using template files to store series of images...

Say, I've got a .png that has 4 or 5 different pictures in it, it's for drawing a GUI. I want to be able to draw only the image at certain coordinates from the .png to the screen, like you'd do with 3D Textures and such for wrapping them around meshes.
0
 
LVL 18

Accepted Solution

by:
armoghan earned 500 total points
ID: 12354473
Ohh i c,
What Winamp does is, it has predefined areas where it knows that which image regions are going to be, i.e. from which pixel to which pixel is going to be which button and so on. so it crops the images and place them on the required objects.

What you can do is define such regions and in your application Crop the images as different images from the main PNG and place the temp image object anywhere you want .
For croping the image
http://www.codeproject.com/csharp/imageresize.asp

0
 
LVL 18

Expert Comment

by:armoghan
ID: 12354477
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12354644
Thanx
Glad to help :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now