Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Adding some text to an image but not on the image

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
almurph@altavista.com - 20 Feb 2008 11:39 GMT
Hi,

   Hope you can help me with one please. I import an image and
display it on a picture box control. I then have functionality change
its size (code included below).
   Now I need to add some text *not* on image but beside the image,
like an area to the side of the image say but not actually on the
image (likn on a lable that can be added to the image to form kind of
a new image).
   Problem is though I dont know how to do this (in fact, I dont even
know how to add text to the image itself). So can anyone help me
please? Any comments/suggestions/hints or code samples to get me
started would be most appreciated.

Many thanks,
Al.

***** BEGIN CODE - THIOS JUST CHANGES SIZE OF IMAGE *****
//Firstly open the file into an image object
System.Drawing.Image img = Image.FromFile(fileName);

//Convert to bitmap with correct dimensions:
System.Drawing.Image newSizeImage = new Bitmap(img, 440, 60);

//Now convert the bitmap to a.gif
reSizeImage.Save("a.gif", System.Drawing.Imaging.ImageFormat.Gif);

****** END CODE ******
Peter Morris - 20 Feb 2008 11:51 GMT
Create a new bitmap the size of the original + the size of the text you want
to add.  Then do

Graphics canvas = Graphics.FromBitmap(MyNewBitmap);
using (canvas)
{
   Draw the original bitmap onto the canvas
   Write your text out to the canvas
}

This is only useful if you want to save the image.  If you want only to
display it then just use a picture box + a label.
almurph@altavista.com - 20 Feb 2008 12:45 GMT
> Create a new bitmap the size of the original + the size of the text you want
> to add.  Then do
[quoted text clipped - 9 lines]
> This is only useful if you want to save the image.  If you want only to
> display it then just use a picture box + a label.

Thanks for the reply Peter.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.