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

Controling image name

I want to do something like if image name (which are currently in picture box) = enemy1 do this and if image name = enemy2 do something else case 1: Image enemy1 = zaverpol.Properties.Resources._1tier_enemy; …
0
votes
1 answer

Clicking on PictureBox with AutoIt ControlClick fails

I am trying to automatically click a PictureBox control from an old VB6 application using AutoIt. Window Info finds a control with class ThunderRT6PictureBoxDC and ID 15, and AutoIt successfully hides it if I run... ControlHide($class, "",…
Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
0
votes
2 answers

How do I move the Image inside the picturebox?

I want an Image to move inside the picturebox. It shouldn't be possible that you can drag it out. I found an answer with the Padding and tried it out but it drags in the opposite direction. So I tried out to switch it with Right and down, but it is…
Neard
  • 29
  • 8
0
votes
1 answer

How to modify control properties through variable reference

I've been working on making a project of mine more modular. Something I've wanted to do is have multiple buttons use the same function when they perform a similar action, but with different values. I've been stuck on trying to apply this to the…
0
votes
2 answers

How can I write overflowed text to the next line in picturebox?

I am painting to PictureBox but the problem is my painting (text) overflow from picture box. How can I write to the next line? private string idbul(string gelenid) { string id = gelenid; string[] malzeme = id.Split(' '); …
user6214140
0
votes
1 answer

How to prevent "drawstring" from being removed?

private void Side_pictureBox_Paint(object sender, PaintEventArgs e) { if (doubleclicked == true) { Side_pictureBox.Refresh(); for (int numbering_for_digram = 1;…
0
votes
1 answer

mfc picture control disappears after multiple runs

I am using picture control to display four small colored bmps. I have a member function that sets the bmp to the color I want. The problem is when I run my function SetColor multiple times with the test button click function the picture control…
Terry
  • 19
  • 3
0
votes
1 answer

Dragging Objects in C#

I am attempting to drag Music Notes vertically, up and down a Music Staff. However, rather than a constant drag, I would like the music notes to only be allowed to be dragged onto particular intervals (only specific y-coordinates). For example, in a…
Luke Xuereb
  • 73
  • 12
0
votes
5 answers

How do I solve an "InvalidCastException" in C#?

I am getting a run-time error which tells me that it is unable to cast an object of type PictureBox to type MusicNote (MusicNote inherits from PictureBox.) private void Note_MouseDown(object sender, MouseEventArgs e) { //try //{ …
Luke Xuereb
  • 73
  • 12
0
votes
1 answer

.PNG Images Accepted by PictureBox in C#?

I am attempting to add a .PNG image to a PictureBox, but it does not seem to be reading it. public static String NoteImage_path = Environment.CurrentDirectory + @"\Notes-Images\"; ImageLocation = NoteImage_path + "test" + ".png"; With this exact…
Luke Xuereb
  • 73
  • 12
0
votes
2 answers

Removing a particular color/background in C# PictureBox

I am attempting to remove a white background from my pictureboxes in my C# Form as can be seen here. I have already tried to use BackColor = Color.Transparent; , however, this did not work. Is there another way to go about this? Perhaps a function…
Luke Xuereb
  • 73
  • 12
0
votes
0 answers

Adding Multiple Images to a Form in C#

So I am trying to add several images (Music Notes) in the form of PictureBox to a form, but despite all my efforts, only the first music note is being displayed, and all preceding music notes are not. Key_MouseUp Event (occurs when the mouse is…
Luke Xuereb
  • 73
  • 12
0
votes
1 answer

Adding multiple PictureBox to a C# Form

I am trying to add several pictures (using PictureBox) of music notes to a Music Staff Form. In a certain Mouse Event (MouseUp), a Music Note is created, and a music note should appear on the screen. However, only when the first note is created does…
Luke Xuereb
  • 73
  • 12
0
votes
1 answer

Save original image from PictureBox, not resized

Is it possible to save original image with original quality from PictureBox, not the stretched/resized one? I download byte array from a server and put it in PictureBox, I want user to be able to save the actual image, but it should be the original…
user10820813
0
votes
1 answer

How to change a PictureBox image from another Form

I want to open form2 while form1 loads. Also, I want to change the Image of a PictureBox in form2 when an action is triggered in form1. To open form2 while form1 loads I used this code: private void MONITOR3_Load(object sender, EventArgs e) { …