473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Adding some text to an image but not on the image

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 ******
Feb 20 '08 #1
2 1677
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.
Feb 20 '08 #2
On Feb 20, 11:51*am, "Peter Morris"
<peter[dot]morris(at)capableobjects.comwrote:
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.
Thanks for the reply Peter.
Feb 20 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Picho | last post by:
Hi all, Is there any .NET way (I am not rulling out API usage) to add button(s) to a form's title bar? I found some non-.NET solutions that did actually work in VB6 but not in the ..NET...
1
by: Jonas L | last post by:
I have created a derived version of a normal form, e.g. called MyForm (public class MyForm : System.Windows.Forms.Form). The form is simply specifing a standard icon that we use within the company....
1
by: Jerry Spence1 | last post by:
I am trying to add the date/time to a jpg file. I came across the following on the web which looks ideal. However, my experiences in this direction are nil! How do I modify the first line(s) to...
1
by: swc76801 | last post by:
I desperately need help. My understanding of CSS is non-existent. I have a store http://astore.amazon.com/texasheat-20 with Amazon.com. According to the information from Amazon.com "Write your own...
4
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats...
0
by: empiresolutions | last post by:
Howdy, I have an PHP page that edits XML files. I want ADD a new *id* attribute to all nodes on the page that do not have it all ready. Then i want to delete all of the values of *id* and set...
1
by: empiresolutions | last post by:
Howdy, I have an PHP page that edits XML files. I want ADD a new *id* attribute to all nodes on the page that do not have it all ready. Then i want to delete all of the values of *id* and set...
5
by: DBC User | last post by:
I have a situation, where I need to add 4 or 5 data files (they change every time I build) in my project during build time and somehow I need a way to access these files during runtime. So I have...
1
by: superDk | last post by:
Hello, IE6 is adding a large margin between my two containers (container1 & container2) everything works fine in IE7 and Firefox. I've been searching on-line for a fix but I've had no luck. It...
10
by: AC | last post by:
I had a page that does some event setup on window.onload: function prepEvents() { document.getElementById("menumap_sales").onmouseover = swapMenuSales; // etc } window.onload = prepEvents;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.