FAQ Database Discussion Community


Reveal portions of an image behind another image

c#,overlay,picturebox,bmp
I have a PictureBox where I display an image (Let's call it Image1). There's a second image (Image2) which needs to be revealed as the user hovers the Image1 with the mouse. I only need to reveal part of Image2 (a 10X10 pixel size box), not the whole image as...

How to take a image url from a datagridview and put it into a picturebox in c#

c#,datagridview,picturebox,imageurl
Good day I am needing help I want to take an image url that is in a datagridview which is connected to a database and add the url to a picturebox in c#. I have searched for it but had no luck...

Convert PictureBox Selection Rectangle according to SizeMode

c#,selection,picturebox,coordinate-systems
I have two PictureBoxes pbOriginal and pbFace. After Selecting a "face" from an image in pbOriginal I clone the rectangle selection and place it into pbFace. However, Because pbOriginal is using SelectionMode=Stretch the actual area being copied is not the same as the area being selected. How do I convert...

.gif doesn't animate until the whole loop ends?

c#,multithreading,winforms,picturebox
I'm try to add 300 buttons in run-time winform by a loop. It takes a lot of time, so I want to display a .gif loading image when the loop is running. The loading.gif just shows but doesn't animate until the loop finishes. Why is that? pictureBox1.Load("loading.gif"); pictureBox1.Invalidate(); pictureBox1.Update(); //...

mouse position (Cursor.Position)

c#,image,mouseevent,picturebox,pixels
I have image 10*10 mult it in factor and loading the image to picturebox I have problem to select the mouse position when I clicking in everywhere over the image the point showing in the corner Upper-left what is the error??

PictureBox and Paint Event

c#,winforms,events,picturebox
I have a picturebox, let's say "PB". I catch the paint event of PB in private void PB_Paint(object sender, PaintEventArgs e) In PB_Paint, I draw some shapes. I would like to control who calls this method. For example, when the Form is resized or other thing, they call PB.Invalidate() which...

Draw color to every pixel in picturebox

c#,draw,picturebox,progress
Can someone help me: I want to draw colors every pixel to picturebox This is what I have done so far: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication25 { public partial class Form1 : Form { public Form1() {...

Stop dragging picturebox c #

c#,image,winforms,picturebox
I have a picturebox and movement just right and to the left, but when moving it to the left or right edge of the picturebox appears in the middle of the form , as the picture below This thus what I want is when moving left or right when the...

Altering Image via Graphics wont render in form

c#,winforms,picturebox
I am using the following code in an attempt to draw on an image inside a picture box, however the changes are not rendering on the form itself. private void pictureBox1_Paint(object sender, PaintEventArgs e) { if (drawMode) { Graphics g = Graphics.FromImage(pictureBox1.Image); RectangleF rectf = new RectangleF(10, 10, 100, 100);...

VB.NET Fading out button properly

vb.net,winforms,button,picturebox,fade
How do you fade out/in a button in VB.NET properly? I can fadeout/in labels using: Controls(i).ForeColor = Color.FromArgb(255, alpha, alpha, alpha) (where Controls(i) is a label from a For Next loop through all controls in Me.Controls; alpha is the value of the RGB, also from a For Next loop). This...

Impossible clean PictureBox

vb.net,picturebox
I want clean the PictureBox image, so I make this code: TransparentPictureBox.Image = Nothing, the image don't disappear and I obtain all new image overlapping to the previous. How can I fix this? I stay using a custom control, this is the class: Public Class TransparentPictureBox Inherits PictureBox Public Sub...

Visual Studio 2012 Dynamic PictureBox Image

c#,visual-studio,visual-studio-2012,picturebox
I have a quick question, I have been struggling with something that should, in theory be quite simple. I want to create a dynamic button out of a picture box in Visual Studio 2012, one that changes the image each time I click it. if (pictureBox4.BackgroundImage == MyProject.Properties.Resources._1) pictureBox4.BackgroundImage =...

Moving dot on picturebox in vb.net

vb.net,image,overlay,picturebox
I have a picturebox, and would need to draw a single red pixel at a given coordinate. This pixel will move, and when i assign a new position the old position is removed, so that only a single pixel is red at any given time. If possible it would be...

How to remove PictureBoxes dynamically?

c#,picturebox
I am trying to make pictureboxes fall continuously in the form. Here is the code that I tried. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Rain_dropz { public partial class Form1 : Form { PictureBox[] RD = new PictureBox[500]; int...

picture box crossed out C#

c#,graphics,2d,picturebox,gdi
I have a project in which I draw several rectangles using GDI. I do it using i++ from i=0 to i<=10. I use e.Graphics.FillRectangles. I refresh the drawn rectangles every 1/10s by calling Graphics.Invalidate() My problem is that my picture box gets crossed out when drawing more the 4 rectangles....

picturebox click event fires before the picturebox's contextmenu menuitem click

c#,winforms,contextmenu,picturebox
I have a PictureBox.Click event and I also have a PictureBox.ContextMenu -- when I click on a menu item within the context menu, it fires the PictureBox.Click event first, then the event attached to the menu item. This is not what I want. Is there a way to fire the...

Getting wrong array size in picturebox to byte array function

c#,arrays,multithreading,picturebox
When trying to convert a picturebox to a byte array, i get a wrong array length The PictureBox is 352 * 288 = 101376 pixels, converting to a byte array should give an array length of 101376 * 3 = 304128 bytes. I try to convert to an array using...

Transforming Coordinate in Picturebox

c#,winforms,picturebox
As i understand it, the picturebox coordinates system in .NET is defined such that the top point is the origin, with X pointing right, and Y pointing downwards. Is there an in built .NET function to transform the default coordinates into cartesian? (Such that the origin is now at the...

(VB.net) Having a picturebox as a property of a class

arrays,vb.net,class,picturebox
I am currently making a space invaders game in vb (for a school project otherwise I would steer clear of this for making a game...) I have a class called Invader, where the information on each enemy will be stored. Part of this is having a picturebox to display the...

The Image in the picture box does not change

c#,winforms,datagridview,picturebox
Please I need help here. I am using data from a gridview to fill textboxes and a pictureBox. The textboxes fill up just fine when I click on a row. But the picture box shows just one image. irrestpective of which row I select the same image shows up. Please...

Move windows form from a picturebox in C#

c#,.net,winforms,picturebox
I have a windows form without any border. So i added a picture box and i want the whole form to be moved when that picture box is clicked. public const int WM_NCLBUTTONDOWN = 0xA1; public const int HT_CAPTION = 0x2; [DllImportAttribute("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg,...

pictureBox.ImageLocation with asteriks

c#,visual-studio,picturebox
i'm considerably new to c# and Visual Studio so i got stuck on one problem. Is there a way to make this pictureBox propertie to locate any image file? Asteriks doesn't seem to work.. this.pictureBox1.ImageLocation = "d:\\*.png"; The directory alawys consists of single .png file, though it changes name periodically....

PictureBox doesn't appear

c#,winforms,picturebox
I have an if statement, inside that if statement is a foreach, for accessing each string from a string[]. The strings are some parameters for an NPC which are read from a file. The first one represents the NPC type which are two : "battle" and "teach", the last string[]...

Moving a picture box in timer C# Winforms

c#,winforms,timer,2d,picturebox
Ok so please keep answers very direct and i must say i am very new to C#, i don't know a lot of stuff. Without further adieu my problem. I am trying to move a picture box horizontally across the screen on a timer.The timer must go infinitely. I have...

Picturebox Height/Width using textbox…How?

textbox,resize,height,picturebox,weight
I want to control picture using textbox and button for submit, but ... private void button_Click(object sender, EventArgs e) { int height = int.Parse(textbox1.Text); height = PublicImage.Height; int width = int.Parse(textbox1.Text); width = PublicImage.Width; } ...

c# move picturebox from an array of picturebox up when you hover mouse

c#,wpf,mouse,picturebox
I'm working on C# windows form. I have an array of picturebox, displayed on the form. The array has the size of 13, and they're all side by side. How can I make it so that when I click on a picturebox, it is moved up by let's say +20...

lock image file in PictureBox

c#,winforms,picturebox
I load an image into a picturebox: myPictureBox.Image = Image.FromFile(strImageFile); and works perfectly, but the image file is locked and I can't manage until my application is closed.. I need, from another window of the program, save a new image to reload when this child window is closed.....

Adding or subtracting color from an image in a pictureBox using C#

c#,image-processing,picturebox,openfiledialog
I'd like to learn how to code some very basic image editing in Visual Studio. I'm using the openFileDialog to load a picture into a pictureBox. I've found some loops on the internet that are designed to convert color on a pixel by pixel basis, but for various reasons (that...

How to use BringToFront(); properly?

c#,object,picturebox,bringtofront
So I've been working on a little game project called economy, and I've ran into a little problem. What I want is to draw a stick man on the screen when someone hires a new employee, I do this by creating a new picture box, and assigning the stick man...

Hide Picturebox if image is invalid

vb.net,image,telerik,report,picturebox
I am creating reports using Telerik Reporting Tool and has some image on it. I display the Image in the picturebox using a URL that came from the clients but there are instances where the given URL is invalid so it will display an error message in the report. I...

Experiment on displaying a Bitmap retrieved from a camera on a Picturebox

c#,opencv,bitmap,camera,picturebox
In my code I retrieve frames from a camera with a pointer to an unmanaged object, make some calculations on it and then I make it visualized on a picturebox control. Before I go further in this application with all the details, I want to be sure that the base...

I would like to control Form1 from Form2 (textbox,picturebox) [duplicate]

c#,winforms,textbox,picturebox
This question already has an answer here: C# - How to make two forms reference each other 6 answers I want to resize my picturebox in Form1 (picturebox1) using textbox1,textbox2 and button in Form2. First I made this in Form1.Designer.cs: public System.Windows.Forms.PictureBox picturebox1; After this in Form2.cs (submit button):...

C# PictureBox variable in a class

c#,variables,picturebox
I was trying to make a struct with 2 variables, Double and PictureBox. People suggested that I should use class instead of struct. When I try to create the class. It won't let me add PictureBox card; it's just underlining it red. Any solution or reason why? or suggestion to...

How do I get a List by name

c#,forms,list,rows,picturebox
Essentially, what I'm trying to do is add the the control to the corresponding List "row"+row, (whatever the row number is current in the for loop), however, I can't seem to find a way to get a list reference by string. I was wondering if there is a way to...

Suggestion: Drag and Dropping Between PictureBoxes

c#,visual-studio-2013,drag-and-drop,picturebox
I have included 2 images so you can understand my question easier, I could not link them directly in here as I am a new member, so I have put them in my Dropbox public folder, Image 1: Design View https://www.dropbox.com/s/wca5gstd8kdsie7/designView.png?dl=0 Here you can see a Group Panel on the...

Why if I call pictureBoxPreview1.Image.Dispose() for only one camera, memory usage spikes?

c#,memory-leaks,picturebox
I am showing the images that I capture from two cameras in a picturebox (the same for both). Each camera image is shown in a different ROI of the picturebox. My problem is that the memory used by the application is increasing continuously, most probably I am missing freeing some...