Questions tagged [picturebox]

The PictureBox is a control in the Windows Forms system that provides a way to display an image. It can handle many different image formats.

Summary

The PictureBox control provides a way to display images in a window constructed using the Windows Forms GUI framework. Like all other built-in controls, it inherits from System.Windows.Forms.Control and resides in the System.Windows.Forms namespace.

Important properties

In addition to all of the regular Control properties it inherits, the PictureBox also has a couple additional properties for its intended use.

Image

This property allows you to get or set an Image to be displayed in the PictureBox. Any image format supported by GDI+ can be used for this property. See the "Types of Bitmaps" article on MSDN for a list of supported formats.

SizeMode

This property determines how to display the Image within the PictureBox. It accepts a PictureBoxSizeMode value, which says whether the image should be centered, stretched, etc. (To change the size of the PictureBox control itself, use the ClientSize property.)

Links

2606 questions
6
votes
1 answer

How can I treat the circle as a control after drawing it? - Moving and selecting shapes

Actually, after clicking on each circle i want its color to be changed, for instance, i want it to turn into red,Overall, i wanna treat it as control. i know how to draw the circles that represent the nodes of the graph when i Double click on the…
behnam
  • 1,095
  • 2
  • 11
  • 30
6
votes
2 answers

Boost the performance when advancing to the next page using .tif images

I'm using WinForms. In my forms I have an open and a next button. My application opens .tif images into a picturebox. All the .tif images I work with have multiple pages. The next button is for going to the next page in the tif image. These .tif…
taji01
  • 2,527
  • 8
  • 36
  • 80
6
votes
1 answer

How do you show animated gifs with .NET Compact Framework

I would like to display an animated gif on a .NET Compact Form. Currently I use a PictureBox control and toggle between .Visible = true and .Visible = false. After .Visible = true the gif is shown however it's not animated. How can I get the .NET…
Tobias
  • 4,999
  • 7
  • 34
  • 40
6
votes
2 answers

How to rotate image in picture box

I am making a winforms application. One of the features I hope to implement is a rotating gear on the home form. When the home form is loaded, you should hover over the picture of the gear, and it should rotate in place. But all I have so far is…
Nicholas Aysen
  • 568
  • 3
  • 18
  • 40
6
votes
2 answers

Detecting when error image in PictureBox is used

I found this on Google, click here, which someone asked a similar question, receiving a response that they should check if their file exists. However, I'm loading images from web links, in which it displays an error image if A)The picture is not…
Dominic K
  • 6,975
  • 11
  • 53
  • 62
6
votes
3 answers

PictureBox not displaying the image

In my C# project I have used the Tools to add a PictureBox control. I have set the image location to a location of a PNG on our network and I am having the same trouble as others where if the images are moved from that directory then the image in…
Baub
  • 723
  • 4
  • 21
  • 36
6
votes
1 answer

Why should I not use the PictureBox control?

In his answer Rick Brewster stated that "PictureBox is often misunderstood." and "You will probably almost never want to use it." Unfortunately he didn't explain what's wrong with PictureBox. I use it to display and manipulate an image and it is…
Konrad
  • 509
  • 5
  • 17
6
votes
1 answer

Making the text of a label transparent in C#

I have a label with a black BackColor and I have set the ForeColor to Transparent. The label is over a mostly blue PictureBox which I have set as its parent. For some reason, the text, which should show blue, is white. It doesn't seem to have any…
codythecoder
  • 376
  • 5
  • 17
6
votes
3 answers

Moving pictureBox in panel

I have a project in C#, WindowsForms and I created a panel that contains a pictureBox that is much bigger than his parent. I turned panel.AutoScroll to true and what I want to do is dragging this pictureBox in panel instead of catching a scroll…
hsz
  • 148,279
  • 62
  • 259
  • 315
6
votes
1 answer

Changing the sizemode of a background image in picturebox

My aim was to change the background image and set it's SizeMode as Stretch. Tried a lot so far, any ideas? EDIT: I am working in C# forms application. Tried simply setting size mode of bg picture: picturebox1.BackgroundImage =…
5
votes
7 answers

GIF Animation not working in Windows Form

I have 2 WinForms Form2 uses Infragistics ultraTabControl. On Tab Changing im Showing Form1. In Form1 I have a PictureBox assigned with animated GIF In Form2 I am displaying Form1 like this. Form1 frmOne=new Form1(); frmOne.Show(); Problem GIF is…
aWebdesigner09
  • 257
  • 2
  • 5
  • 17
5
votes
2 answers

Zooming a large picture with Windows Forms

I have to display a large image inside a windows forms application. The user should have the possibility to mark an area of the image, which should be then be zoomed like in the example illustrated below. As mentioned before the image will be quite…
xsl
  • 17,116
  • 18
  • 71
  • 112
5
votes
5 answers

C# Mouse position over pictureBox

How can I know at what pixel of a pictureBox the mouse is placed (coordinates)?
NewProger
  • 2,945
  • 9
  • 40
  • 58
5
votes
2 answers

How do I get the dimensions of the ImageRectangle in PictureBox?

Background I want to be able to get the drawn dimensions of a zoomed image inside the picturebox (I'll explain below). The PictureBox.ImageRectangle property seems to be exactly what I'm looking for because it shows the height and width of the…
Iain Fraser
  • 6,578
  • 8
  • 43
  • 68
5
votes
2 answers

Clickable Image Map c#

I'm making a C# inventory application. However, I want there to be a map where the user can click several areas and interact with the inventory on that certain area. Currently I photoshopped the map and made it the background of the form. I'm…
barbara
  • 53
  • 1
  • 3