473,385 Members | 1,766 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,385 software developers and data experts.

drawing on picture box

hi all can any one help me in this
i want to draw a default picture on a picture box whenever i click
on a new button. please help ...

Nov 17 '05 #1
3 12411
probably the easiest way to achieve this is to sub-class the button class,
and override the paint method to paint in your custom image.
Graphics.DrawImage() should work, but you will need to code in sizing stuff
for your image... I'd write some out for you, but I'm toooo tired. You
should be able to google some examples of how to override the paint method
properly.

"jack" <ga**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
hi all can any one help me in this
i want to draw a default picture on a picture box whenever i click
on a new button. please help ...

Nov 17 '05 #2
Jack,

This is easy. Create a new Bitmap instance, and then get the Graphics
instance by passing the bitmap to the static FromImage method on the
Graphics class. This will return a Graphics instance you can use to draw on
the image.

Once you have that, you can set the PictureBox to show the image that
you created.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"jack" <ga**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
hi all can any one help me in this
i want to draw a default picture on a picture box whenever i click
on a new button. please help ...

Nov 17 '05 #3
thanks nicholas this works great

Nov 17 '05 #4

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

Similar topics

7
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method,...
2
by: padawan | last post by:
I have a winforms control that draws a rectangle for a boarder and positions some graphical elements around the control to create the boarder effect I desired. In the control I have overriden the...
4
by: Christina Androne | last post by:
Hi I want to allow the user to drow some locators on an image and connect the locators with lines. So I tried to put the following code in the onmousedown enevt of the picture: Graphics...
13
by: Metallicraft | last post by:
I have a vb6 application. On the main form is a picture box with one or two images and several pieces of text displayed in it. These are created on the fly using gdi32 routines that are all in a...
2
by: George | last post by:
Dear colleagues, I refer to your help with specific graphic problem. It is necessary to create a viewfinder in graphic application. It seems that the algorithm is simple: just draw lines in...
1
by: Mchuck | last post by:
I've seen several newsgroup topics everywhere concerning this, as well as a couple of articles from the MSDN website, but this error still baffles me. It has to do with using the...
5
by: Ringo | last post by:
I'm new to C# and want a simple app to display a bitmap that is in bayer format. I searched the group and have an app that can draw pixels in a picturebox using Pset. My problem is that Pset uses...
9
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I...
4
by: RobinS | last post by:
I am drawing a rectangle on a picture that has already been drawn on the graphics area (a user control). It works something like this: //in the MouseDown event m_isDragging = true; m_oldX =...
7
by: raylopez99 | last post by:
I have a logical drawing space much bigger than the viewport (the screen) and I'd like to center the viewport (the screen) to be at the center of the logical drawing space. After following the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.