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
0
votes
2 answers

c# Storing resources(specifically images) in folder structure

If I want to add pictures, I have to put those into the resources and access them from the picturebox.Image property by using this: AddPicturesFromOtherFolders.Properties.Resources.myPicture Thats the only way I know. That works fine if I have 10…
Alexander
  • 33
  • 5
0
votes
1 answer

C# crashes with 'Parameter is not valid.' when setting PictureBox.image to Bitmap in Application.Run(new Control_Panel())

After I connect to USB camera, and read a frame, and convert to bitmap, it crashes after I write bitmap to PictureBox. I'm developing a Visual Studio 2017 Pro C# Windows forms project. Also, if I debug process_video_NewFrame() and step through it,…
Doug Null
  • 7,989
  • 15
  • 69
  • 148
0
votes
0 answers

c# Hitboxes using different colors in pictureboxes

So the thing is, when I program things I would like to have click-events that are more complex than a rectangle(=>pictureBox). Imagine for example, the following picture, which is the graphical picturebox: Beneath that box, is another picturebox…
Alexander
  • 33
  • 5
0
votes
1 answer

Winform applicaton not animating picturebox gif while processing data from Excel

I am currently developing a C# WinForms program which reads data from an excel file and processes it. This process has a duration up to 5 seconds so I want to show a little rotating gif, so that the user knows that the program actually is processing…
HalbeSuppe
  • 47
  • 5
0
votes
1 answer

C#: label text and Picturebox Location do not change

I want to write a Multiplayer game with tcp. The Sender works and sends the data but after the Receiver changes the text of the label and the Location of the PictureBox nothing happens. I debuged it and found out that the label have the new Text but…
Javes
  • 3
  • 2
0
votes
1 answer

Display WPF Image in backgroundworker

I am using WPF 3.5. I have while loop in a backgroundworker_DoWork event, which will continuously stream images from a DSLR. Initially, the streamed image will be displayed in a PictureBox
billy_flow
  • 81
  • 4
  • 9
0
votes
1 answer

Creating an array of pictureboxes in windows form (C#)

I'm trying to create an array/list of picturebox objects that are declared and added to the form on button click (Meaning that I'm not creating multiple objects with my array, but plan to if I can get this to run). Not getting errors, but the…
Four
  • 1
  • 2
0
votes
0 answers

How to move multiple objects in a picture box using mouse down

I'm currently working on an UML project. Right now, I have to figure out, how to move a class with all it's attributes by clicking and dragging. As of right now, the class is constructed with 2 rectangles and a draw string for the attributes and…
Chernarussian
  • 45
  • 3
  • 7
0
votes
0 answers

The right edge of the Picturebox blurs and a gradient appears

Why does SizeMode StretchImage have the following effect and how can I fix it? gradient Code for example: Bitmap bitmap = new Bitmap(1,1,PixelFormat.Format24bppRgb); bitmap.SetPixel(0,0, Color.Black); pictureBox1.Image = bitmap;
Sergey J.
  • 1
  • 2
0
votes
0 answers

Picturebox drag and drop file name

I have set up a picturebox, where i drag and drop a picture. I also would like to know the name of this file. How can i do this? Here is the current code below that handles the picture box: Private Sub Form1_Load(ByVal sender As System.Object, ByVal…
0
votes
3 answers

How do I change the image of a PictureBox when a CheckBox is checked?

I am busy making a simple game in Visual C#, and I have no idea how to do this. Is there a way to set a PictureBox's image when a CheckBox is checked? What is the actual code for setting the image? Thanks, Varmitharen
Varmitharen
  • 13
  • 1
  • 6
0
votes
4 answers

The Click event on a PictureBox is firing but no action is performed

I wrote code to paint a toggle button on the MouseClick event handled on a PictureBox using C# with a Windows Forms application. Here the click event is firing but the action is not being performed. Can anyone tell me what I'm doing wrong? public…
SharpUrBrain
  • 3,180
  • 5
  • 38
  • 56
0
votes
2 answers

How do I get my PictureBox to be transparent when another moves past it?

I have two pictureboxes, one of which can be controlled by the player of the game with the arrowkeys. However, I have encountered an issue when the player picturebox moves past another picturebox on the form. Before walking in front Whilst walking…
0
votes
1 answer

Saving image in PictureBox, getting NullReferenceException

Using Visual Studio C#. I want to save the image inside my PictureBox as a .png using SaveFileDialog, but whenever I try to, I keep getting NullReferenceException at the last line. I can't seem to figure out what's causing this and how to fix…
0
votes
1 answer

600 Milliseconds delay in EmguCv real-time video Decoding

I am developing a real-time computer vision application using C#. But I am not able to optimize Emgucv decoding. I have 800-millisecond delay from the ground truth and 600-millisecond delay from the Ip camera provider application AXIS. How can I…
Amin Ullah
  • 77
  • 9