Hello
Can anyone convert the vb6 code to vb.net? Thank you!
************************************************** ************
Const SPACE = 5
Const BAR_WIDTH = 50
Public GraphPoints(0 To 99) As Long
Sub DrawUsage(lUsage As Long, picPercent As PictureBox, picGraph As
PictureBox)
Dim Cnt As Long
picPercent.ScaleMode = vbPixels
For Cnt = 0 To 10
picPercent.Line (SPACE, SPACE + Cnt * 3)-(SPACE + BAR_WIDTH, SPACE +
Cnt * 3 + 1), IIf(lUsage >= 100 - Cnt * 10 And lUsage <> 0, &HC000&,
&H4000&), BF
Next Cnt
ShiftPoints
GraphPoints(UBound(GraphPoints)) = lUsage
picGraph.Cls
For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1
picGraph.Line (Cnt, 100 - GraphPoints(Cnt))-(Cnt + 1, 100 -
GraphPoints(Cnt + 1)), &H8000&
Next Cnt
End Sub
'Shift all the points from the graph one place to the left
Sub ShiftPoints()
Dim Cnt As Long
For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1
GraphPoints(Cnt) = GraphPoints(Cnt + 1)
Next Cnt
End Sub
************************************************** **************************
*********************** 6 1878
This might sound a little unhelpful but. If you cant even be bothered to
look up the correct syntax for the Const declarations at the beginning, I
dont feel like helping you.
Try doing a bit more for yourself and then come back with specifics !
Regards OHM
yxq wrote: Hello Can anyone convert the vb6 code to vb.net? Thank you!
************************************************** ************ Const SPACE = 5 Const BAR_WIDTH = 50 Public GraphPoints(0 To 99) As Long
Sub DrawUsage(lUsage As Long, picPercent As PictureBox, picGraph As PictureBox) Dim Cnt As Long picPercent.ScaleMode = vbPixels For Cnt = 0 To 10 picPercent.Line (SPACE, SPACE + Cnt * 3)-(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1), IIf(lUsage >= 100 - Cnt * 10 And lUsage <> 0, &HC000&, &H4000&), BF Next Cnt ShiftPoints GraphPoints(UBound(GraphPoints)) = lUsage picGraph.Cls For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 picGraph.Line (Cnt, 100 - GraphPoints(Cnt))-(Cnt + 1, 100 - GraphPoints(Cnt + 1)), &H8000& Next Cnt End Sub
'Shift all the points from the graph one place to the left Sub ShiftPoints() Dim Cnt As Long For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt End Sub
************************************************** ************************** ***********************
Hello
I have convertd some code, but it works not well.
************************************************** *****
Const SPACE As Short = 5
Const BAR_WIDTH As Short = 50
Private GraphPoints(99) As Integer
Sub Draw1(ByVal lUsage As Integer, ByVal picPercent As PictureBox, ByVal
picGraph As PictureBox)
Dim Cnt As Integer
For Cnt = 0 To 10
Dim p1 As New
Pen(System.Drawing.ColorTranslator.FromOle(&HC000& ), 2)
Dim p2 As New
Pen(System.Drawing.ColorTranslator.FromOle(&H4000& ), 2)
Dim x1 As New Point(SPACE, SPACE + Cnt * 3)
Dim x2 As New Point(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1)
Dim e As Graphics = picPercent.CreateGraphics
If lUsage >= 100 - Cnt * 10 And lUsage <> 0 Then
e.DrawLine(p1, x1, x2)
Else
e.DrawLine(p2, x1, x2)
End If
Next Cnt
'The code below can not work well..........
'Shift all the points from the graph one place to the left
For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1
GraphPoints(Cnt) = GraphPoints(Cnt + 1)
Next Cnt
Dim e2 As Graphics = picGraph.CreateGraphics
GraphPoints(UBound(GraphPoints)) = lUsage
e2.Clear(Color.Black)
Dim p As New Pen(Color.Green, 1)
For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1
Dim x3 As New Point(Cnt, 100 - GraphPoints(Cnt))
Dim x4 As New Point(Cnt + 1, 100 - GraphPoints(Cnt + 1))
e2.DrawLine(p, x3, x4)
Next Cnt
End Sub
************************************************** ***********
"One Handed Man" <Bo****@Duck.net> дÈëÓʼþ
news:bq**********@titan.btinternet.com... This might sound a little unhelpful but. If you cant even be bothered to look up the correct syntax for the Const declarations at the beginning, I dont feel like helping you.
Try doing a bit more for yourself and then come back with specifics !
Regards OHM
yxq wrote: Hello Can anyone convert the vb6 code to vb.net? Thank you!
************************************************** ************ Const SPACE = 5 Const BAR_WIDTH = 50 Public GraphPoints(0 To 99) As Long
Sub DrawUsage(lUsage As Long, picPercent As PictureBox, picGraph As PictureBox) Dim Cnt As Long picPercent.ScaleMode = vbPixels For Cnt = 0 To 10 picPercent.Line (SPACE, SPACE + Cnt * 3)-(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1), IIf(lUsage >= 100 - Cnt * 10 And lUsage <> 0, &HC000&, &H4000&), BF Next Cnt ShiftPoints GraphPoints(UBound(GraphPoints)) = lUsage picGraph.Cls For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 picGraph.Line (Cnt, 100 - GraphPoints(Cnt))-(Cnt + 1, 100 - GraphPoints(Cnt + 1)), &H8000& Next Cnt End Sub
'Shift all the points from the graph one place to the left Sub ShiftPoints() Dim Cnt As Long For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt End Sub
************************************************** ************************** ***********************
The source code link http://www.allapi.net/php/redirect/r...ownload&id=370
"yxq" <ga***@163.net> дÈëÓʼþ news:O1*************@tk2msftngp13.phx.gbl... Hello I have convertd some code, but it works not well. ************************************************** ***** Const SPACE As Short = 5 Const BAR_WIDTH As Short = 50 Private GraphPoints(99) As Integer
Sub Draw1(ByVal lUsage As Integer, ByVal picPercent As PictureBox,
ByVal picGraph As PictureBox) Dim Cnt As Integer For Cnt = 0 To 10 Dim p1 As New Pen(System.Drawing.ColorTranslator.FromOle(&HC000& ), 2) Dim p2 As New Pen(System.Drawing.ColorTranslator.FromOle(&H4000& ), 2) Dim x1 As New Point(SPACE, SPACE + Cnt * 3) Dim x2 As New Point(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1)
Dim e As Graphics = picPercent.CreateGraphics If lUsage >= 100 - Cnt * 10 And lUsage <> 0 Then e.DrawLine(p1, x1, x2) Else e.DrawLine(p2, x1, x2) End If Next Cnt
'The code below can not work well..........
'Shift all the points from the graph one place to the left For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt
Dim e2 As Graphics = picGraph.CreateGraphics GraphPoints(UBound(GraphPoints)) = lUsage e2.Clear(Color.Black) Dim p As New Pen(Color.Green, 1) For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 Dim x3 As New Point(Cnt, 100 - GraphPoints(Cnt)) Dim x4 As New Point(Cnt + 1, 100 - GraphPoints(Cnt + 1)) e2.DrawLine(p, x3, x4) Next Cnt End Sub ************************************************** ***********
"One Handed Man" <Bo****@Duck.net> дÈëÓʼþ news:bq**********@titan.btinternet.com... This might sound a little unhelpful but. If you cant even be bothered to look up the correct syntax for the Const declarations at the beginning,
I dont feel like helping you.
Try doing a bit more for yourself and then come back with specifics !
Regards OHM
yxq wrote: Hello Can anyone convert the vb6 code to vb.net? Thank you!
************************************************** ************ Const SPACE = 5 Const BAR_WIDTH = 50 Public GraphPoints(0 To 99) As Long
Sub DrawUsage(lUsage As Long, picPercent As PictureBox, picGraph As PictureBox) Dim Cnt As Long picPercent.ScaleMode = vbPixels For Cnt = 0 To 10 picPercent.Line (SPACE, SPACE + Cnt * 3)-(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1), IIf(lUsage >= 100 - Cnt * 10 And lUsage <> 0, &HC000&, &H4000&), BF Next Cnt ShiftPoints GraphPoints(UBound(GraphPoints)) = lUsage picGraph.Cls For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 picGraph.Line (Cnt, 100 - GraphPoints(Cnt))-(Cnt + 1, 100 - GraphPoints(Cnt + 1)), &H8000& Next Cnt End Sub
'Shift all the points from the graph one place to the left Sub ShiftPoints() Dim Cnt As Long For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt End Sub
************************************************** ************************** ***********************
Not clear what you are trying to acheive with this code. What are you
expecting to happen when you call Draw1 ?
OHM
yxq wrote: Hello I have convertd some code, but it works not well. ************************************************** ***** Const SPACE As Short = 5 Const BAR_WIDTH As Short = 50 Private GraphPoints(99) As Integer
Sub Draw1(ByVal lUsage As Integer, ByVal picPercent As PictureBox, ByVal picGraph As PictureBox) Dim Cnt As Integer For Cnt = 0 To 10 Dim p1 As New Pen(System.Drawing.ColorTranslator.FromOle(&HC000& ), 2) Dim p2 As New Pen(System.Drawing.ColorTranslator.FromOle(&H4000& ), 2) Dim x1 As New Point(SPACE, SPACE + Cnt * 3) Dim x2 As New Point(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1)
Dim e As Graphics = picPercent.CreateGraphics If lUsage >= 100 - Cnt * 10 And lUsage <> 0 Then e.DrawLine(p1, x1, x2) Else e.DrawLine(p2, x1, x2) End If Next Cnt
'The code below can not work well..........
'Shift all the points from the graph one place to the left For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt
Dim e2 As Graphics = picGraph.CreateGraphics GraphPoints(UBound(GraphPoints)) = lUsage e2.Clear(Color.Black) Dim p As New Pen(Color.Green, 1) For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 Dim x3 As New Point(Cnt, 100 - GraphPoints(Cnt)) Dim x4 As New Point(Cnt + 1, 100 - GraphPoints(Cnt + 1)) e2.DrawLine(p, x3, x4) Next Cnt End Sub ************************************************** ***********
"One Handed Man" <Bo****@Duck.net> дÈëÓʼþ news:bq**********@titan.btinternet.com... This might sound a little unhelpful but. If you cant even be bothered to look up the correct syntax for the Const declarations at the beginning, I dont feel like helping you.
Try doing a bit more for yourself and then come back with specifics !
Regards OHM
yxq wrote: Hello Can anyone convert the vb6 code to vb.net? Thank you!
************************************************** ************ Const SPACE = 5 Const BAR_WIDTH = 50 Public GraphPoints(0 To 99) As Long
Sub DrawUsage(lUsage As Long, picPercent As PictureBox, picGraph As PictureBox) Dim Cnt As Long picPercent.ScaleMode = vbPixels For Cnt = 0 To 10 picPercent.Line (SPACE, SPACE + Cnt * 3)-(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1), IIf(lUsage >= 100 - Cnt * 10 And lUsage <> 0, &HC000&, &H4000&), BF Next Cnt ShiftPoints GraphPoints(UBound(GraphPoints)) = lUsage picGraph.Cls For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 picGraph.Line (Cnt, 100 - GraphPoints(Cnt))-(Cnt + 1, 100 - GraphPoints(Cnt + 1)), &H8000& Next Cnt End Sub
'Shift all the points from the graph one place to the left Sub ShiftPoints() Dim Cnt As Long For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt End Sub
************************************************** ************************** ***********************
Please download the resource code on http://www.allapi.net/php/redirect/r...ownload&id=370
Thanks
"One Handed Man" <Bo****@Duck.net> дÈëÓʼþ
news:bq**********@sparta.btinternet.com... Not clear what you are trying to acheive with this code. What are you expecting to happen when you call Draw1 ?
OHM
yxq wrote: Hello I have convertd some code, but it works not well. ************************************************** ***** Const SPACE As Short = 5 Const BAR_WIDTH As Short = 50 Private GraphPoints(99) As Integer
Sub Draw1(ByVal lUsage As Integer, ByVal picPercent As PictureBox, ByVal picGraph As PictureBox) Dim Cnt As Integer For Cnt = 0 To 10 Dim p1 As New Pen(System.Drawing.ColorTranslator.FromOle(&HC000& ), 2) Dim p2 As New Pen(System.Drawing.ColorTranslator.FromOle(&H4000& ), 2) Dim x1 As New Point(SPACE, SPACE + Cnt * 3) Dim x2 As New Point(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1)
Dim e As Graphics = picPercent.CreateGraphics If lUsage >= 100 - Cnt * 10 And lUsage <> 0 Then e.DrawLine(p1, x1, x2) Else e.DrawLine(p2, x1, x2) End If Next Cnt
'The code below can not work well..........
'Shift all the points from the graph one place to the left For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt
Dim e2 As Graphics = picGraph.CreateGraphics GraphPoints(UBound(GraphPoints)) = lUsage e2.Clear(Color.Black) Dim p As New Pen(Color.Green, 1) For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 Dim x3 As New Point(Cnt, 100 - GraphPoints(Cnt)) Dim x4 As New Point(Cnt + 1, 100 - GraphPoints(Cnt + 1)) e2.DrawLine(p, x3, x4) Next Cnt End Sub ************************************************** ***********
"One Handed Man" <Bo****@Duck.net> дÈëÓʼþ news:bq**********@titan.btinternet.com... This might sound a little unhelpful but. If you cant even be bothered to look up the correct syntax for the Const declarations at the beginning, I dont feel like helping you.
Try doing a bit more for yourself and then come back with specifics !
Regards OHM
yxq wrote: Hello Can anyone convert the vb6 code to vb.net? Thank you!
************************************************** ************ Const SPACE = 5 Const BAR_WIDTH = 50 Public GraphPoints(0 To 99) As Long
Sub DrawUsage(lUsage As Long, picPercent As PictureBox, picGraph As PictureBox) Dim Cnt As Long picPercent.ScaleMode = vbPixels For Cnt = 0 To 10 picPercent.Line (SPACE, SPACE + Cnt * 3)-(SPACE + BAR_WIDTH, SPACE + Cnt * 3 + 1), IIf(lUsage >= 100 - Cnt * 10 And lUsage <> 0, &HC000&, &H4000&), BF Next Cnt ShiftPoints GraphPoints(UBound(GraphPoints)) = lUsage picGraph.Cls For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 picGraph.Line (Cnt, 100 - GraphPoints(Cnt))-(Cnt + 1, 100 - GraphPoints(Cnt + 1)), &H8000& Next Cnt End Sub
'Shift all the points from the graph one place to the left Sub ShiftPoints() Dim Cnt As Long For Cnt = LBound(GraphPoints) To UBound(GraphPoints) - 1 GraphPoints(Cnt) = GraphPoints(Cnt + 1) Next Cnt End Sub
************************************************** ************************** ***********************
Hi YXQ
I thought OHM was very clear, if you would try to do yourself first the
mainpart he would help you with the difficult things,
But now you thinks you have in this newsgroup someone working for you for
free.
I think that wehne you show that you did make a start trying it, HM or
another will help you than with the real problems, but not more than 5 rows
in a time I think.
Cor. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lauren Quantrell |
last post by:
I have a stored procedure using Convert where the exact same Convert
string works in the SELECT portion of the procedure but fails in the
WHERE portion.
The entire SP is listed below....
|
by: Logan X via .NET 247 |
last post by:
It's official....Convert blows.
I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
|
by: Eric Lilja |
last post by:
Hello, I've made a templated class Option (a child of the abstract base
class OptionBase) that stores an option name (in the form someoption=) and
the value belonging to that option. The value is...
|
by: whatluo |
last post by:
Hi, all
I'm now working on a program which will convert dec number to
hex and oct and bin respectively, I've checked the clc but with no
luck, so can anybody give me a hit how to make this done...
|
by: Convert TextBox.Text to Int32 Problem |
last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
|
by: patang |
last post by:
I want to convert amount to words. Is there any funciton available?
Example:
$230.30
Two Hundred Thirty Dollars and 30/100
|
by: Edwin Knoppert |
last post by:
In my code i use the text from a textbox and convert it to a double value.
I was using Convert.ToDouble() but i'm used to convert comma to dot.
This way i can assure the text is correct.
However...
|
by: johnlim20088 |
last post by:
Hi,
Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
|
by: Ken Fine |
last post by:
This is a basic question. What is the difference between casting and using
the Convert.ToXXX methods, from the standpoint of the compiler, in terms of
performance, and in other ways? e.g.
...
|
by: Debadatta Mishra |
last post by:
Introduction
In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
| |