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

Create graphic and save it as Bitmap

I have two questions: 1) I have a PictureBox and its Dock is set to Fill. When I resize the Form I cannot create a Graphic on the part of the PictureBox that is extended. What is the problem? 2) I want to convert the Graphic that is created on the…
Hesam Qodsi
  • 1,569
  • 3
  • 25
  • 38
8
votes
3 answers

Where does this quality loss on Images come from?

in my Winforms application which is connected to a database via Linq to SQL I am saving images (always *.png) to a table which looks like this: CREATE TABLE [dbo].[Images] ( [Id] INT IDENTITY (1, 1) NOT NULL, [Bild] IMAGE NOT…
チーズパン
  • 2,752
  • 8
  • 42
  • 63
8
votes
1 answer

How do I get the color of a specific pixel from a picture box?

I have a picture box in one of my programs which displays my images just fine. What's displayed consists of a chosen "BackColor" and some filled rectangles using a brush and some lines using a pen. I have no imported images. I need to retrieve the…
user3765211
  • 83
  • 1
  • 3
7
votes
3 answers

PictureBox visible property does not work... help please

I am using window app and C#.. i have a picture which is invisible at the start of the app.. when some button is clicked, the picture box has to be shown.. i use this coding but the picture box is not visible private void save_click(object sender,…
Vincent
  • 484
  • 4
  • 6
  • 21
7
votes
2 answers

How to draw smooth images with C#?

I'm trying to draw images on a C# form (in PictureBoxes, as well as using Graphics.DrawImage()), and am looking for a way to draw them smooth. The images must be a format that supports transparency, so PNG, GIF, SVG, and WMF. C# doesn't support…
Mike Trpcic
7
votes
3 answers

Can I create a transparent background on a PictureBox in WinForms?

I want to make the background of a PictureBox control transparent. In the PictureBox (rectangular shape), I placed an icon (circular in shape). I want to make the icon transparent so that the other portion underneath the icon is visible. I have…
Khalad
  • 73
  • 1
  • 1
  • 5
7
votes
4 answers

Delete Image from PictureBox in C#

how to delete image from picture box when user press "del" key...I dont find any keypress or keydown events for PB. private void topRight_pbx_MouseClick(object sender, MouseEventArgs e) { imgSelected=true; …
Dark Knight
  • 3,507
  • 8
  • 35
  • 44
7
votes
1 answer

Code confusion - why does one work, but not the other?

Note: This already works fine, but I'm trying to understand Why it works this way, but not the other. I have a WinForm (C#) with dynamically put images, like so: Now if you click the 'Napred' button, these images should be deleted (among other…
Toza
  • 1,348
  • 2
  • 14
  • 35
7
votes
3 answers

How to update EXIF tags of a picture file in Ruby?

Title says everything.
aurels
  • 801
  • 7
  • 15
7
votes
3 answers

How can I cause a panel to scroll programatically to expose its AutoSized picture box

I have a picture box set to AutoSize so that the image forces it to grow to the image's full size. The picture box is in a panel with autoScroll = true, so that scroll bars appear when the picture is larger than the panel. How can I programmatically…
Stuart Helwig
  • 9,318
  • 8
  • 51
  • 67
7
votes
3 answers

how to draw drawings in picture box

draw pictures in picture Box on Mouse dragging using c#
Binu
  • 1,365
  • 5
  • 14
  • 23
7
votes
4 answers

Object does not match target type

I have a TableLayoutPanel with a grid of PictureBox controls within it. I'm trying to find a shortcut way to change them all to Label controls instead of manually deleting each one and placing new controls in each cell. I thought I could go into…
gonzobrains
  • 7,856
  • 14
  • 81
  • 132
7
votes
1 answer

Displaying webcam feed in cv::Mat format in a picturebox

I am using OpenCV to take a live stream from a webcam and after detecting faces. I am resizing them so that only my face is displayed. But the problem is that I am doing all this in C++ Windows Forms and I want it to be displayed in a PictureBox…
U.B.A.R
  • 221
  • 2
  • 4
  • 12
7
votes
1 answer

How to pan Image inside PictureBox

I have a custom PictureBox which can zoom in using MouseWheel event. Now I want to add a panning feature to it. I mean when PictureBox is in zoomed state, if user left clicks and holds the click then move the mouse, the image would pan within the…
Dumbo
  • 13,555
  • 54
  • 184
  • 288
6
votes
4 answers

MouseMove event in PictureBox is fired continuously even if the mouse is not moved

Why does MouseMove event of a PictureBox seem to be fired continuously even if the mouse is not moved? I have tried the following codes to prove it (by simply creating a new form with a PictureBox and a Label on it). private void…
Setyo N
  • 1,953
  • 2
  • 26
  • 28