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

Picture not fit to picturebox c#

I am actually working with PictureBox on .NET, then I face the problem below: I create a PictureBox of size 370 x 370 with mode size "Normal" I have a picture .png of size 370 x 370 (pixel) Then I create a button to import the picture to the…
0
votes
1 answer

Not able to clear drawings in PictureBox using VB.NET

I use the following code to make simple free-hand (brush) drawings over PictureBox1. Drawing is fine, but not able to clear the drawings I made permanently. If I click Button1 the drawings will be cleared, but once I move over PictureBox1 all old…
Alaa Sadik
  • 1,029
  • 12
  • 19
0
votes
0 answers

Weird VB.net bitmap-to-picturebox scaling

As part of a larger tool I'm working displaying pieces of a bitmap in a picturebox. In my current test case, I want to take a 200x200 section of the bitmap and display it in a 200x200 picturebox (clientsize area). The code runs, but I find I'm…
0
votes
1 answer

How to remove the border of a transparent Image in a PictureBox?

I was trying to put a transparent image on a transparent Form. As you can see the image has a black outline. I saw that someone solved this with the Paint Event on the PictureBox. I tried it too but nothing. The color of the outline is based on the…
nabasoki
  • 57
  • 2
  • 7
0
votes
1 answer

How to get label value from Picturebox on Picturebox click event

I have tried many ways to read label value from PictureBox when a user clicks PictureBox which is inside of flowLayoutPanel1. enter image description here Anyone help me on this. From the attached image, I want to read price value when the user…
0
votes
1 answer

Collision Detection edits the Spawn Location of a Picture Box

I am making a two dimensional game where the user is able to shoot enemies and gain points. So far I have added borders to the level as well as the collision detection between the Player and said borders. When the player presses "w" the user shoots…
0
votes
1 answer

Refer to Picture Box selected

I am new to C# and want to change the size of some Pictureboxes based on one trackbar Value. If i write the below code refering to a spesific picturebox (e.g. Picturebox1 instead of PB) it works, but i would like to use one Doubleclick event for all…
Torr
  • 1
  • 2
0
votes
1 answer

Putting picturebox on picturebox

I have a problem adding picture boxes using Controls class on another picture box that already exists. when i load the form i don't see any changes because the "coded" pictures are under the main picture (Arena) Here is my code: void drawSpikes() { …
Mark
  • 3
  • 1
0
votes
3 answers

Picturebox, set and get property to take an image throwing null C#

I have a picturebox that will filled up by OpenFileDialog() after that, I must render the histogram (chart) from it. I use the get and set property to take the image from picturebox to another class or form. But I always getting…
Nggarap
  • 63
  • 8
0
votes
1 answer

Issue with Picturebox and trying to update images

I am trying to update an image in a picture box on a timer. I'll be honest, I don't have much experience with pictureboxes and it's been about 5 years since I've done any C# work in general. I tried to search on google and on here and can't seem to…
user2921015
  • 69
  • 1
  • 9
0
votes
1 answer

I can't get the correct coordinate of an image with mouse over C#

This is my first question ever on Stackoverflow. So I hope it for the best answer. I want to get correct X and Y coordinate of an Image with mouse over Event (WFA .NET Framework). Take a look at my cursor The coordinate should be somewhere between…
Nggarap
  • 63
  • 8
0
votes
0 answers

Load Picture In Picture Box Based on Method

So I have my resource folder full of pictures, and I know to load one into a picturebox, its picPictureBox.Image = Properties.Resources.Imagename But I created a method that will return me the name of one of my pictures. I've tried…
AbrahamKMS
  • 85
  • 5
0
votes
2 answers

How to reduce the amount of memory used by consecutive Graphics.DrawImage()

I'm working on building an application that displays one of three images in a list images on a picture box every 3 seconds, and the way I did this is by loading one of the images directly into the picture box using drawing.Image =…
0
votes
1 answer

Drag PictureBox

I want to drag a PictureBox, and I have managed to do so. But my application doesn't do it as smoothly as Windows photo viewer. I mean the difference isn't huge or anything, but it's noticeable. Is there something I could do to make it a little less…
spunit
  • 523
  • 2
  • 6
  • 23
0
votes
0 answers

Is there a way to get a picture box to hold a value in VB?

I'm trying to build a game of battleships for my A level course but in all my projects so far have had to create two different arrays one that holds objects and one that hold different variables in a structure... I was wondering if there was any way…