' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' [2008_06_17_PM_09_57_42] ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
'
' (程式用模組名稱) Code name of this module:
' WJAtTSINT2008.猜字高手Y2008M06D17 [2008-06-17-PM-09-57-59]
'
' Version: 1.00.01
' Last Updated: (2008 06 17 PM 09 56 00)
Public Class 猜字高手Y2008M06D17
Private m_WordToGuess As String = "高手"
Private m_字串建構員 As New 字串建構員
Private m_flagCorrectAnswerWasAlreadyFiguredOut As Boolean = False
Private Const pc_CongratulationPrefixString As String = "Hey! 嘿! You are so great! You've figured out the mysterious word (神秘的文字)! Congratulation! 恭喜恭喜!"
' - - - - - - - - - - - - -
' - - - - - - - - - - - - -
Private Function Do_GetStringInClipboard() As String
' (本段程式之目的) Purpose:
' Get the text content currently stored in system's clipboard.
' (本段程式是否已經在被使用中) In use: Yes
' (重要等級) Importance rating: 85%
' (再利用的可能性) Chances of reuse: 90%
' (程式撰寫的進度) Developing: 100% (Mandatory)
' (程式堪用的程度) Workable: 80% (Threshold at 80%)
' (程式的測試程度) Code tested: 80% (max 99%)
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
' (修改程式的日期) Revision Date: (2005 09 01 PM 01 50 25)
' (修改程式的人員) Revised by: WeiJin Tang (湯偉晉)
' OK
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dim myDataObject As System.Windows.Forms.IDataObject
Dim T As String
myDataObject = System.Windows.Forms.Clipboard.GetDataObject()
' Try to return Unicode Text first, if failed, then try to return ANSI Text
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.UnicodeText) Then
T = myDataObject.GetData(System.Windows.Forms.DataFormats.UnicodeText)
Else
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Text) Then
T = myDataObject.GetData(System.Windows.Forms.DataFormats.Text)
Else
T = String.Empty
End If
End If
Return T
' Begin: Reusable code block (2005 09 01 PM 10 26 20)
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Text) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Text]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.Text]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.UnicodeText) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.UnicodeText]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.UnicodeText]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.WaveAudio) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.WaveAudio]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.WaveAudio]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Html) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Html]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.Html]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Rtf) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Rtf]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.Rtf]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Bitmap) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Bitmap]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.Bitmap]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.PenData) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.PenData]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.PenData]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.StringFormat) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.StringFormat]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.StringFormat]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Serializable) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Serializable]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.Serializable]")
End If
If myDataObject.GetDataPresent(System.Windows.Forms.DataFormats.Riff) Then
MsgBox("Clipboard content is compatible with data type [System.Windows.Forms.DataFormats.Riff]")
Else
MsgBox("Clipboard content is NOT compatible with data type [System.Windows.Forms.DataFormats.Riff]")
End If
' End: Reusable code block (2005 09 01 PM 10 26 20)
End Function ' Do_GetStringInClipboard
' - - - - - - - - - - - - -
' - - - - - - - - - - - - -
Public Sub New()
' OK
Dim T As String
T = Me.Do_GetStringInClipboard
' remove white space chars on both ends
T = T.Trim
' get the first 2 characters from text currently stored in Clipboard
If T.Length >= 2 Then
Me.m_WordToGuess = T.Substring(0, 2)
Else
' use default value
End If
'MsgBox(Me.m_WordToGuess)
End Sub ' New
' - - - - - - - - - - - - -
' - - - - - - - - - - - - -
Public Sub CheckThisWordToSeeIfItIsTheCorrectAnswer(ByVal AnyWord As String)
' OK
If AnyWord.ToUpper = Me.m_WordToGuess.ToUpper Then
Me.m_flagCorrectAnswerWasAlreadyFiguredOut = True
Me.m_字串建構員.從最後面接上這個字串(vbNewLine)
Me.m_字串建構員.從最後面接上這個字串(vbNewLine)
Me.m_字串建構員.從最後面接上這個字串(AnyWord)
Me.m_字串建構員.從最後面接上這個字串(vbNewLine)
Me.m_字串建構員.從最後面接上這個字串(vbNewLine)
MsgBox(Me.pc_CongratulationPrefixString & Me.m_字串建構員.傳回你所管理的字串)
Else
' store AnyWord if it is not the correct answerer
Me.m_字串建構員.從最後面接上這個字串(AnyWord)
End If
End Sub ' CheckThisWordToSeeIfItIsTheCorrectAnswer
' - - - - - - - - - - - - -
' - - - - - - - - - - - - -
Public ReadOnly Property flagCorrectAnswerWasAlreadyFiguredOut() As Boolean
' OK
Get
Return Me.m_flagCorrectAnswerWasAlreadyFiguredOut
End Get
End Property
' - - - - - - - - - - - - -
' - - - - - - - - - - - - -
End Class ' 猜字高手Y2008M06D17
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' [2008_06_17_PM_09_57_42] ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
沒有留言:
張貼留言