473,386 Members | 1,715 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,386 software developers and data experts.

Drawing/Plotting in VB.NET

Hi
Can someone help me plotting results on a picturebox using VB.NET ?
Based on VB’s help I made up the following code – which works fine as long as the Do-While-loop is disconnected by the ‘Exit Sub’ in line 6 of sub Button1_Click – but if the loop is active as needed for plotting there happens no drawing at all.
What’s wrong ???
Expand|Select|Wrap|Line Numbers
  1. Public Class AnalResult
  2.     Dim RcDraw As Rectangle
  3.     Dim PenWidth As Integer = 4
  4.     Dim Warten As Boolean
  5.     Dim Pen1 As New Pen(Color.Blue, PenWidth)
  6.     'Dim e1 As New System.Windows.Forms.PaintEventArgs
  7.     Public PosTrade%, NegTrade%, PosTradeT#, NegTradeT#, PosTop#, NegBottom#, BiggestLoss#, LongestDown%, Massst#, NullN#
  8.  
  9.  
  10.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  11.         Static i% = 0
  12.         Do While i < 2000
  13.             i = i + 4
  14.             Z(i)
  15.             'Exit Sub ‘ <<<<<<<<< if no exit – no drawing at all
  16.         Loop
  17.     End Sub
  18.  
  19.     Public Sub Z(ByVal Yw%)
  20.         If RcDraw.X = 0 Then RcDraw.X = 20
  21.         Dim i%
  22.         i = PictureBox1.Height - (G_ResT * Massst + NullN)
  23.         If Yw = 0 Then Yw = i
  24.         RcDraw.X = RcDraw.X + 4
  25.         If PictureBox1.Width < RcDraw.X + 8 Then
  26.             Exit Sub
  27.             PictureBox1.Width = RcDraw.X + 8
  28.             Me.Width = PictureBox1.Width + (1137 - 744)
  29.         End If
  30.         RcDraw.Width = 4 ' RcDraw.X - e.X
  31.         RcDraw.Height = 4 ' RcDraw.Y - e.Y
  32.         RcDraw.Y = Yw ' 81 ' e.Y
  33.         PictureBox1.Invalidate(RcDraw)
  34.     End Sub
  35.  
  36.     Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
  37.         e.Graphics.DrawRectangle(Pens.Blue, RcDraw)
  38.         'e.Graphics.DrawRectangle(New Pen(Color.Blue, PenWidth), RcDraw)
  39.     End Sub
  40. End Class
  41.  
Many thanks for help !!
Alain
Oct 1 '07 #1
1 1578
debasisdas
8,127 Expert 4TB
Question moved to .NET Forum.
Nov 3 '07 #2

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

Similar topics

3
by: Erik Lechak | last post by:
Hello All, I am creating a visual programming environment for python (similar to Matlab's simulink, but for python). For several reasons I have decided not to go with OGL. I am writing a wxOGL...
1
by: Leif K-Brooks | last post by:
I'm considering writing a fairly basic vector drawing program using PyGTK. What's the best way to render it? What I'm thinking of is having everything render on a PIL image, then display that in...
7
by: Rolf Wester | last post by:
Hi, I have a Python console application that is intended to be used interactively and I have to add plotting capabilities (multiple XY plots and if possible 2D-surface plots). I'm loocking for a...
2
by: Coralin Feierbach | last post by:
I created a Windows Form Project using VS.net. I'm trying to draw a line between two points. (Plotting a graph, dynamically) This is the code I have so far: What do I have to do to actually see...
2
by: asdf | last post by:
I was told that it is difficult to draw plots and graphs in C++, right? In matlab, if I have data, it's very easy to generate the plots, and I want to know how C++ handles such output.
1
by: T. Crane | last post by:
Hi, I am looking for a good plotting library. I intend to do 3D surface plots, 2D contour, 3D waterfall, etc. Right now I have access to National Instruments' Measurement Studio, and it's...
7
by: serave | last post by:
Hi i'm new in this group. I need some help with php. I need to draw any mathematical function i get through a form? Please help me
0
by: Helmut Michels | last post by:
Dear C/C++ programmers, I am pleased to announce version 9.4 of the data plotting software DISLIN. DISLIN is a high-level and easy to use plotting library for displaying data as curves, bar...
0
by: Stubbie | last post by:
I'm updating a legacy application that uses GDI to plot a large number of points (500k+) in a fraction of a second. I've tried recreating the plotting control in GDI+/C# and the same draw operation...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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
Oralloy
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,...
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...

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.