11-02-2013، 08:19 PM
سلام
اشکال این برنامه چیه ؟ لطفا استاتید راهنمایی کنند
قرار با کشیدن دست روی صفحه خط یکشه
اشکال این برنامه چیه ؟ لطفا استاتید راهنمایی کنند
قرار با کشیدن دست روی صفحه خط یکشه
#Region Project Attributes
#ApplicationLabel: Test Draw
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
' Dim bmpImage, bmpTest, bmpTransparent As Bitmap
Dim pnlTest As Panel
Dim cvsImage, cvsTest As Canvas
Dim Label3 As Label
Dim Label4 As Label
Dim LineColor As Int : LineColor=Colors.Blue
Dim LineWidth As Float : LineWidth=3
Dim x1 As Float : x1=0
Dim y1 As Float : y1=0
Dim x2 As Float : x2=0
Dim y2 As Float : y2=0
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout")
cvsImage.Initialize(Activity)
Label3.Text ="X = 0.0"
Label4.Text ="Y = 0.0"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
If Action=Activity.ACTION_DOWN Then
x1=X
y1=Y
x2=X
y2=Y
Label3.Text="X = " & X
Label4.Text="Y = " & Y
Else If Action=Activity.ACTION_MOVE Then
x2=X
y2=Y
pnlTest.Color=Colors.Transparent
cvsTest.Initialize(pnlTest)
cvsTest.DrawLine(x1,y1-pnlTest.Top,x2,y2-pnlTest.Top,Colors.Red,LineWidth)
pnlTest.Invalidate
Label3.Text="X = " & X
Label4.Text="Y = " & Y
Else If Action=Activity.ACTION_UP Then
pnlTest.Color=Colors.Transparent
cvsTest.Initialize(pnlTest)
cvsImage.DrawLine(x1,y1,x2,y2,LineColor,LineWidth)
End If
End Sub
#ApplicationLabel: Test Draw
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
' Dim bmpImage, bmpTest, bmpTransparent As Bitmap
Dim pnlTest As Panel
Dim cvsImage, cvsTest As Canvas
Dim Label3 As Label
Dim Label4 As Label
Dim LineColor As Int : LineColor=Colors.Blue
Dim LineWidth As Float : LineWidth=3
Dim x1 As Float : x1=0
Dim y1 As Float : y1=0
Dim x2 As Float : x2=0
Dim y2 As Float : y2=0
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout")
cvsImage.Initialize(Activity)
Label3.Text ="X = 0.0"
Label4.Text ="Y = 0.0"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
If Action=Activity.ACTION_DOWN Then
x1=X
y1=Y
x2=X
y2=Y
Label3.Text="X = " & X
Label4.Text="Y = " & Y
Else If Action=Activity.ACTION_MOVE Then
x2=X
y2=Y
pnlTest.Color=Colors.Transparent
cvsTest.Initialize(pnlTest)
cvsTest.DrawLine(x1,y1-pnlTest.Top,x2,y2-pnlTest.Top,Colors.Red,LineWidth)
pnlTest.Invalidate
Label3.Text="X = " & X
Label4.Text="Y = " & Y
Else If Action=Activity.ACTION_UP Then
pnlTest.Color=Colors.Transparent
cvsTest.Initialize(pnlTest)
cvsImage.DrawLine(x1,y1,x2,y2,LineColor,LineWidth)
End If
End Sub