picturebox

Visual C# changing image on control gives exception

与世无争的帅哥 提交于 2020-01-05 04:06:09
问题 I am writing a plugin in C#, in which I have a user control with a linklabel on it that controls a form that shows up like a tooltip and a picturebox next to the label to show the status whether or not the form is visible or hidden. I have two images that are added as resources by the book via the Visual Studio PludingResources Designer. (I tried setting the Persistence of the images both to Linked at compile time and to embedded to solve the problem.) The rubber meets the road in the

Changing images in the picturebox to sepia

不想你离开。 提交于 2020-01-05 03:55:11
问题 I have a picturebox and want to change the image color to sepia i know what to do so far in terms of setting it to grayscale then filtering it but the final part is my downfall can someone help set this to sepia for me by suggesting what i should do from the comments that i have provided thanks a lot 回答1: Your code can be boiled down to: private void button1_Click(object sender, EventArgs e) { Bitmap sepiaEffect = (Bitmap)pictureBox.Image.Clone(); for (int yCoordinate = 0; yCoordinate <

How to zoom picturebox along with graphics

安稳与你 提交于 2020-01-03 06:37:18
问题 I want to zoom picture box along with graphics. this will Zoom the only image part not the graphics part. public Image PictureBoxZoom(Image imgP, Size size) { Bitmap bm = new Bitmap(imgP, Convert.ToInt32(imgP.Width * size.Width), Convert.ToInt32(imgP.Height * size.Height)); Graphics grap = Graphics.FromImage(bm); grap.InterpolationMode = InterpolationMode.HighQualityBicubic; return bm; } private void zoomSlider_Scroll(object sender, EventArgs e) { if (zoomSlider.Value > 0 && img != null) {

Saving Image From Picturebox

妖精的绣舞 提交于 2020-01-03 04:47:05
问题 Iam drawing an image to a picturebox. I resize the image in the picturebox as per the width and height to fit it correctly in picutrebox. After that i want to save it, while saving it i also want to save the non image drawn part too in the saved file. Please see the screenshot, in the screenshot i have 2 white portions marked 'X'. when i save the image in picturebox i also want to save the blank portion too (place corssed in red) as either transparent .png or solid white .jpg. Actually i

How to save graphics created on a PictureBox?

落花浮王杯 提交于 2019-12-31 04:30:54
问题 In c# and Visual Studio Windows forms I have loaded an image into a picture box (pictureBox2) and then cropped it and show in another picture box (pictureBox3). Now I want to save what is inside pictureBox3 as an image file. How can I do this? private void crop_bttn_Click(object sender, EventArgs e) { Image crop = GetCopyImage("grayScale.jpg"); pictureBox2.Image = crop; Bitmap sourceBitmap = new Bitmap(pictureBox2.Image, pictureBox2.Width, pictureBox2.Height); Graphics g = pictureBox3

Drawing Colors in a picturebox?

心不动则不痛 提交于 2019-12-31 04:15:11
问题 In C# i have a picturebox. i would like to draw 4 colors. The default will be white, red, green, blue. How do i draw these 4 colors stritched in this picbox? or should i have 4 picbox? in that case how do i set the rgb color? 回答1: You need to specify what it is you would specifically like to draw. You can't draw a red - that makes no sense. You can, however, draw a red rectangle at location (0,0) which is 100 pixels tall and 100 wide. I will answer what I can, however. If you want to set the

C# PictureBox on top of another PictureBox

China☆狼群 提交于 2019-12-31 04:00:26
问题 I want the pbGrade to be on top of pbItemtype (pb = picture box) pbItemtype.BackColor = Color.Transparent; // Change parent for overlay PictureBox... pbItemtype.Parent = pbGrade; I already tried this but then the pbItemtype is not even appearing, also the 2 picture boxes change images (pbItemtype and pbGrade) 回答1: Well actually you can do that easily and in fact you already did . The code works but you also need to correct the Location as the nested PB will keep it previous one and thus will

If picturebox.image == Properties.Resources.ImageA

一世执手 提交于 2019-12-30 10:36:29
问题 Im making few buttons(picturebox) that then you click them they change image. I tryed this code but it always skips to else. Images are loaded from resources. private void pictureBox7_Click(object sender, EventArgs e) { if (pictureBox7.Image == KaminuSkaiciuokle.Properties.Resources.IcopalA) { pictureBox7.Image = KaminuSkaiciuokle.Properties.Resources.IcopalB; } else { pictureBox7.Image = KaminuSkaiciuokle.Properties.Resources.IcopalA; } } Figured that out. Insted comparing picturebox.image I

Drawing on PictureBox

无人久伴 提交于 2019-12-29 09:22:14
问题 in a UserControl I have a PictureBox and some other controls. For the user control which contains this picturebox named as Graph I have a method to draw a curve on this picture box: //Method to draw X and Y axis on the graph private bool DrawAxis(PaintEventArgs e) { var g = e.Graphics; g.DrawLine(_penAxisMain, (float)(Graph.Bounds.Width / 2), 0, (float)(Graph.Bounds.Width / 2), (float)Bounds.Height); g.DrawLine(_penAxisMain, 0, (float)(Graph.Bounds.Height / 2), Graph.Bounds.Width, (float)

Drawing on PictureBox

▼魔方 西西 提交于 2019-12-29 09:21:28
问题 in a UserControl I have a PictureBox and some other controls. For the user control which contains this picturebox named as Graph I have a method to draw a curve on this picture box: //Method to draw X and Y axis on the graph private bool DrawAxis(PaintEventArgs e) { var g = e.Graphics; g.DrawLine(_penAxisMain, (float)(Graph.Bounds.Width / 2), 0, (float)(Graph.Bounds.Width / 2), (float)Bounds.Height); g.DrawLine(_penAxisMain, 0, (float)(Graph.Bounds.Height / 2), Graph.Bounds.Width, (float)