473,405 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

EARNEST
128 100+
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 918

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

Similar topics

8
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...
0
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...
3
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...
5
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...
3
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...
8
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...
17
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
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...
6
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...

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.