473,748 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Picturebox implementation] 1 foreground, many backgrounds - to show all backgrounds

EARNEST
128 New Member
Hello,
I would have a window form with a groupbox that should have certain amount of images.
I would have those images stored in a list, then my ZERO-th element would be my foreground. Elements at 1..N would be my backgrounds. Depending on the amount of elements in my list:
a) should I insert N-1 pictureboxes and populate them with 1 foreground and appropriate background image
b) should I somehow copy 1 picture box with the same foreground N-1 number of times and then change the background (if this is the case, any hints pls)
c) your idea
---
Thanks, EARNEST.

Draft implementation (just messing around with code)
Expand|Select|Wrap|Line Numbers
  1.             if (GraphBox.listOf_Images.Count >= 2)
  2.             {
  3.                 for (int i = 1; i < GraphBox.listOf_Images.Count; i++)
  4.                 {
  5.                     Console.WriteLine("iteration : " + i);
  6.                     pboxFor_Images = new PictureBox();
  7.                     pboxFor_Images.Size = new Size(img_FOREGROUND.Width, img_FOREGROUND.Height);
  8.                     pboxFor_Images.Image = img_FOREGROUND;
  9.                     pboxFor_Images.Location = new Point(5 + ((img_FOREGROUND.Width+5)*(i-1)), 15);
  10.                     Image img_BACKGROUND = new Bitmap(GraphBox.listOf_Images.ElementAt(0).Width, GraphBox.listOf_Images.ElementAt(0).Height);
  11.  
  12.                     img_BACKGROUND = GraphBox.listOf_Images.ElementAt(i);
  13.  
  14.                     this.groupBox1.Controls.Add(pboxFor_Images);
  15.  
  16.  
  17.                     pboxFor_Images.Image = img_FOREGROUND;
  18.                     pboxFor_Images.BackgroundImage = img_BACKGROUND;
  19.                 }
  20.             }
  21.  
any other more efficient implementations ?
Mar 5 '10 #1
0 935

Sign in to post your reply or Sign up for a free account.

Similar topics

8
31525
by: Pavan Arise | last post by:
Dear all.. I have a picturebox filled on a form. The picturebox has some graphics displayed on it.I was trying to save the picturebox, but continuesly failed to do so. I am clueless of why it is happening. I tried to save the image of the form & also the picturebox, but always, i see a blank file saved. Is there a way to save whatever is displayed on the picturebox, to a file?? Thanks for any suggestions and help. Regards,
0
3883
by: akh | last post by:
I want to use de Drag and Drop ´s event to move a picture box from a form and within a Picture Box. But I have behaviour if the MyPBox As PictureBox as the Globale varible or not Thanks for your help, Here is the code.
3
3938
by: Tyson Ackland | last post by:
Can someone tell me how you go about handling events where your window might be obscured and then when you bring it to the foreground, you want your picturebox control to be repainted instead of showing large, blocked out areas created by overlapping windows. I have seen numerous references to onpaint etc but I haven't found an example to follow or at least my own efforts with onpaint haven't been fruitful as yet.
5
4902
by: BrianW | last post by:
I am working on a program that has multiple picturebox controls that a user is allowed to move around which are contained within a panel control for visual placement. In my mousedown event, I set the picturebox control's borderstyle to Fixed3D, but upon doing so, I am not able to track the picturebox control through mousemove events (if you move the mouse off of the control too quickly, the control no longer receives mouse events). If I...
3
3451
by: Carl Fenley | last post by:
I am trying to capture the Windows QueryCancelAutoPlay message that is sent to the "foreground window" when an AutoRun enabled CD is inserted into a drive. Enabling and Disabling AutoRun http://tinyurl.com/2m26 If my MainForm uses MessageBox.Show to prompt the end-user to insert a CD, I'd like to know whether MainForm or my MessageBox is the "foreground window". Any ideas?
8
5369
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In this code there is a panel panel1, that I populate with a lable in the foreground. Then when I click on "button1" a backgroundworker thread in async mode is started. When the backgoundworker thread completes the thread returns a panel to populate...
17
12625
by: M O J O | last post by:
Hi, How can I force a form to the foreground no matter what application is in front? Thanks! M O J O
4
3714
by: Jim McGivney | last post by:
In C# on Form1 I genetate an array of PictureBoxes and populate each with an image as seen in the code below. Later on I want to access a specific PictureBox to change its image, but I keep getting the error "The name 'PictureBox1' does not exist in the current context" The code I use to try to access the PictureBox is "PictureBox1.Image = HoldBitMap; " where kount is an integer. I know the answer is probably in using the Controls...
6
3094
by: Johan | last post by:
I can set/change a background with: document.getElementById("photodiv").style.background = "#282828 url(../img/pict_1.jpg)"; How do I set/change multiple backgrounds using javascript?
5
5380
by: AWW | last post by:
XP VB 2005 running an example from help that creates a picturebox in code - the picturebox is not created. If I comment out the "Dim Box as New PictureBox" and create it in Design mode - the example works. I have tried Show, Enabled, Visible, and even BackColor. Why does a help example not work? and why does Design creation work? Thanks - I hope.
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.