How would I go about adding multiple rectangles using the same lines of code?

How would I go about adding multiple rectangles using the same lines of code? I would prefer to just run through a set of code every time I need a polygon. If I just have to create multiple polygon adding statements that's fine but I'd prefer just 1.

>>How would I go about adding multiple rectangles using the same lines of code?
You could create a method that creates and returns x number of Rectangle elements:
public IEnumerable<Rectangle> CreateRectangles(int numberOfRectsToCreate)
for (int i = 0; i < numberOfRectsToCreate; ++i)
Rectangle rect = new Rectangle();
rect.Fill = Brushes.Blue;
rect.Width = 100;
rect.Height = 100;
yield return rect;
..and then call this method from anywhere in your code:
IEnumerable<Rectangle> rects = CreateRectangles(5);
foreach (Rectangle rect in rects)
//add to StackPanel or do whatever with the Rectangle elements:
yourStackPanel.Children.Add(rect);
>>If I just have to create multiple polygon adding statements that's fine but I'd prefer just 1.
When adding Point objects to a Polygon you can only add one per call to the Add method but you could call the Add method inside a loop, e.g:
for(int i = 0; i < 10; ++i)
//add to StackPanel or do whatever with the Rectangle elements:
Polygon p = new Polygon();
p.Points.Add(new Point());
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't post several questions in the same thread.

