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
4 answers

Toggling Picture Box visibility C#

Why is the picture box control's visibility property not working here. I have initially set them to false, so that when the screen loads they are not visible. But then I wish to toggle this. I have done the following but does not seem to work. This…
Nishant
  • 905
  • 1
  • 16
  • 36
0
votes
1 answer

Moving Picturebox randomly as it roams

I want to make an AI using PictureBox that can roam randomly without messing its movements like for example: PictureBox must execute the movement to go Right, if the Timer runs out it the next movement is going Down, like just how random it would…
Mine Dyse
  • 1
  • 4
0
votes
1 answer

Battle Game - How to make direction of firing missile

This is related to the first question that I asked about making infinite missile Now what I wanted to do now is when my Main Tank changes direction, let's say it turns right. Supposedly when it fires it will travel to the side where the Tank is…
Mine Dyse
  • 1
  • 4
0
votes
1 answer

Save Drawn Images PictureBox

My program allows the user to draw in a PictureBox. I'm trying to save the pictureBox1 as a .jpg file but this file is empty. My save button: Bitmap bm = new Bitmap(pictureBox1.ClientSize.Width,…
Ohy
  • 3
  • 2
0
votes
0 answers

Why my Picturebox with labels is moved when saving

I have a big problem when I convert my PictureBox to bitmap with labels to save it in my computer, it appears moved and with a really low resolution, I'm a newbie so... I really don't know how to fix it here is how it looks saved here is my code to…
0
votes
1 answer

Making scribbles on a monochrome image

Imagine there's a picturebox which loads a monochrome image. And there is a need to make few color scribbles on it. I have no background with graphics. Would it be just a pen drawing pixels or something more complex I don't know. Target language is…
lexeme
  • 2,915
  • 10
  • 60
  • 125
0
votes
1 answer

PictureBox makes white parts transparent itself

My picturebox acts like it is .PNG file. It makes white parts transparent. Even penetrates "Form" and i'm able to see what's behind Form (like my desktop, files). But it seems normal in Form1.cs [Design]. //card properties and…
Ege Eren
  • 7
  • 2
0
votes
0 answers

pictureBox updating slowly in C# GUI?

I am taking images with a machine vision camera and storing them into a folder. I want to show the saved image in a pictureBox before the next image is stored. My code is successfully showing the image in the pictureBox, however, there is a delay so…
palacetrading
  • 71
  • 1
  • 11
0
votes
1 answer

Windows Forms -> WPF image control conversion question

I've always worked with Windows Forms, but now I'm trying to learn WPF due to it's advantages. Some time ago I created a picturebox control (with help of Damien here). And for me it's very hard to convert this control into WPF's Image control. I…
xZ6a33YaYEfmv
  • 1,816
  • 4
  • 24
  • 43
0
votes
1 answer

Panel containing PictureBox flickers on background change. How can I eliminate this?

I have a panel with the BackgroundImage set that I'm using as a button. The panel also contains a PictureBox with a png image loaded so that parts of the image are transparent and the panel image shows through. On MouseDown I change the panels…
Nelson Hoover
  • 159
  • 4
  • 13
0
votes
3 answers

Invalidate a single Pixel?

I'm working on some image processing and for debug I'm overlaying colours on the original bitmap. The problem is the image is rendered in a picture box with SizeMode set to Zoom and invalidating every time I update a pixel is Really slow and just…
James
  • 9,774
  • 5
  • 34
  • 58
0
votes
1 answer

How to keep a reference of PictureBox Image attached to a variable and not to an object of the variable?

I work in C# and want to keep a reference of PictureBox.Image attached to a variable and not to an object of the variable. That means I want freely change the objects of this variable and PictureBox will always refers to the variable. I have a class…
Shamil
  • 13
  • 5
0
votes
1 answer

How to make more than 1 transparent picturebox layer in C#?

I'm using 3 pictureboxes. 1 as background & 2 as transparent layer over the background. all with same size. Layer 1 is used to draw lines & layer 2 to draw shapes. I'm using tab control to control which layer is visible and which is hidden. but…
0
votes
0 answers

How can I assign each row a different image?

I have a list of products from a database in sql server shown in a datagridview. My goal is to achieve that through a Picturebox I can assign each product an image, this through a button that opens my files to select an image. Once the image is…
EriMI
  • 1
0
votes
2 answers

Remove PictureBox after time

I'm making simple game where I need to remove pictures after certain time without freezing everything else. I'm making explode event: private void Explode(int x, int y) { PictureBox explosion = new PictureBox(); explosion.Image =…
Madley
  • 23
  • 4