Hiển thị kết quả từ 1 đến 2 / 2
  1. #1
    Tham gia
    15-04-2004
    Bài viết
    36
    Like
    0
    Thanked 0 Times in 0 Posts

    Hiển thị kí tự hóa học

    Cho em hỏi có cách nào hiển thị được các kí tự hóa học như CH4 hay công thức toán x bình phương trong VB6 ko. Nếu có thể xử lí bằng text thì càng tốt.
    Quote Quote

  2. #2
    Tham gia
    25-10-2003
    Bài viết
    1,810
    Like
    1
    Thanked 1 Time in 1 Post
    Anh tạo mới 1 Projeact sau đó add 1 RichtextBox vào form . Sau đó Chép hết đoạn Code sau vào. F9 --> Fun
    Private Sub Form_Load()
    RichTextBox1.Font.Name = "Times New Roman"
    RichTextBox1.Font.Size = 10
    RichTextBox1.Text = _
    "H2SO4" & vbCrLf & _
    "H2O" & vbCrLf & _
    "CO2"

    RichTextBox1.SelStart = 1
    RichTextBox1.SelLength = 1
    RichTextBox1.SelCharOffset = -50
    RichTextBox1.SelStart = 4
    RichTextBox1.SelLength = 1
    RichTextBox1.SelCharOffset = -50
    RichTextBox1.SelStart = 8
    RichTextBox1.SelLength = 1
    RichTextBox1.SelCharOffset = -50
    RichTextBox1.SelStart = 14
    RichTextBox1.SelLength = 1
    RichTextBox1.SelCharOffset = -50

    RichTextBox1.SelStart = 0
    RichTextBox1.SelLength = 0
    End Sub


    Private Sub Form_Paint()
    CurrentX = 120
    CurrentY = RichTextBox1.Top + _
    RichTextBox1.Height + 120
    Print "H";
    CurrentY = CurrentY + 60
    Print "2";
    CurrentY = CurrentY - 60
    Print "SO";
    CurrentY = CurrentY + 60
    Print "4";
    CurrentY = CurrentY - 60

    CurrentX = 120
    CurrentY = CurrentY + ScaleY(1.5 * Font.Size, vbPoints, ScaleMode)
    Print "H";
    CurrentY = CurrentY + 60
    Print "2";
    CurrentY = CurrentY - 60
    Print "O";

    CurrentX = 120
    CurrentY = CurrentY + ScaleY(1.5 * Font.Size, vbPoints, ScaleMode)
    Print "CO";
    CurrentY = CurrentY + 60
    Print "2";
    CurrentY = CurrentY - 60
    End Sub

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •