Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Command1_Click()
- '第一題,給定一DNA片段,請產生mRNA片段
- For i = 1 To Len(Text1)
- If Mid(Text1, i, 1) = "A" Then
- Text2 = Text2 & "U"
- ElseIf Mid(Text1, i, 1) = "T" Then
- Text2 = Text2 & "A"
- ElseIf Mid(Text1, i, 1) = "C" Then
- Text2 = Text2 & "G"
- ElseIf Mid(Text1, i, 1) = "G" Then
- Text2 = Text2 & "C"
- Else
- MsgBox "X men"
- End If
- Next
- '第二題,從text2的mRNA片段,產生amino acid串列,3個為一組()包起來
- For i = 1 To Len(Text2)
- If i Mod 3 = 1 Then
- Text3 = Text3 & "("
- End If
- If Mid(Text2, i, 1) = "A" Then
- Text3 = Text3 & "U"
- ElseIf Mid(Text2, i, 1) = "U" Then
- Text3 = Text3 & "A"
- ElseIf Mid(Text2, i, 1) = "C" Then
- Text3 = Text3 & "G"
- ElseIf Mid(Text2, i, 1) = "G" Then
- Text3 = Text3 & "C"
- Else
- MsgBox "X men"
- End If
- If i Mod 3 = 0 Then
- Text3 = Text3 & ")"
- End If
- Next
- '第三題,給定一dna片段text1,請劃出雙股結構
- For i = 1 To Command2.UBound
- Unload Command2(i)
- Next
- For i = 1 To Len(Text1)
- Load Command2(i)
- Command2(i).Left = Command2(i - 1).Left + Command2(i - 1).Width
- Command2(i).Caption = Mid(Text1, i, 1)
- Command2(i).Visible = True
- Next
- For i = 1 To Command3.UBound
- Unload Command3(i)
- Next
- For i = 1 To Len(Text1)
- Load Command3(i)
- Command3(i).Left = Command3(i - 1).Left + Command3(i - 1).Width
- If Mid(Text1, i, 1) = "A" Then
- Command3(i).Caption = "T"
- Command2(i).BackColor = QBColor(11)
- Command3(i).BackColor = QBColor(10)
- ElseIf Mid(Text1, i, 1) = "T" Then
- Command3(i).Caption = "A"
- Command2(i).BackColor = QBColor(10)
- Command3(i).BackColor = QBColor(11)
- ElseIf Mid(Text1, i, 1) = "C" Then
- Command3(i).Caption = "G"
- Command2(i).BackColor = QBColor(14)
- Command3(i).BackColor = QBColor(12)
- ElseIf Mid(Text1, i, 1) = "G" Then
- Command3(i).Caption = "C"
- Command2(i).BackColor = QBColor(12)
- Command3(i).BackColor = QBColor(14)
- Else
- MsgBox "X men"
- End If
- Command3(i).Visible = True
- Next
- Cls
- For i = 1 To Len(Text1)
- Line (Command2(i).Left + Command2(i).Width / 2, Command2(i).Top + Command2(i).Height)-(Command3(i).Left + Command3(i).Width / 2, Command3(i).Top + Command3(i).Height), vbRed
- Next
- '第四題,螺旋
- T = 1
- For j = 1 To 5
- For i = T To T + 4
- If i = 25 Then
- Exit For
- End If
- Command2(i).Top = Command2(i - 1).Top + Command2(i).Height
- Command3(i).Top = Command3(i - 1).Top - Command3(i).Height
- Next
- If i = 25 Then
- Exit For
- End If
- For h = T + 5 To T + 9
- If h = 25 Then
- Exit For
- End If
- Command2(h).Top = Command2(h - 1).Top - Command2(h).Height
- Command3(h).Top = Command3(h - 1).Top + Command3(h).Height
- Next
- If h > 25 Then
- Exit For
- End If
- T = T + 10
- Next
- Cls
- For i = 1 To Len(Text1)
- Line (Command2(i).Left + Command2(i).Width / 2, Command2(i).Top + Command2(i).Height)-(Command3(i).Left + Command3(i).Width / 2, Command3(i).Top + Command3(i).Height), vbRed
- Next
- End Sub
- Private Sub Form_Load()
- Command3(0).Top = Command2(0).Top + Command2(0).Height * 5
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement