473,586 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I draw any thing within "for" loop?

How can I draw any thing within "for" loop? I tried the
below but it doesn't draw anything. What should I do?

****
Code
****

Graphics g = this.CreateGrap hics();
Bitmap bm=new Bitmap(1,1);
bm.SetPixel(0,0 ,Color.Black);
for (i=1;i==2;i++)
{
g.DrawImageUnsc aled(bm,500,500 );
}
Nov 15 '05 #1
3 1474
What is it that you're trying to achieve here? Maybe your form is smaller
than 500x500?

vJ

"John" <an*******@disc ussions.microso ft.com> wrote in message
news:88******** *************** *****@phx.gbl.. .
How can I draw any thing within "for" loop? I tried the
below but it doesn't draw anything. What should I do?

****
Code
****

Graphics g = this.CreateGrap hics();
Bitmap bm=new Bitmap(1,1);
bm.SetPixel(0,0 ,Color.Black);
for (i=1;i==2;i++)
{
g.DrawImageUnsc aled(bm,500,500 );
}

Nov 15 '05 #2
John <an*******@disc ussions.microso ft.com> wrote:
How can I draw any thing within "for" loop? I tried the
below but it doesn't draw anything. What should I do?

****
Code
****

Graphics g = this.CreateGrap hics();
Bitmap bm=new Bitmap(1,1);
bm.SetPixel(0,0 ,Color.Black);
for (i=1;i==2;i++)
{
g.DrawImageUnsc aled(bm,500,500 );
}


This has nothing to do with drawing - your for loop is misconstructed.
It sets i to 1, then only continues while i is 2. As it clearly isn't 2
to start with, the body never gets executed.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
John <an*******@disc ussions.microso ft.com> wrote in message
news:88******** *************** *****@phx.gbl.. .
How can I draw any thing within "for" loop? I tried the
below but it doesn't draw anything. What should I do?

****
Code
****

Graphics g = this.CreateGrap hics();
Bitmap bm=new Bitmap(1,1);
bm.SetPixel(0,0 ,Color.Black);
for (i=1;i==2;i++)
{
g.DrawImageUnsc aled(bm,500,500 );
}


g.DrawImageUnsc aled(bm,500,500 ) never gets executed. I assume you were
trying to draw a pixel...

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
3554
by: Invalid User | last post by:
While trying to print a none empty list, I accidentaly put an "else" statement with a "for" instead of "if". Here is what I had: if ( len(mylist)> 0) : for x,y in mylist: print x,y else: print "Empty list" which was supposed to be:
8
1768
by: lancevictor | last post by:
I'm learning javascript, and toward that end, I am recreating a page "my way". The original page: http://stenbergcollege.com and the one that I'm creating: http://www3.telus.net/neustaeter/Stenberg When I added the buttons manually, everything was hunky-dory and it looked pretty much exactly like the original page. When I changed the...
3
2235
by: Neil Zanella | last post by:
Hello, I have a bunch of HTML input controls which I need to generate from within a for loop. I would like them to have id attributes set to values foo1, foo2, foo3, foo4, etc... Unfortunately it seems this is not possible because ASP.NET won't let me use ASP tags within the values of the id attribute. So for instance I cannot just do...
34
2667
by: Frederick Gotham | last post by:
Is the domestic usage of the C "for" loop inefficient when it comes to simple incrementation? Here's a very simple program that prints out the bit-numbers in a byte. #include <stdio.h> #include <limits.h> #include <stdlib.h> int main(void) {
1
1611
by: cvalarmathi | last post by:
Hi ! How to write foreach loop within for loop in php.Plz anybody know the answer reply me.Is it possible? Thanks.
2
972
by: takayuki | last post by:
Hi everyone, I'm studying python via the excellent "how to think like a python programmer" book by Allen Downey. Noob question follows... I have a txt file (animals.txt) which contains the following text each on a separate line: aardvark, bat, cat, dog, elephant, fish, giraffe, horse, inchworm, jackelope I want to create a function...
17
1471
by: takayuki | last post by:
Hi, I'm studying python via the exellent book "How to think like a python programmer" by Allen Downey. Noob question follows... animals.txt is a list of animals, each on a separate line: "aardvard, bat, cat, dog, elephant, fish, giraffe, horse, insect, jackelope"
15
2350
by: Steve | last post by:
I am having problems getting values out of an array. The array is set as a global array and values are pushed into it as they are read from a JSON file using a "for loop". When the "for loop" is finished I want to convert the array into a string which can be used by another function. My attempt to do this is not working. The script looks like...
4
2305
by: vanithapraveen | last post by:
I gave update command inside for loop.. and the query values are perfectly correct..but when i give con.execute(updateqry) i end up with an error.... Please help me...
0
7911
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8215
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...
0
6610
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...
0
3836
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...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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
0
1179
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...

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.