HELP! for loops in the paint method


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: HELP! for loops in the paint method

  1. #1
    Join Date
    Nov 2004
    Posts
    32

    HELP! for loops in the paint method

    Im trying to use the paint method to produce the following output:

    ______
    ______
    ______
    ______
    ______
    ______
    ______
    ______
    ______
    ______
    etc

    i have selected the correct pixels (co-ordinates) from where i want the first line and where i want the last line and i am trying to use a for loop so it does all the lines in one statement. (each line is 10 pixels apart)

    However, i cant seem to produce more than one line (the first line) and wondered if someone could show me exactly how to produce this. This is my code, if someone could edit that and show me i would be extremely grateful.


    Int startx, stopx, y;
    for(startx = 139; stopx <= 530; y=+10)
    {
    g.drawline(startx,y,stopx,y);
    }

  2. #2
    Join Date
    Sep 2004
    Posts
    223
    try this:


    Int startx, stopx, y, n = 0;
    for(startx = 139; stopx <= 530; y=+10)
    {
    g.drawline(startx,y + n,stopx,y + n);
    n += 25; // change this to the required distance between lines
    }

    can you show me what that does?
    A kram a day keeps the doctor......guessing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center