TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
David Galea
NA
12
0
Create Blank White Bitmap Image
Feb 19 2009 6:24 AM
hey guys,
I have a Form with a Picture Box, whereby upon loading of the form the Image in the Picture Box is a White Bitmap Image,
I have been using a Brute force Method so far being
Bitmap B = new Bitmap(row,columns);
for(int i = 1 ; i <= row ; i++)
for(int j = 1 ; j<= columns ; j ++)
B.SetPixel(i,j,Color.White)
this.mypicturebox.Image = B;
This works but is time computationally inefficient and I read somewhere you can use the Graphics Class to make the job easier, I tried the following
Bitmap B = new Bitmap(row,columns);
Graphics G = Graphics.FromImage(B);
G.FillRectangle(Brushes.White,0,0,row,columns);
this.mypicturebox.Image = new Bitmap(row,columns,G)
However it does work, furthermore upon compilation it states that the local variable G is declared but not used ???
What am I doing wrong??
Thanks in advance,
David
Reply
Answers (
1
)
Method that return a bunch of variables
Flex Grid Export to Excel