这个好象用处不大,都是pagemaker的scripting Private Sub Text2_Change() If Flag <> 1 Then Call link End If color_d = "definecolor " & Chr(34) & "Text_clr2" & Chr(34) & ",spot,rgb255,false," & text_red(2) & "," & text_green(2) & "," & text_blue(2) txtlink.LinkExecute (color_d) txtlink.LinkExecute ("deletelayer " & Chr(34) & "layer_text2" & Chr(34)) comm = "newlayer " & Chr(34) & "layer_text2" & Chr(34) & ",1,0,0," & text_red(2) & "," & text_green(2) & "," & text_blue(2) txtlink.LinkExecute (comm) ' co = "newstorysized 400,0,570,50" '& Px & "," & Py & "," & Px + 200 & "," & Py + 200 co = "newstorysized 10,100,200,150" txtlink.LinkExecute (co) Text_content = "textenter " & Chr(34) & Text2.Text & Chr(34) txtlink.LinkExecute (Text_content) txtlink.LinkExecute ("stylebegin " & Chr(34) & "text2" & Chr(34)) txtlink.LinkExecute ("font " & Chr(34) & text_font(2) & Chr(34)) txtlink.LinkExecute ("color " & Chr(34) & "Text_clr2" & Chr(34)) txtlink.LinkExecute ("size " & f_fontsize(2)) If f_fontbold(2) Then txtlink.LinkExecute ("typestyle bold") End If If f_fontitalic(2) Then txtlink.LinkExecute ("typestyle italic") End If End Sub
做一下判断呀: Private Sub Text2_Change() If len(Text2.Text)=n then ...... else ..... end if end sub
比如设n=3 然后打“中华人民共和国”,只能出来“中华人”则触发change,然后截断整个词组了
Private Sub Text2_Change() If right(Text2.Text,1)=chr(13) then ...... else ..... end if end sub
你不用change事件,用text_keyPress事件不好吗? private sub text_keypress(keyascii as integer) if keyascii=13 then ............ end if end sub
同意楼上~~~不过既然这样。建议用Keydown 事件 Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) if keycode=13 then ........... else ........... endif End Sub
Private Sub Text2_Change()
If Flag <> 1 Then
Call link
End If
color_d = "definecolor " & Chr(34) & "Text_clr2" & Chr(34) & ",spot,rgb255,false," & text_red(2) & "," & text_green(2) & "," & text_blue(2)
txtlink.LinkExecute (color_d)
txtlink.LinkExecute ("deletelayer " & Chr(34) & "layer_text2" & Chr(34))
comm = "newlayer " & Chr(34) & "layer_text2" & Chr(34) & ",1,0,0," & text_red(2) & "," & text_green(2) & "," & text_blue(2)
txtlink.LinkExecute (comm)
' co = "newstorysized 400,0,570,50" '& Px & "," & Py & "," & Px + 200 & "," & Py + 200
co = "newstorysized 10,100,200,150"
txtlink.LinkExecute (co)
Text_content = "textenter " & Chr(34) & Text2.Text & Chr(34)
txtlink.LinkExecute (Text_content)
txtlink.LinkExecute ("stylebegin " & Chr(34) & "text2" & Chr(34))
txtlink.LinkExecute ("font " & Chr(34) & text_font(2) & Chr(34))
txtlink.LinkExecute ("color " & Chr(34) & "Text_clr2" & Chr(34))
txtlink.LinkExecute ("size " & f_fontsize(2))
If f_fontbold(2) Then
txtlink.LinkExecute ("typestyle bold")
End If
If f_fontitalic(2) Then
txtlink.LinkExecute ("typestyle italic")
End If
End Sub
Private Sub Text2_Change()
If len(Text2.Text)=n then
......
else
.....
end if
end sub
If right(Text2.Text,1)=chr(13) then
......
else
.....
end if
end sub
private sub text_keypress(keyascii as integer)
if keyascii=13 then
............
end if
end sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
if keycode=13 then
...........
else
...........
endif
End Sub
Text2.Text = Text1.Text
Label1.Caption = Text2.Text
End Sub
这种方法不行吗?我怎么都可以的啊?如果这样可以的话,那相类似的问题怎么不行呢?