picturebox

Print images c#.net

邮差的信 提交于 2019-12-17 06:36:12
问题 I have an image in a PictureBox, and I want to print it. No formatting, no nothing, just print it. I've been searching on Google but I've got nothing, only people printing forms or text or reports. private string imgSrc; public string ImgSrc { get { return imgSrc; } set { imgSrc = value; } } public Id_Manager() { ImgSrc = "D:\\Foto.jpg"; InitializeComponent(); idPicture.Load(this.ImgSrc); } Obviously the image is going to change, but for now I'm just interested in printing that image. I'm

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

假如想象 提交于 2019-12-17 06:18:09
问题 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 differ with each code sample) none work. What is the correct way to add to (or subtract from), for example, the red value, to change the tint of an image in a pictureBox? I'm using C#. Thank you EDIT: Here is an example of

A PictureBox Problem

半世苍凉 提交于 2019-12-17 04:34:30
问题 I have a problem: I have 3 picture boxes with 3 different images as in Image what can i set to pictureBox3 so both images look same..... EDITED: I want to move pictureBox3 on pictureBox2, So there is no Option to merge them to single image 回答1: I'll add another example that according to the updated requirement allows for moving image3. To get it working, put an image with transparency in Resources\transp.png This uses the same image for all three images, but you can simply replace

How can I treat the circle as a control after drawing it? - Moving and selecting shapes

自古美人都是妖i 提交于 2019-12-17 04:34:08
问题 Actually, after clicking on each circle i want its color to be changed, for instance, i want it to turn into red,Overall, i wanna treat it as control. i know how to draw the circles that represent the nodes of the graph when i Double click on the picturebox. i'm using the following code: public Form1() { InitializeComponent(); pictureBox1.Paint += new PaintEventHandler(pic_Paint); } public Point positionCursor { get; set; } private List<Point> points = new List<Point>(); public int

New Multi-threading not working

谁说胖子不能爱 提交于 2019-12-14 02:45:52
问题 I'm trying to create a thread so when I click a button it creates a new PictureBox from a class, this is how far I've got but nothing comes up on the screen at all. Form1 code: Public Class Form1 Private pgClass As New SecondUIClass Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click pgClass = New SecondUIClass pgClass.x += 100 pgClass.thread() End Sub End Class Class Code: Imports System.Threading Public Class SecondUIClass Public

Get bitmap and draw it into image

一笑奈何 提交于 2019-12-13 19:03:12
问题 I am trying to save my drawing from picturebox into bitmap and draw that bitmap into image. So far, nothing has appeared in the final image, but while debugging I can only say, that the original bitmap is not null and with/height are correct. However nothing appears after I draw it into image. I save my drawing into bitmap like this: GraphicsPath path = RoundedRectangle.Create(x, y, width, height, corners, RoundedRectangle.RectangleCorners.All); g.FillPath(Brushes.LightGray, path); g.SetClip

“A generic error occurred in GDI+” after loading a PictureBox with an animated GIF

余生长醉 提交于 2019-12-13 15:26:24
问题 I have a Windows Forms application in .NET 2.0 with a PictureBox on a form and I load it with an animated GIF by setting the PictureBox's ImageLocation property. When it is time for the animation to render the next frame, I get the following exception and stack trace: A generic error occurred in GDI+. at System.Drawing.Image.SelectActiveFrame(FrameDimension dimension, Int32 frameIndex) at System.Drawing.ImageAnimator.ImageInfo.UpdateFrame() at System.Drawing.ImageAnimator.UpdateFrames() at

How can I load a generated Bitmap into a PictureBox?

时光总嘲笑我的痴心妄想 提交于 2019-12-13 13:31:21
问题 There seem to be many picturebox questions out there, but I haven't found any that deal with changing the contents of a picturebox to a bitmap that was not simply loaded from file. My application takes an array of bytes and generates a bitmap from them. I really want to avoid writing to a file as an intermediate processing step. Because it is an array of bytes, and not 2-byte words, I needed to make an indexed bitmap with a grayscale palette. I then converted the indexed bitmap to a normal

How to create PictureBoxes with shapes based on a Picture

做~自己de王妃 提交于 2019-12-13 11:24:51
问题 Problem: I have pictures of objects on a white background. I need PictureBoxes that do have the exact shape of these objects, but I do not know how these objects look like a priori. 回答1: My solution to this is a new class: class ShapedPictureBox : PictureBox { public ShapedPictureBox() { } public Color transparentColor = Color.White; public void updateShape() { if(this.Image = null) return; Bitmap bitmap = new Bitmap(this.Image); System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System

How to save and retrieve binary image data to picture box in winforms using C#

☆樱花仙子☆ 提交于 2019-12-13 08:22:26
问题 How to save and retrieve binary image data to picture box in Winforms using C#? I have tried this ms = new MemoryStream(); pictureBox1.Image.Save(ms, ImageFormat.Jpeg); byte[] photo_aray = new byte[ms.Length]; ms.Position = 0; ms.Read(photo_aray, 0, photo_aray.Length); SqlCommand cmd1 = new SqlCommand("insert into Registration(Photo)values('"+photo_aray+"') It is saving but when trying to retrieve, an error "parameter is invalid" is showing up. I have tried this for search photo_aray = (byte[