VB - can TXT file data shows in picturebox to preview?

2007-02-18 4:40 am
I have a VB project which is for getting data in a txt file (data are all 1 & 0), and then want to show in VB picturebox in order to have a preview function, how can i write the program and which method i can use?

~~~its makes me headache ar ~~~please give me a hand!

回答 (2)

2007-02-19 5:21 am
✔ 最佳答案
Private Sub Command1_Click()
Picture1.Cls
Picture1.FontSize = 24
Picture1.FontBold = True
Picture1.FontItalic = True
Picture1.FontStrikethru = True
Picture1.FontUnderline = True
Picture1.CurrentX = 500
Picture1.CurrentY = 100
Picture1.Print Text1.Text
End Sub

2007-02-18 21:25:09 補充:
若是TEXT內有多行則必須將每行提取出來設定位置 Picture1.CurrentX Picture1.CurrentY然後設定字型 大小 Picture1.Print 這一行下一行必須又設定一次再次列印 完成PREVIEW

2007-02-19 02:56:28 補充:
是可以改變不過必須先在TEXT裡面處理之後再繪製到PICTURE1你可以用REPLACE這個指令REPLACE(字串,找尋字串,替代字串)

2007-02-19 02:56:48 補充:
Private Sub Command1_Click()Text1.Text = Replace(Text1.Text, ",", "")Text1.Text = Replace(Text1.Text, "0", "e")Text1.Text = Replace(Text1.Text, "1", "s")Picture1.Font = "細明體"Picture1.Print Text1.TextEnd Sub

2007-02-19 02:57:10 補充:
但是會有字型的問題不同字型的每個字大小並不相同你必須找到字型大小都相同的字形來應用 才會對齊像我的電腦上 用 Picture1.Font = "細明體"就會對齊 你的話 要自己試看看了

2007-02-19 03:00:54 補充:
如果要讓0消失 就用空白字串取代即可Text1.Text = Replace(Text1.Text, "0", " ")

2007-02-19 03:02:00 補充:
也可以用 CHR(數字) 來代替字串

2007-02-19 03:02:32 補充:
chr(ascII)
2007-02-18 5:29 am
個問題一開始就錯,咁問法如同問點可以令隻雞識游水= ="
你應該用label,而唔係用picture box
參考: 自己


收錄日期: 2021-04-13 14:47:10
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070217000051KK03353

檢視 Wayback Machine 備份