Click here to Skip to main content
15,910,603 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralContext menu windows and combo box windows Pin
cnurse17-Dec-03 1:45
cnurse17-Dec-03 1:45 
GeneralPersisting properties of child controls contained in USER CONTOLS Pin
cnurse17-Dec-03 0:03
cnurse17-Dec-03 0:03 
GeneralRe: Persisting properties of child controls contained in USER CONTOLS Pin
steff kamush17-Dec-03 22:02
steff kamush17-Dec-03 22:02 
GeneralRe: Persisting properties of child controls contained in USER CONTOLS Pin
cnurse18-Dec-03 2:29
cnurse18-Dec-03 2:29 
GeneralDrawing our Own Charts on Forms with out using the MSChart Control Pin
EmanAli16-Dec-03 22:26
EmanAli16-Dec-03 22:26 
GeneralRe: Drawing our Own Charts on Forms with out using the MSChart Control Pin
Dave Kreskowiak17-Dec-03 4:31
mveDave Kreskowiak17-Dec-03 4:31 
GeneralRe: My Question is How can i do that. drawing charts without using MS Chart controll Pin
EmanAli17-Dec-03 4:52
EmanAli17-Dec-03 4:52 
GeneralRe: My Question is How can i do that. drawing charts without using MS Chart controll Pin
Dave Kreskowiak17-Dec-03 5:40
mveDave Kreskowiak17-Dec-03 5:40 
First, I have to question why you would want to do this? There are many controls already out there that handle chart drawing of any imaginable type. I just don't see the point in reinventing the wheel...?

But if you must, you could use a PicBox or draw directly on the Form itself. I would suggest writing this as a control using a PicBox so it can be reused in other projects. First, you have to work out a method of keeping track of data. This is going to depend on the type of data your working with. Then, you calculate the scaling for your data, then calculate the size of your chart and its scaling in the PicBox. Your also going to have to calculate positions for labels and font scaling.

When you have all that, you have to write your code to paint the chart in the Paint event of your control. Get a Graphics object for the PicBox by using the CreateGraphics method of the PicBox. Then you can use the Graphics objects methods to draw what your chart is going to look like.

Just as an example of drawing using the Graphics object, this is a little snippet of code from a goofy little control project I worked on a while back:
Private Sub threadDrawingLines()
    Dim x As Integer
    Dim objPen As New Pen(Color.Blue)
    Dim grPicBox As Graphics = PictureBox1.CreateGraphics

    Try
        While (pNumberOfLines > 0)
            For x = 1 To pNumberOfLines
                grPicBox.DrawLine(objPen, Lines(x, 1), Lines(x, 2))
            Next
            UpdatePositions()
            Thread.Sleep(pSleepTime)
        End While
    Catch ex As ThreadAbortException
        grPicBox = Nothing
        objPen = Nothing
    End Try
End Sub




RageInTheMachine9532
GeneralRe: My Question is How can i do that. drawing charts without using MS Chart controll Pin
EmanAli19-Dec-03 4:39
EmanAli19-Dec-03 4:39 
QuestionHow to do double bufferring on a picbox?VB.Net Pin
MJay16-Dec-03 20:44
MJay16-Dec-03 20:44 
AnswerRe: How to do double bufferring on a picbox?VB.Net Pin
steff kamush16-Dec-03 22:28
steff kamush16-Dec-03 22:28 
QuestionHow Do I able retrieve Data using Comm Events?? Pin
Member 76608416-Dec-03 17:53
Member 76608416-Dec-03 17:53 
Questionhow to keep the drawing on picturebox when new drawing is added?VB.Net Pin
MJay16-Dec-03 8:02
MJay16-Dec-03 8:02 
AnswerRe: how to keep the drawing on picturebox when new drawing is added?VB.Net Pin
Dave Kreskowiak16-Dec-03 16:22
mveDave Kreskowiak16-Dec-03 16:22 
AnswerRe: how to keep the drawing on picturebox when new drawing is added?VB.Net Pin
steff kamush16-Dec-03 20:24
steff kamush16-Dec-03 20:24 
GeneralRe: how to keep the drawing on picturebox when new drawing is added?VB.Net Pin
MJay16-Dec-03 20:49
MJay16-Dec-03 20:49 
Generalnewbie - Help! Pin
cawe16-Dec-03 7:22
cawe16-Dec-03 7:22 
GeneralRe: newbie - Help! Pin
steff kamush16-Dec-03 20:49
steff kamush16-Dec-03 20:49 
GeneralOpen file attached to Excel as OLEObject Pin
Member 77096916-Dec-03 7:19
Member 77096916-Dec-03 7:19 
Questionhow to read the value from a text file? Pin
ESJY16-Dec-03 4:17
ESJY16-Dec-03 4:17 
AnswerRe: how to read the value from a text file? Pin
steff kamush16-Dec-03 22:04
steff kamush16-Dec-03 22:04 
GeneralRe: how to read the value from a text file? Pin
ESJY19-Dec-03 4:32
ESJY19-Dec-03 4:32 
GeneralRe: how to read the value from a text file? Pin
steff kamush21-Dec-03 20:11
steff kamush21-Dec-03 20:11 
GeneralRe: how to read the value from a text file? Pin
ESJY22-Dec-03 4:32
ESJY22-Dec-03 4:32 
GeneralValidate User/Password Pin
16-Dec-03 4:01
suss16-Dec-03 4:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.