picturebox

Read a picture from Access DB into PictureBox

限于喜欢 提交于 2019-12-20 02:32:47
问题 I have been trying to read a picture saved in Access DB as a OLE object in a PictureBox in a C# windows Application. The code that does this is presented below: string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Rajesh\SampleDB_2003.mdb;"; OleDbConnection oConn = new OleDbConnection(connString); oConn.Open(); string commandString = "select * from employee where id = " + id + ""; OleDbCommand oCmd = new OleDbCommand(commandString, oConn); OleDbDataReader oReader = oCmd

No mapping exists from object type System.Drawing.Bitmap to a known managed provider native type, VB.NET

 ̄綄美尐妖づ 提交于 2019-12-19 10:25:50
问题 I have a problem saving images from PictureBox1 to my SQL server database, I've done my research and found out that I have to convert my image to a byte array in order to do that but I don't know how to apply it in this code that I'm trying to edit. When I click on the save button I get this error: No mapping exists from object type System.Drawing.Bitmap to a known managed provider native type . I think it has something to do with inserting the image to the database so I'll show you code

how to clear the graphics(rectangle shape) in picturebox

别说谁变了你拦得住时间么 提交于 2019-12-19 09:24:19
问题 i created rectangle shape user control and i am using this user control in my application.In my application i am processing a image for different operations such as reading barcode from images etc.Here i have two possibility of processing a image, one is processing entire image and another is processing selected part of the image,i am selecting the specific part of the image using rectangle shape(this is user-control).so i have given two option in my GUI for this purpose one is Entire image

Fit Image into PictureBox

☆樱花仙子☆ 提交于 2019-12-18 13:52:30
问题 using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString)) { myDatabaseConnection.Open(); using (SqlCommand SqlCommand = new SqlCommand("Select Photo from Employee where EmpID LIKE '%' + @EmpID + '%' ", myDatabaseConnection)) { SqlCommand.Parameters.AddWithValue("@EmpID", textBox1.Text); DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(SqlCommand); adapter.Fill(DS, "Images"); var imagesTable = DS.Tables["Images"]; var imagesRows

Fit Image into PictureBox

老子叫甜甜 提交于 2019-12-18 13:52:13
问题 using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString)) { myDatabaseConnection.Open(); using (SqlCommand SqlCommand = new SqlCommand("Select Photo from Employee where EmpID LIKE '%' + @EmpID + '%' ", myDatabaseConnection)) { SqlCommand.Parameters.AddWithValue("@EmpID", textBox1.Text); DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(SqlCommand); adapter.Fill(DS, "Images"); var imagesTable = DS.Tables["Images"]; var imagesRows

Creating Custom Picturebox with Draggable and Resizable Selection Window

风流意气都作罢 提交于 2019-12-18 09:49:30
问题 I'm using the following code to draw a selection rectangle over a picturebox and allow the user to select and drag it to the desired position. What I intend to achieve is to allow the user to adjust the rectangle size by implementing option to adjust the rectangle size. Currently I have managed to achieve the following. How to solve this issue? public class DraggablePictureBox : PictureBox { Boolean hit1 = false, hit2 = false; public Boolean notagimg = true; public Boolean editedflag = false;

Keeping a PictureBox centered inside a container

点点圈 提交于 2019-12-18 07:40:10
问题 I am desiging a simple picture viewer with ability to do some basic image processing. At the moment I have the problem of keeping the PictureBox centered inside a TabPage all the time as well as keeping the picturebox width and size same as the picture its showing. So far I had no success. I have the following code that I call in form constructor to position it in center. it works the first time to center the picturebox: private void SetPictureBoxOriginalSizeAndLocation(bool makeImageNull =

Keeping a PictureBox centered inside a container

心不动则不痛 提交于 2019-12-18 07:40:09
问题 I am desiging a simple picture viewer with ability to do some basic image processing. At the moment I have the problem of keeping the PictureBox centered inside a TabPage all the time as well as keeping the picturebox width and size same as the picture its showing. So far I had no success. I have the following code that I call in form constructor to position it in center. it works the first time to center the picturebox: private void SetPictureBoxOriginalSizeAndLocation(bool makeImageNull =

Invert image faster in C#

点点圈 提交于 2019-12-18 07:04:14
问题 I'm using WinForms. I have a picture-box in my form. When I open a picture in the picture-box I am able to invert the colors back and forth on a click of a button, but my code is extremely slow. How can I increase the performance. private void Button1_Click(object sender, System.EventArgs e) { Bitmap pic = new Bitmap(PictureBox1.Image); for (int y = 0; (y <= (pic.Height - 1)); y++) { for (int x = 0; (x <= (pic.Width - 1)); x++) { Color inv = pic.GetPixel(x, y); inv = Color.FromArgb(255, (255

Load Picturebox Image From Memory?

守給你的承諾、 提交于 2019-12-18 05:43:38
问题 I can't seem to figure out how to load a pictureBox image from a bitmap in memory. Is it possible or do I have to create temp file for the bitmap? 回答1: What format is the image in memory? If you have an actual Bitmap object, just assign it to the PictureBox, as suggested by dtb: pictureBox.Image = bitmap; If you have the image as a series of bytes held in a stream, you'll need to load the image from the stream: var image = Image.FromStream(stream); pictureBox.Image = image; If you instead