Click here to Skip to main content
16,011,805 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Opening Files in Visual Studio.NET 2003 Pin
KevinMac31-Dec-06 9:34
KevinMac31-Dec-06 9:34 
GeneralRe: Opening Files in Visual Studio.NET 2003 Pin
Peter Constant31-Dec-06 9:39
Peter Constant31-Dec-06 9:39 
QuestionLooking for a unique program ID Pin
roo42631-Dec-06 4:00
roo42631-Dec-06 4:00 
AnswerRe: Looking for a unique program ID Pin
KevinMac31-Dec-06 8:04
KevinMac31-Dec-06 8:04 
GeneralRe: Looking for a unique program ID Pin
roo42631-Dec-06 8:35
roo42631-Dec-06 8:35 
QuestionDisconnected Mode Report.... Pin
msleem31-Dec-06 1:17
msleem31-Dec-06 1:17 
AnswerRe: Disconnected Mode Report.... Pin
msleem2-Jan-07 9:10
msleem2-Jan-07 9:10 
QuestionDgee's GT2DrW help!!!! Pin
David Gee30-Dec-06 22:19
David Gee30-Dec-06 22:19 
i have make a program which enables you to draw on screen (on a form) using the mouse in any color and any size. It is really good and really useful, then one day when i fiddling with it i realized i could set timers to change the colors of the pen color to make it look 3-d, but when i ran it and compiled it, i was testing it, and it had errors like not changing the pen color, can someone help, here is my code:


if you find an answer or you need or would like either programs, just emai me on;
david-gee@hotmail.com


Option Explicit<br />
<br />
Private PointX() As Single<br />
Private PointY() As Single<br />
Private NumPoints As Integer<br />
Public c, j, c1, c2<br />
Private Drawing As Boolean<br />
<br />
<pre>
Private Sub Form_Activate()
c1 = vbBlack
c2 = vbBlack
c = 1
End Sub
</pre><br />
Private Sub Form_KeyPress(KeyAscii As Integer)<br />
    Timer3.Interval = 1<br />
    Timer4.Interval = 1<br />
If KeyAscii = 97 Then<br />
    frmAbout.Visible = True<br />
    frmAbout.Timer1.Interval = 500<br />
End If<br />
If KeyAscii = 49 Then<br />
    Form1.cdbDialog.ShowColor<br />
    c1 = Form1.cdbDialog.Color<br />
    Form1.Enabled = True<br />
    Form1.Visible = True<br />
    Form1.WindowState = 2<br />
End If<br />
If KeyAscii = 50 Then<br />
    Form1.CommonDialog1.ShowColor<br />
    c2 = Form1.CommonDialog1.Color<br />
    Form1.Enabled = True<br />
    Form1.Visible = True<br />
    Form1.WindowState = 2<br />
End If<br />
If KeyAscii = 32 Then<br />
    NumPoints = 0<br />
    Cls<br />
End If<br />
If KeyAscii = 43 Then<br />
    If c = 1300 Then c = 1299<br />
    DrawWidth = DrawWidth + 1<br />
    c = c + 1<br />
    Label1.Caption = c<br />
    If c = 1300 Then c = 1299<br />
End If<br />
If KeyAscii = 45 Then<br />
    If c = 1 Then<br />
    Else<br />
        DrawWidth = DrawWidth - 1<br />
        c = c - 1<br />
        If c = 0 Then c = 1<br />
        Label1.Caption = c<br />
    End If<br />
End If<br />
If KeyAscii = 48 Then<br />
    DrawWidth = 1<br />
    Label1.Caption = "1"<br />
    c = 1<br />
End If<br />
If KeyAscii = 63 Then<br />
    j = InputBox("Input a line width 1 - 1300", "Line Width", c)<br />
    If j > 1300 Or j = 0 Then<br />
        j = InputBox("Input a line width 1 - 1300", "Line Width", c)<br />
        KeyAscii = 63<br />
    Else<br />
        c = j<br />
        Label1.Caption = j<br />
        Form1.DrawWidth = j<br />
    End If<br />
End If<br />
End Sub<br />
<pre>
Private Sub Form_Load()
Label1.Caption = "1"
c = 1
    Timer3.Interval = 1
    Timer4.Interval = 1
    AutoRedraw = True
End Sub</pre><br />
<br />
<br />
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)<br />
    ' Let MouseMove know we are drawing.<br />
    Drawing = True<br />
<br />
    ' Start from scratch<br />
    Timer3.Interval = 1<br />
    Timer4.Interval = 1<br />
    ' Start drawing here.<br />
    CurrentX = X<br />
    CurrentY = Y<br />
