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

How to prevent changing picturebox's size when changing size of the control that contains the picturebox?

I have a user control with picturebox on it. I want the picturebox size to remain the same, but the form that contains the user control changes the hight of the control and the picturebox's height changes. Can I somehow keep the height (and width)…
Mike
  • 21
  • 2
0
votes
1 answer

C# - picturebox, graphics.DrawImage and picturebox.Image = null, why?

I'm trying to crop and resize an image in PictureBox1. My code: //original image for eventually undo undoImage = pictureBox1.BackgroundImage.Clone() as Image; Bitmap sourceBitmap = new Bitmap(pictureBox1.BackgroundImage, pictureBox1.Width,…
Daniel K
  • 1
  • 1
0
votes
1 answer

Use IF to check imagelocation value of a picturebox

To let you know, I'm using the visual basic winform coding. AND I'm using visual studio community 2015. I know how to use the "if" command like this: If TextBox1.Text = "hi" Then Label1.Text = "TEST" End If I also know I can have ifs with ifs…
0
votes
2 answers

An Unhandled exception: YUV Packed to JPEG Conversion On Button Press VC++2010 Form Application

i have YUV packed images which i have first convert to planar and then jpeg format (on button press) for Displaying in a picture box in VC++ 2010, using command at the end of entire code (after jpeg conversion done) pictureBox1->Image =…
0
votes
1 answer

Calling an opencv Mat from a dll to windows forms, image is glitchy

I have an openCv based dll, that connects to a camera. I then call a cv::mat object into a C# application, and display the image as a Bitmap in a picturebox object. This works, but the image occasionally 'glitches', showing flashes of lines, static…
anti
  • 3,011
  • 7
  • 36
  • 86
0
votes
0 answers

How can I get the image of a PictureBox generated with OpenGL?

I have associated the PictureBox to OpenGL through its handle hDC = GetDC((HWND)picBoxA->Handle.ToInt64()); This works perfectly and the graphics are drawn in the PictureBox. The problem is that I've been looking for all day for a way to get the…
0
votes
2 answers

How to save drew Graphics of "Paint()" into image using c#?

I actually wanted to Convert RTF into Image so after googling a lot I've got a code that does it by Paint() Event of Picturebox1 and it works perfectly : private void pictureBox1_Paint(object sender, PaintEventArgs e) { …
Khaled Rakhisi
  • 317
  • 1
  • 4
  • 18
0
votes
2 answers

How to make a Picturebox stop Auto-Validate?

I have got problem with an Picturebox(picWorld). When I want to change its size and location like this code, It took much time because I think it is updating twice: private void lblWorld_MouseEnter(object sender, EventArgs e) { picWorld.Size =…
user6546754
0
votes
1 answer

mouse event on picturebox

I want to see my pixel coordinates on moviing my mouse on the image in picture box I have added this event Form.designer.cs this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown); and this method in…
Shahgee
  • 3,303
  • 8
  • 49
  • 81
0
votes
1 answer

How do I draw a picturebox at run time?

public void read_file(string fname) { filepath = fname; TextReader input = File.OpenText(filepath); line = input.ReadLine(); int[] ID = new int[6]; int[] x = new int[6]; int[] y = new int[6]; …
Emykindman
  • 51
  • 2
  • 6
0
votes
1 answer

Timer tick doesn't change picturebox image

rightT is a timer which is supposed to change the image of the object (which inherits from PictureBox) when the code runs (after I turned on the timer) the image changes only once and never changes again anyone knows why it happens? rightT.Tick +=…
Infinity
  • 41
  • 4
0
votes
1 answer

What Exactly Happens in C# When PictureBox.Visible Is Set to True?

I'm creating a WinForms app with picture boxes which are disabled and not visible by default. When I click on a radio button in my form, I want the picture boxes to appear and immediately after that I want something to be drawn over them: // the…
honzukka
  • 3
  • 3
0
votes
1 answer

Picturebox from AForge FFMPEG empty - C#/WinForms

I've done a ton of research and looked at a lot of questions here but can't seem to find anything to help me. I should preface I'm very new to C#, Windows Forms, and SO! I'm a 1st year CompSci student coming from C++ experimenting with my own…
0
votes
0 answers

C# zoom image without zooming the picturebox

I would like to zoom image with mouse in the picturebox. The code below zoom the image but the picture box zoom itself. I want to zoom the image without zooming the picturebox. What can i edit the code below? Thanks protected override void…
chris
  • 9
  • 2
0
votes
1 answer

Set picturebox image to image from PhantomJS loaded page

The current situation is that i'm using PhantomJS and Selenium to load web pages, because the host website is behind cloudflare ddos protection so I can't use anything that doesn't have javascript built in. This has been working well for a while but…
Sasha
  • 1,674
  • 1
  • 16
  • 23
1 2 3
99
100