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
1 answer

Show content of a picturebox after mouseclick

I am trying to display a image in pictureBox after I click on it. First I tried to set PictureBox property for visibility to false and after I click on PictureBox these option come true and the picture should be displayed. It does not work.…
Kristiyan
  • 29
  • 7
0
votes
0 answers

Display images into a picturebox on treeview

I'm new to this domain and I'm trying to develop an application and after searching, trying any posibillities i still couldn't resolve my problem...:( I have a windows forms. In that i have toolStripMenu, treeView and pictureBox. On click of the…
Kalolalo
  • 9
  • 4
0
votes
2 answers

There is not enough memory for the picture when using Graphics, C#

The code is very simple: I Press the button, the picture is loaded into the PictureBox. private void button1_Click(object sender, EventArgs e) { using (FileStream stream = File.OpenRead(FullName)) { pictureBox1.Image…
Mister Crabs
  • 41
  • 1
  • 5
0
votes
2 answers

C# - Changing SizeMode of picturebox

private void button1_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.png; *.bmp)|*.jpg; *.jpeg; *.gif; *.png; *.bmp"; …
Gruja
  • 1
  • 1
  • 6
0
votes
2 answers

VB.NET PictureBox scroll through images in a folder

I have a pictureBox on my form along with two buttons (Back and Forward) but I can not find a viable method of doing what I wish to do: Scrolling through images in a folder like the default Windows Picture Viewer does with Arrow Keys. Is there an…
Quirk
  • 9
  • 1
  • 2
0
votes
1 answer

Random image stuck on one image

I have code for a randomizer that puts a random image into 2 picture boxes but on one of them the picture stays the same and does not change. Here is my code. Dim Random As Integer Dim Random2 As Integer Random = CInt(Math.Ceiling(Rnd() * 6)) +…
Sahib
  • 1
  • 1
0
votes
0 answers

How to turn PictureBox into a class with "moving functions" and call it from Form.cs?

So I'm trying to make a game were you (the character) move freely on a windows form where the objective is to "eat" smaller characters who move horizontally across the screen. If you intersect with a character larger than you... Game over. However…
0
votes
1 answer

c# Picturebox Array Selection

I have created an array of picture boxes and an event for when one is clicked. public void TicTac_Load(object sender, EventArgs e) { PictureBox[] PBox = new PictureBox[9]; PBox[0] = this.pictureBox1; …
A Fairbank
  • 35
  • 9
0
votes
3 answers

Random browsing of images (animated)

I was trying to make a program that shows picture in a folder. The path of each picture was stored in the database. My problem was it only show the last images stored in the database and not all the pictures. The code is: Private Sub…
nero
0
votes
1 answer

How to remove all the drawn rectangles on the picture box? (Not on the image)

I have tried using the following code: pictureBox1.Invalidate(); //or pictureBox1.Update(); //or Refresh(); But it just did nothing on it. I want to clear all the drawn graphics on my picture box as after I…
Eric
  • 75
  • 5
0
votes
2 answers

I have a picture box with an image without background but it only takes the color of the form as background

I'm doing the table game battleship, by moving pictures boxes with the mouse, the problem is that all the picture boxes that I have contain an image without background, but i have the problem that when I move it through different points, it shows a…
0
votes
2 answers

To create a zoom picturebox for mschart

I want to create a zoom picturebox like in PictureBox Zoom for mschart. When I hover the mouse on the chart, the picturebox should show zoom view, so that I can select an appropriate point. Can this happen in winforms C#.net?
user2587
  • 149
  • 10
0
votes
1 answer

enlarge / shrink PictureBox but maintain pixel ratio c#

I could not find a better title. So this is what I want to do: I have a picturebox that is 28x28 pixels I am working on a AI project and my idea is to make an OCR for numbers, I found training data but all the images are 28x28 pixels, so my ideea…
0
votes
5 answers

Using a foreach loop with pictureboxes

I am trying to make my code as short as possible and I intend on randomising images from a choice of 6 pictures for 3 different picture boxes at certain intervals. Instead of copy and pasting the switch and case three times for each…
0
votes
0 answers

pictureBox1.Image is null even after drawing on a PictureBox

I am drawing on a PictureBox control a grid with a small image on it. When pressing a Button, I need to update the small image position on the grid, drawing it again on a different position. I am drawing first time with: Bitmap ime = new…
GrandTim
  • 47
  • 7