Solved

Drawing Parts of an Image with C#

Posted on 2004-10-18
5
213 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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