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# / August 2007

Tip: Looking for answers? Try searching our database.

How to draw only one pixel on form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cty0000@gmail.com - 23 Aug 2007 06:45 GMT
I need to draw only 1 pixel but I can not found out the way...

I tried to use like following in some function
(point1 is Point instance)

Graphics gB = Graphics.FromImage(gBmp);

gB.DrawEllipse(pen.WHITE, point1.X, point1.Y, 1, 1);
gB.DrawRectangle(pen.WHITE, point1.X, point1.Y, 1, 1);
gB.DrawLine(pen.WHITE, point1,point1);

All of above example are not drawing only 1 pixel (looks 4 pixel...)

Someone recommand me drawEllipse or drawLine but the result was not
only 1 pixel...
I tried to find out the solution in web site but I could not find....

How to draw ONLY one pixel?????
Claire - 23 Aug 2007 10:20 GMT
Have u looked at the bitmap.setpixel() method?

>I need to draw only 1 pixel but I can not found out the way...
>
[quoted text clipped - 14 lines]
>
> How to draw ONLY one pixel?????
edward.j.stewart@gmail.com - 30 Aug 2007 23:15 GMT
I searched for a long time today to answer this question and finally
found something that works:

System.Drawing.Bitmap bm = new System.Drawing.Bitmap(1,1);
bm.SetPixel(0, 0, color);
graphics.DrawImageUnscaled(bm, x , y);

Creates a new 1x1 bitmap, sets it color, then adds it to your graphics
object. I lost the source where I found this now, but many thanks to
whomever that was!

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.