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

C# PictureBox DrawLine ploblem

I have a picture box with size 432x322. I would like to draw a line from (50, 50) to (382, 272), but the end point turns out outside the picture box. The part of code is: e.Graphics.DrawLine(new Pen(Brushes.Black, 2), new Point(50, 50), new…
0
votes
1 answer

Progress bar won't hide when I want it too? VB

Hi I am creating a simple game in VB where monsters randomly spawn in and disappear when you click on the picture box several times. Each enemy has a progress bar on top which should disappear when the enemy dies (when the enemies disappear). The…
0
votes
1 answer

How do I create an array of PictureBox using a loop?

I need to create 49 PictureBoxes and then place them on a Form. I was thinking in something like Public Class Form1 Dim grid() as PictureBox Public Sub Form_Load () Handles Me.Load For i = 0 to 48 grid(i) = New PictureBox …
RicRev
  • 29
  • 1
  • 1
  • 8
0
votes
1 answer

PictureBox resources release

I want to make a screen zoomer that captures a part of the screen and zoom it. The code below can now capture the screen and play it in a PictureBox. But I have this problem that my memory keeps growing while I open the program. I think there must…
Chuan Sun
  • 67
  • 8
0
votes
1 answer

How can I use the Pen tool to draw a simple black line on a PictureBox's Image object?

I'm trying to draw a line that goes from middle top to bottom. I know I have to use the Pen class to accomplish this. private void RepaintPreview() { Pen blackPen = new Pen(Brushes.Black); blackPen.Width = 1.0f; blackPen.LineJoin =…
delete
0
votes
0 answers

Way of merging multiple Picture Boxes into one big PictureBox?

I am working on a Space Invaders game using C# WinForms and during the gameplay stage I will want the invaders to move down vertically and a bit horizontally towards the bottom of the screen. The issue with having many of these invaders on the…
user8721727
0
votes
0 answers

How to prevent loss of Image quality when saving a bitmap image as a .JPG using Winforms

I'm a student working on a GUI using C# Winforms, where the user is able to load an image, paint on it and then save the edited image to his system. Bitmap b = new Bitmap(imgList); image.DrawImage(b, new Rectangle(0, 0,…
SwamJay
  • 27
  • 3
0
votes
1 answer

Why does my Picture Box move to the top of the form?

So within my program, I want an object to move left or right depending on what arrow key is held down. I moved the the picture box on the bottom of them form so when any of the two arrow keys are pressed they would move along the bottom. But what's…
user8721727
0
votes
1 answer

Picturebox1.load sudden failure

Suddenly when I use Picturebox1.load to download an image from the Internet I get this error: The request was aborted: Could not create SSL/TLS secure channel. I have used this for years and never had any problems. What's interesting is, if I create…
brand0
  • 11
  • 4
0
votes
0 answers

Save pictureBox live preview as a GIF

I'm using a WebCam to show a live Preview of the webcam I'm trying to save about 5 seconds of the live Preview as a Gif, but i cant find the right way. This is the code I'm using to save pictureBox as jpg. private void saveButton_Click(object…
Zuriel Rodriguez
  • 393
  • 1
  • 2
  • 11
0
votes
0 answers

What windows form object should i use for the output for my C# 2D game? eg picturebox, base form or other

I am making a simple 2d game similar to zelda in c# for practice and to get some insight into C#, and just because i want to try a bunch of different things. I have enough of the game running to actually play, but i was wondering if i was doing…
0
votes
1 answer

How to avoid flickering of graphic object when drawn on picture box in C#?

I am not good at graphic plotting in C#. I am trying to do an animated plotting of a rectangular point on an Image in PictureBox. However, I am facing some flickering issues, I couldn't find the way; how to resolve this issue. g =…
SN25
  • 69
  • 1
  • 12
0
votes
1 answer

Retrieve photo from database to PictureBox

I have a VB.NET project with 2 WinForms. Now in Form 1, I added a PictureBox, a Button, a OpenFileDialog. I have coded the button to add the picture from PictureBox to sql database. Now I have another picturebox in Form 2. So my question is, how do…
user8697090
0
votes
1 answer

How to put label behind the picturebox so label can be seen under picturebox c#?

My problem is like that: I have a Windows Form Application and it contains a picture which is in a picturebox. The picture contains mostly transparent parts and picture box is also transparent. So when I change backgroundcolor property of form,…
Baacus
  • 21
  • 1
  • 7
0
votes
1 answer

picturebox on picturebox not giving transparancy

I'm making a game (2d game) in which I'm reading the map from a text file and then depends on the characters that are in the text file , the pictureboxes are generated. The player is rendered before the blocks (walls) because for some reason when I…
1 2 3
99
100