End Sub<br />
<br />
<pre>Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ' Make sure we are drawing.
    If Not Drawing Then Exit Sub

    ' Save the new point.
    NumPoints = NumPoints + 1
    ReDim Preserve PointX(1 To NumPoints)
    ReDim Preserve PointY(1 To NumPoints)
    PointX(NumPoints) = X
    PointX(NumPoints) = X
    Timer3.Interval = 1
    Timer4.Interval = 1
    
    ' Draw to the point.
    Line -(X, Y)
End Sub

</pre><br />
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)<br />
    ' Stop drawing.<br />
    Drawing = False<br />
<br />
End Sub<br />
<br />
<br />
Private Sub Option2_Click()<br />
End Sub<br />
<br />
Private Sub Form_Terminate()<br />
c1 = vbBlack<br />
c2 = vbBlack<br />
Unload Me<br />
End<br />
End Sub<br />
<br />
<pre>Private Sub Form_Unload(Cancel As Integer)
Unload Me
End
End Sub
Private Sub Label2_Click()
Form2.Visible = True
Form1.Enabled = False
End Sub</pre><br />
<br />
Private Sub Timer1_Timer()<br />
frmSplash.Visible = True<br />
frmSplash.Enabled = True<br />
Timer2.Interval = 1<br />
Timer1.Interval = 0<br />
End Sub<br />
<br />
<pre>Private Sub Timer2_Timer()
Timer1.Interval = 0
frmSplash.Timer1.Interval = 0
Form1.DrawWidth = Label1.Caption
Label1.Caption = Form1.DrawWidth
End Sub</pre><br />
<br />
<br />
Private Sub Timer3_Timer()<br />
If c1 = Form1.ForeColor Then<br />
    Form1.ForeColor = c2<br />
    Timer3.Enabled = False<br />
    Timer4.Enabled = True<br />
End If<br />
End Sub<br />
<br />
<pre>Private Sub Timer4_Timer()
If c2 = Form1.ForeColor Then
    Form1.ForeColor = c1
    Timer4.Enabled = False
    Timer3.Enabled = True
End If
End Sub</pre><br />
<big>if you find an answer or you need or would like either programs, just emai me on;</big> <br />
<br />
<div class="ForumSig">David Gee - david-gee@hotmail.com</div>

Questionkilling network connection...please help Pin
carl_sti30-Dec-06 21:54
carl_sti30-Dec-06 21:54 
AnswerRe: killing network connection...please help Pin
Dave Kreskowiak31-Dec-06 5:02
mveDave Kreskowiak31-Dec-06 5:02 
GeneralRe: killing network connection...please help Pin
carl_sti31-Dec-06 6:41
carl_sti31-Dec-06 6:41 
GeneralRe: killing network connection...please help Pin
Dave Kreskowiak31-Dec-06 8:10
mveDave Kreskowiak31-Dec-06 8:10 
GeneralRe: killing network connection...please help Pin
Pravat Maskey31-Dec-06 19:20
Pravat Maskey31-Dec-06 19:20 
GeneralRe: killing network connection...please help Pin
Dave Kreskowiak1-Jan-07 7:43
mveDave Kreskowiak1-Jan-07 7:43 
QuestionComparing an image to each image in an ImageList Pin
Zaegra30-Dec-06 20:55
Zaegra30-Dec-06 20:55 
AnswerRe: Comparing an image to each image in an ImageList Pin
Dave Kreskowiak31-Dec-06 5:00
mveDave Kreskowiak31-Dec-06 5:00 
GeneralRe: Comparing an image to each image in an ImageList Pin
Zaegra1-Jan-07 0:09
Zaegra1-Jan-07 0:09 
QuestionAdding and saving rows to a datagrid at runtime Pin
steve_rm30-Dec-06 17:34
steve_rm30-Dec-06 17:34 
Questionadding flash Pin
nbulut30-Dec-06 11:36
nbulut30-Dec-06 11:36 
Questionpicturebox location runtime Pin
WestSideRailways30-Dec-06 10:59
WestSideRailways30-Dec-06 10:59 
AnswerRe: picturebox location runtime Pin
Dave Kreskowiak30-Dec-06 11:35
mveDave Kreskowiak30-Dec-06 11:35 
AnswerRe: picturebox location runtime Pin
The ANZAC30-Dec-06 15:57
The ANZAC30-Dec-06 15:57 
GeneralRe: picturebox location runtime Pin
WestSideRailways30-Dec-06 19:45
WestSideRailways30-Dec-06 19:45 
QuestionWindow Manager Pin
joejoeiscool30-Dec-06 8:25
joejoeiscool30-Dec-06 8:25 
AnswerRe: Window Manager Pin
Dave Kreskowiak30-Dec-06 11:33
mveDave Kreskowiak30-Dec-06 11:33 

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.