picturebox

Toggling Picture Box visibility C#

这一生的挚爱 提交于 2019-12-02 12:57:15
Why is the picture box control's visibility property not working here. I have initially set them to false, so that when the screen loads they are not visible. But then I wish to toggle this. I have done the following but does not seem to work. This is a windows forms application. private void Action() { while (true) { Random r1 = new Random(); int num = r1.Next(1,3); switch (num) { case 1: pictureBoxLeft.Visible = true; pictureBoxRight.Visible = true; break; case 2: pictureBoxLeft.Visible = true; pictureBoxRight.Visible = false; break; case 3: pictureBoxLeft.Visible = false; pictureBoxRight

How to kept a graphic drawing in a picturebox on a tab control after switching to tab 2 and return to tab 1?

感情迁移 提交于 2019-12-02 12:54:41
问题 I have a Tab Control with two (2) Tabs. The Tab 1 does a drawing in a picture box (the picture box is optional, I can draw directly to the tab) using Graphics Addline. The second tab opens a web browser. Everything is working fine. I can make the drawing in the first tab but when I switch to the second tab and return to the first tab, the drawing disappear and if I return to tab 2 I can see what I was watching in the web browser. I need to kept the drawing in the tab 1 so when I return to it

Out of memory with multi images in one picturebox

不打扰是莪最后的温柔 提交于 2019-12-02 12:31:23
问题 I have a problem with out of memory when I'm trying load a few images into one picturebox. public void button2_Click(object sender, EventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.ShowDialog(); string selected = dialog.SelectedPath; string[] imageFileList = Directory.GetFiles(selected); int iCtr = 0,zCtr = 0; foreach(string imageFile in imageFileList) { if (Image.FromFile(imageFile) != null) { Image.FromFile(imageFile).Dispose(); } PictureBox eachPictureBox = new

VB.NET Picturebox on top of MDI Child

蓝咒 提交于 2019-12-02 12:28:20
Any idea why a picturebox in a MDI parent would show on top of a MDI child? (even when MDI child = topmost) When calling picturebox.SendToBack the picturebox disappears in the MDI parent. What I did was, created a borderless form with the picturebox on it, and threw it on the MDI parent as a MDI child, seems to do the job! 来源: https://stackoverflow.com/questions/7814968/vb-net-picturebox-on-top-of-mdi-child

Can I use variables to control which PictureBox I am using?

大兔子大兔子 提交于 2019-12-02 09:04:33
Is there a way that I can use a variable to control which PictureBox I am using in Visual Basic? I.e.: CurrentNumber = 1 PictureBox(CurrentNumber).backcolour = backcolour You can use the Me.Controls(String) indexer. It lets you specify the name (as a string) of the control you want to access, thus you can dynamically access a picture box by concatenating the string "PictureBox" with a number. Dim TargetPictureBox As PictureBox = TryCast(Me.Controls("PictureBox" & CurrentNumber), PictureBox) 'Verifying that the control exists and that it was indeed a PictureBox. If TargetPictureBox IsNot

Animated GIF in Windows Form while executing long process

老子叫甜甜 提交于 2019-12-02 08:03:51
I have developed a simple windows Application(MDI) in C# which exports the data from SQL to Excel. I am using ClosedXML to achieve this successfully. When the process is executed, I want to show a picturebox containing a animated GIF image. I am a beginner and don't know how to achieve this, the picturebox appears after the process is completed. I saw lot of posts which says to use backgroundworker or threading which I have never used and finding it hard to implement. Can I have an step by step example with explanation. The two functions which I have created which I call before and after I

retrieving image from database

隐身守侯 提交于 2019-12-02 07:58:42
I'm working on my project which displays a list of employee. here, the information and picture of the employee will be shown. my project can now show the list of employees in the listbox and when I double click on an employee, his/her profile will be shown on a textbox. my problem is that i can't make their pictures to show in the picturebox . I already stored their picture on a table in my database along with their id, name, and profile. It only shows the picture of the first employee on the table . can anybody help me? here's what I already done: I populated the listbox: Call Connect() With

Out of memory with multi images in one picturebox

北城余情 提交于 2019-12-02 04:33:17
I have a problem with out of memory when I'm trying load a few images into one picturebox. public void button2_Click(object sender, EventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.ShowDialog(); string selected = dialog.SelectedPath; string[] imageFileList = Directory.GetFiles(selected); int iCtr = 0,zCtr = 0; foreach(string imageFile in imageFileList) { if (Image.FromFile(imageFile) != null) { Image.FromFile(imageFile).Dispose(); } PictureBox eachPictureBox = new PictureBox(); eachPictureBox.Size = new Size(100,100); // if (iCtr % 8 == 0) //{ // zCtr++; // iCtr =

Dispose of a pictureBox image without losing the pictureBox

╄→гoц情女王★ 提交于 2019-12-02 04:23:56
问题 I am writing a program that will play a slideshow (among other things). The slideshow is controlled by a backgroundWorker, and is set to a while(true) loop so it will constantly play images. My problem is I'm not sure how to dispose of the old images so they don't take up memory (after a while the program throws an "Out of memory exception). If I call horPicBox.Image.Dispose() then it won't let me use the pictureBox at all after that. Is there a way to release the old image from memory?? If I

How do I rotate a picturebox around a point?

时光怂恿深爱的人放手 提交于 2019-12-02 04:07:23
Solved I am trying to simulate a planet rotating a star. I am currently aware of the syntax to move the picture box (I have this in a timer so it is repeated) private void rotate_timer(object sender, EventArgs e) { picturebox1.location = new point (picturebox1.location.x + 1, picturebox1.location.y + 1); } But I don't know where to start so that it rotates around a specific point. How would I go about rotating it around (0,0)? TaW This may help: float angle = 0; float rotSpeed = 1; Point origin = new Point(222, 222); // your origin int distance = 100; // your distance private void timer1_Tick