Similar Messages

  • Adding Multiple Questions On The Same Line

    Hi,
    I am creating my first form from scratch and would like to know how to add multiple quoestions on the same line.  for example
    Home Phone                 Work Phone           Cell Phone                  Email Address
    I know it sounds pretty basic but I seem to be stuck
    Thanks

    Hi,
    Please refer to the following post:
    http://forums.adobe.com/message/5665660
    Regards,
    Brian

  • HT2470 how would i go about taking multiple files from documents and make them part of 1 master file

    how would i go about taking multiple files from documents and make them into 1 master file? I want to put all documents associated with this project together for easier access.

    From the finder window, click File, click new folder, you can drag all documents into that Folder making it the master folder. You can ajso drag folders into the Master folder, and have them as sub-folders if you wish to  do that. Either way they will all be in one master folder.

  • How do you take off reseiving messages on multiple devices using the same apple account

    How do you take off reseiving messages on multiple devices using the same apple account?

    Go to Settings>Messages>Send and Receive on all but one device and add a unique email address on each device and delete the commone Apple ID email device
    If there is also an iPhone with iOS 6 associated with the Apple ID, uncheck the phone number on all but the phone.

  • How can I get rid of multiple pictures at the same time?

    how can I get rid of multiple pictures at the same time?

    Adobe Bridge, lightroom and your file browser (windows explorer or Mac Finder) can select multiple pictures at once and then delete. If you are looking for more than that for information, you will need to be more specific at what your doing, what OS you have, and version of software your using. If necessary post screen shots so we can see what your doing. The more information we have the more detailed of an explaination can can give back to you.

  • How do i share music with 2 iphones using the same apple id?

    how do i share music with 2 iphones using the same apple id?

    Sync them both to the same iTunes music library.  You can also automatically download purchased music to both by going to Settings>iTunes & App Stores and turning Music to On under Automatic Downloads.  If you music is in multiple computers, you can enable Home sharing to share your music library across multiple devices (see http://support.apple.com/kb/HT3819).

  • Load multiple files using the same data load location

    has anybody tried loading multiple files using the same load locations. I need to do this as the data in these multiple files will need to be exported from FDM as a single export file. the problem i am facing is more user related. since these files will be received at different points of time, users will need a way to tell them what has been loaded and what is yet to be loaded.
    is it possible to throw a window on the web broser with OK and Cancel buttons from an event script?
    any pointers to possible solutions will be helpful

    was able to resolve this. the implementation method is as follows
    take a back up of previously imported data in the befcleardata event script. then in the beffileimport event append the data to the import file. there are many other intricacies but this is the broad implementation logic. it allowed my users to load multiple files without worrying about append or replace import type choices

  • HT204053 Can multiple people use the same Apple ID for their own devices?

    Can multiple people use the same Apple ID for their own devices? I just set up my IPhone 4S (first time user) using the same Apple ID as my daughters and now we receive each others texts, do I need to set up my own Apple ID account?

    Yes, you can.  In fact it's recommended that you use different IDs for iMessage, FaceTime and iCloud.  You can still share the same ID for iTunes without any issues.
    You are getting each other's text messages because you're using the same ID for iMessage.  To fix this, one of you should go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign in with a different ID.  To avoid getting each other's FaceTime calls, do the same thing in Settings>FaceTime.

  • I have changed my Apple ID on my iPad, but my iPhone keeps popping up with the old ID.....how do I get all my devices to use the same ID?

    How can I get all my devices to use the same Apple ID?

    Different services on your iOS device (iMessage, Facetime, iCloud, iTunes and App Store) can be signed into with an Apple ID of your choice. Make sure you verify the settings for each device and that you are signed in to each service with the correct Apple ID.
    I'll do an example for iMessage:
    1) Go to settings on your iOS device
    2) Select "Messages"
    3) Select "Send & Receive"
    4) At the very top you will see "Apple ID", by selecting your Apple ID, you will now have the option to sign out of messages with the current Apple ID, and sign in with the new one.
    The steps for changing your Apple ID for other services will be very similar.
    tHIS SHOULD BE VERY HELPFUL TOO YOU.

  • What is the best way to manage multiple ipods using the same itunes?

    Hi Everyone
    i am trying to manage three different ipods through the one Itunes, all with very different tastes, not sure if I am doing it the best or easiest way so does anybody have a simple solution on what you're supposed to do, to keep it all simple!
    Cheers
    Liv

    If you have created a new Windows user account you need to log out and then log back in with your original user name. By default each Windows profile will have an independent iTunes library.
    If instead you managed to create a new library within the same profile. click the icon to start iTunes and immediately press and hold down the shift key, keep holding until asked to create or choose a library. Click Choose and navigte back to your original which should be at <User's Music>\iTunes.
    Your question as posed was:
    What is the best way to manage multiple iPods using the same iTunes {library}?
    in which case Selected Playlists is probably the best approach. Simply create a playlist for each device, Alice's iPod, Bob's iPhone etc. and sync the device with the appropriate list.
    tt2

  • How can I see up AppStore/Software Updates for multiple computers using the same account?

    I have several computers in my household which all use the same App Store account for purchases & software updates. How can I view all those installs while not being in front of all computers?
    Recently an iMac crashed from a software update. I want to see what installed & crashed it.

    Launch the Mac app store on the computer you want to update.
    To use your Apple ID at the Mac App Store
    Choose Store > Sign In from the App Store menu.
    Enter your Apple ID and password, then click Sign In.
    Then redownload Lion.

  • Multiple users using the same templates?

    The place I work puts out a weekly TV show and we regularly use the same lower thirds for various titles that come up throughout the show. After opening them up in Motion 3 I saved the titles as templates, which is great because now I can do all the work in FCP rather than Motion.
    However, the templates are saved to my user on the local HD. We have multiple editors that work on multiple computers.
    Is there a way to make the templates available on all computers to all users?
    Any suggestions is appreciated.
    jesse.

    Too, here's one more roadblock to (hypothetically) consider.
    Even if what we've discussed happened to work, there would be one more issue: network bandwidth. When you add one of these "Master Templates" to a FCP timeline, then drag it to the browser, then right-click and select "Reveal in Finder", it points straight to the Templates folder that I alluded to earlier. Locally.
    So if this template lived in one central place then, potentially, all editors could be trying to access it, in real-time, remotely, simultaneously. I think this would wreak havoc quickly. Unless of course you're employing a SAN. Now we're talking about a whole new beast. (Unless you've got a SAN already. ;))
    Bottom line is you're going to distribute templates to all editors individually. Unless you're developing new templates all the time, then this shouldn't be too much of a chore. Just out of curiosity, how many editors will this be deployed to?

  • Can multiple accounts use the same purchased apps from the same computer?

    Hope one of you guys can help me out!
    Ive got an iTunes account with over 1300 app store apps, most of which are paid, my kids have just got an iPhone4 and an iPod Touch4 for xmas presents and Im currently setting them up for them to use straight away on xmas day.
    The issue is;
    For them to be able to use all my apps on their devices Ive had to use my account, this causes issues with things like GameCentre and FaceTime, because we are all on the same e-mail address and account!!!
    Is there any way for me to set up there own accounts in such a way as they can still have access to my apps?????
    Please help if you can, it would be greatly appreciated,
    Thanks, James

    Akhilleus70 wrote:
    How do I authorise them all to use the same apps etc?
    that's basically very easy. all you have to do is +log out+ of one account (click on the account name in the Store window and select +sign out+ from the pop-up dialog) and into the other, and then they will both be authorized.
    JGG

  • How do I separate 3 different devices all using the same apple ID

    HELP PLEASE!! My wife has a macbook which is about 5 years old. We used our only email address at that time as our apple ID. Since then we have bought her an iphone 4 and registered it with the same apple ID. Then a few months later I made the jump from my blackberry to an iphone 4 and used the same apple id. All these devices are now tethered to the same apple id as well as our family itunes account. So, we have a family itunes account, an older macbook and 2 iphone 4's all with the same apple id. With me so far? Now, everything was cool until the iOS update came out for our 2 iphones and came with the new icloud app. When my wife and I set up our icloud accounts everything that was on her phone showed up on mine and everything that was on mine showed up on hers. How do I change the apple id's on her phone and computer, keep the apple id we already have on my phone and continue to share the itunes account? An important note here is that the apple id's are my email address. HELP!!!!

    OK this might help you
    you need both iphones and the mac next open itunes and click on itunes prefrences now you will need to go to devices and erase all iphone back ups
    next plug the phone with your info to the mac and rename that iphone with your name and back it up, After the back up safely remove it
    next plug the phone with your wifes info into the mac and follow the same steps.
    after the back up is done restore your wifes iphone and when ask to restore as a new iphone you need to scroll down to her name and click on it then do the same with your phone
    this will put all info into the corresponding phones

  • Multiple topics using the same map ID

    Hi!
    Can anyone tell me how I go about assigning a map ID number when numerous topics use the same screen?  When I try to do it in the Map ID dialog box, it tells me the number is already assigned.
    BTW, does anyone know of any documentation that helps in creating map IDs?.  Most of the information I've found here on the forum addresses how to work with the developer to make sure they work, not for the tech writer to learn how to actually do the map ID'ing so you know you are doing it correctly.  Both books I have on RoboHelp do not discuss this in any length.
    Thanks.

    Thanks for the response, Peter.  Yes, it is a situation where one screen in the application is used in several topics.  For example, to complete three different endorsements on an insurance policy, they all use the same screen.  Of course, there are different instructions on how to use that screen for each type of endorsement.
    Does that make sense?
    But I think you're probably right in that I will have to put links in those topics to the one with the map ID even though that task is not the task they are completing.
    Maggie Prince
    Senior Technical Writer
    The Cincinnati Insurance Companies
    513-870-2000 ext 6112
    "It's never too late to be who you might have been."
    George Eliot
    Confidentiality notice: The information included in this e-mail, including any attachments, is for the sole use of the intended recipient and may contain information that is confidential and protected. Any unauthorized review, use, disclosure, distribution or similar action is prohibited. If you are not the intended recipient, please contact the sender and delete all copies of the original message immediately.
    Message was edited by Peter Grainge to remove the email address. Never put your email address on any forum unless you fear missing emails advising you that there is a large amount of money in a Nigerian bank account which is yours to share in return for your bank account details.

Maybe you are looking for

  • HT3819 Can I share my music with my wife who has a seperate Apple ID?

    I just bought my wife an iPad Mini and she decided she wanted her own Apple ID so she can start managing her own music and such.  Previously, she has been using my account to load her iPod with music.  The problem is that I can't figure out how to ge

  • User status in sales orders

    Hi all! Can anyone tell me if there is a way to control the possibility of changing a sales order through the status? I wanted that when a sales order reaches a certain user status, for it to be blocked to modifications, as if it was display only...

  • SC Vendor flag on PO level populated from contract

    Dear all, maybe you can help me with this topic. I have an external vendor (B)  who should provide components to a Subcontractor (A). So the first PO is for my subcontracotr with the item category L, secondly as I do not have the component on stock t

  • Excel file upload in ODI 11g

    Hi, I am trying to define new data server in topology manager in order to upload excel file, and when i test the connection i got this error:The specified DSN contains an architecture mismatch between the Driver and Application. I did all the steps r

  • Currency Translation with dynamic scaling

    Hi Experts, If you have experienced such a requirement, pls share what you leant. As you know, the scaling option is fixed for each key figure. Under such situation, if you changed currency using currency translation, you will feel this scaling is no