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 / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

How to create and draw into a white empty Image

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TheLetti - 03 Aug 2005 16:47 GMT
Hi,

I created some thumbnails from pictures - they all have a size of up to
80 pixels in width or height (if it is a square pic, the size is
exactly 80 x 80, otherwise 80 pixel is the size of the greater
dimension).

For displaying purposes, I want to view them all in the same size, that
is 80 x 80.
Pictures that are smaller shall have a white border to fill up the size
to 80 pixels.

How can I do that? I have the thumbnail already in a
System.Drawing.Image object, but I have no clue how to add this white
border, or even how to create the empty 80 x 80 white picture first,
where I want to draw my thumbnail into. I looked already for the
classes Bitmap, DrawImage, Graphics (all in namespace System.Drawing),
but couldn't find any appropriate method.

I appreciate any help,

TheLetti
Markus Stoeger - 04 Aug 2005 00:35 GMT
> How can I do that? I have the thumbnail already in a
> System.Drawing.Image object, but I have no clue how to add this white
> border, or even how to create the empty 80 x 80 white picture first,
> where I want to draw my thumbnail into. I looked already for the
> classes Bitmap, DrawImage, Graphics (all in namespace System.Drawing),
> but couldn't find any appropriate method.

Try that...

// create a new bitmap
Bitmap bmp = new Bitmap(200, 200);

// get a Graphics object for drawing on the bitmap
Graphics g = Graphics.FromImage(bmp);

// draw on it
g.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height);
g.FillEllipse(Brushes.Red, 0, 0, bmp.Width, bmp.Height);

// save it, or put it in a picturebox,...
bmp.Save(@"C:\MyImage.bmp", ImageFormat.Bmp);
TheLetti - 04 Aug 2005 09:48 GMT
Hello Markus,

thank you very much for your input. I figured it out right now thanks
to your help.

greez,
TheLetti

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.