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

How can I crop original image in a pictureBox that shows image in Zoom mode?

There is a topic How can I crop original image in a pictureBox that shows image in Stretch mode? I have the same qusetion, but now it's about Zoom mode. What formula do I use to determine coordinates for crop area in this situation?
Spica
  • 63
  • 6
0
votes
0 answers

coordinate of a click in a picturebox in c#

as title, i have a button that load an image in a picturebox, then when i click on it i want it to display the coordinates in two textbox, only proble...it display the coordinates when i click outside of the picturebox and not when i click in. i…
Matteo Sala
  • 43
  • 10
0
votes
1 answer

How to Fix this Error "A generic error occurred in GDI+"?

Open An Image from default name and save it by default name.(overwrit it) I need make graphics from Image("Default.jpg") that put it on picturebox1.image and draw some graphic on picurebox1.(it works and it is not my problem) But I can't save…
0
votes
1 answer

How to make sub for Picture box made during Run time in WinForms

So I have a button, and when the button is clicked, a picture box is created. I just wanted to know how I can make a message box appear when I click on that newly created picturebox. private void Button1_Click(object sender, EventArgs e) { …
0
votes
1 answer

VBA -setting picture box size to match drawn items

I am drawing items on a bitmap and want to set the PB_Visualizer picturebox to the size needed to fit all the drawn items. I first set the bitmap and PB_Visualizer to a known size and reset the overdrawn offset NEG and POS values to 0. PB_Visualizer…
Bobby
  • 659
  • 2
  • 13
  • 26
0
votes
2 answers

Looping through pictures in picturebox and adding its name to combobox?

I have around 20 pictures in picturebox and i want to loop through all images and add it's name to a combobox then i use the combobox to change the picture in the picturebox. I Dont know how to loop through picturebox images. for example..these…
Shan
  • 429
  • 3
  • 14
  • 31
0
votes
2 answers

Relocate PictureBox after zoom C#

I have a PictureBox inside a Panel, and I have implemented the zoom function with a TrackBar. When I increase (or decrease) the PictureBox, the position of the image remain fixed on the left side of the PictureBox. See the example to better…
user7041535
0
votes
0 answers

How to scroll an zoomed image C#

I have a picturebox and i can zoom it. When i zoom the picturebox i need to scroll left or right the image. Can you tell me why when i zoom the image the left side is fixed and i can't scroll on left? I have activated the AutoScroll on the main…
user7041535
0
votes
1 answer

I get an error when compiling with an imported image resource

This is turning into a nightmare! I have a C# DLL project and it has the regular About Form. I go to add my own image: I can see it listed and I accept: It looks fine: The moment I compile I get this error: I have googled the error: The…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
0
votes
0 answers

Change image in picturebox array by button click

I want to generate and change the image in the PictureBox array by button click. Here is what I have tried so far. public Form1() { InitializeComponent(); } PictureBox[] boxes = new PictureBox[6]; private void GenerateButton1_Click(object…
RojoL3L3
  • 3
  • 4
0
votes
0 answers

How can I get image display size in Picturebox size mode Zoom

I want to know how to find the length and width of the image that has been re-sized to fit in the picturebox zoom mode I tried this code but I got the original image size which I don't want. PictureBox2.Width PictureBox2.Height
0
votes
0 answers

How change image in pictureBox when stay on tabpage whitout switch on tabpages

in this code when I stay on tabpage image not changed in pictureBox but when switch tabpage image show in pictureBox I need when stay on tabpage that have picturBox, image change. private void picLastCap3_Paint(object sender, PaintEventArgs…
ashkan
  • 1
  • 3
0
votes
1 answer

C# How to print multiple pictureboxes

I have 2 pictureboxes: pb1 and pb2. Pb1 can be dragged and dropped, pb2 cannot. Pb1 can also be resized. What i want is, when pb1 is inside pb2, both (pb1 and pb2) must be printed. And pb1 must keep it's sizes. When a look at the prinpreview, is…
Martijn
  • 24,441
  • 60
  • 174
  • 261
0
votes
2 answers

how to know on which control in panel double click is made in vb.net

In vb.net i have one panel in which multiple picture box controls are added. When a double click is made on picture box, I want to save image of it. so how to know on which picture box control in panel double click is done?
vaichidrewar
  • 9,251
  • 18
  • 72
  • 86
0
votes
0 answers

Convert address of PictureBox image source

string address = PictureBox.Location; give the location of Picturebox image source. How get address of Picturebox's image source in this order: C:\\ABC\\XYX\\image.png The PictureBox load with: using (MySqlDataReader dr = cmd.ExecuteReader()) …
SDG69
  • 161
  • 1
  • 4
  • 19