Solved

Drawing Parts of an Image with C#

Posted on 2004-10-18
5
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 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