Hi,
Why does the code below only draw the last line of the loop? I was expecting
this to draw 10 parallel lines. More to the piont....how do I get it to draw
10 parallel lines?
Public Function GetImage() As Bitmap
Dim oBitmap As Bitmap = New Bitmap(200, 200)
Dim oGraphic As Graphics = Graphics.FromImage(oBitmap)
Dim oPen As New Pen(Color.Black, 4)
Dim i As Integer
For i = 0 To 10
oGraphic.DrawLine(oPen, i, 0, i, 150)
Next
Return oBitmap
End Function
Thanks in advance,
Stu 2 2650
It doesn't draws only last line of the loop, since in your loop there is no
distance between lines it seems like a thick line.
use something like this loop to draw 10 parallel lines:
For i = 1 To 10
oGraphic.DrawLine(oPen, i * 15, 0, i * 15, 150)
Next
HTH
--
Saber S.
"Stu" <s.****@cergis.com> wrote in message
news:eQ****************@TK2MSFTNGP14.phx.gbl... Hi,
Why does the code below only draw the last line of the loop? I was expecting this to draw 10 parallel lines. More to the piont....how do I get it to draw 10 parallel lines?
Public Function GetImage() As Bitmap Dim oBitmap As Bitmap = New Bitmap(200, 200) Dim oGraphic As Graphics = Graphics.FromImage(oBitmap) Dim oPen As New Pen(Color.Black, 4) Dim i As Integer For i = 0 To 10 oGraphic.DrawLine(oPen, i, 0, i, 150) Next Return oBitmap End Function
Thanks in advance,
Stu
Thanks - I am duly embarrasssed and shall not try new stuff drunk again!
"Saber" <saber[.AT.]oxin.ir> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl... It doesn't draws only last line of the loop, since in your loop there is no distance between lines it seems like a thick line. use something like this loop to draw 10 parallel lines: For i = 1 To 10 oGraphic.DrawLine(oPen, i * 15, 0, i * 15, 150) Next
HTH -- Saber S.
"Stu" <s.****@cergis.com> wrote in message news:eQ****************@TK2MSFTNGP14.phx.gbl... Hi,
Why does the code below only draw the last line of the loop? I was expecting this to draw 10 parallel lines. More to the piont....how do I get it to draw 10 parallel lines?
Public Function GetImage() As Bitmap Dim oBitmap As Bitmap = New Bitmap(200, 200) Dim oGraphic As Graphics = Graphics.FromImage(oBitmap) Dim oPen As New Pen(Color.Black, 4) Dim i As Integer For i = 0 To 10 oGraphic.DrawLine(oPen, i, 0, i, 150) Next Return oBitmap End Function
Thanks in advance,
Stu
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jon Cosby |
last post by:
I'm using this to draw rectangles in a PictureBox image. Not all of the
rectangles are complete, and after drawing several, some of them start
disapearing. What's the reason for this?
Pen...
|
by: Dan Nash |
last post by:
Hi guys
I was playing around last nite (as u do, hot coffee in hand) with a simple cube drawing based on an array made up of x,y coords (I know I can use Point but I haven't got that far yet).
...
|
by: Rich |
last post by:
Hello,
I am trying to draw a graph on a form. I can draw the box
using drawline, and bars inside the box using
drawrectangle, but when I try to draw a line inside the
box the inner lines are...
|
by: Smoke |
last post by:
It is possible to draw a line on a control using AA? basically, i need the normal .DrawLine funcion but that support antia aliasing.
is this possible? can somebody tellme how?
Thanks for the...
|
by: google_groups3 |
last post by:
Hi, is it better practise to draw a line on my form using the
Graphics.DrawLine command or should I use a label control instead?
I am refering to overall speed of the form and amount of memory...
|
by: John |
last post by:
I created a number of pictureboxes in a panel, and want to draw lines in
those pictureboxes but I cannot. Please see the following code and make
corrections.
Thanks.
Private Sub...
|
by: Lila Godel |
last post by:
I am migrating my VB6 GoldMine add-ons to VB.NET to allow for
enhancements. I have no problem getting text to print, but I cannot get the
4 PrintPage events that are needed to print a line to work....
|
by: Ben Bush |
last post by:
I had the following code and when I clicked the left mouse button one
time. I got green line and the second click got a purple line and the
green disappeared.
I was confused by two questions:...
|
by: intrepid_dw |
last post by:
All
I am writing a C# WinForms application which is giving me some
problems.
The application consists of a form containing an empty Tab control to
which TabPages are added dynamically (at...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
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,...
| |