就象一般的图象处理工具一样,选择text工具,在图片中单击鼠标。变成文本输入方式,可以输入任意文字(可以调整大小和颜色)。应该如何实现?说个思路。立刻结帖。200分

解决方案 »

  1.   

    PictureBox + TextBox就可以实现
      

  2.   

    1、工具条上放置一个按钮,按钮属性设置为可按下;另外窗体放一个textbox,
       visible为false;
    2、picturebox_click()事件中:
       '判断按钮是否按下(没有按下则跳出)
       获得鼠标的坐标;
       在该坐标显示textbox;(文字大小、颜色可设置textbox的属性)
       
      

  3.   

    小例子,大概就是这个思路。Dim tmpStr As String
    Dim pX, pY As Double
    Private Sub Command1_Click()
    Me.MousePointer = 3
    End SubPrivate Sub Form_Load()
    Text1.Visible = False
    pX = 0: pY = 0
    End SubPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 And Me.MousePointer = 3 Then
       Me.MousePointer = 0
       Text1.Text = ""
       Text1.Left = X: pX = X
       Text1.Top = Y: pY = Y
       Text1.Visible = True
       Text1.SetFocus
       
    ElseIf Button = 2 Then
       Text1.Text = ""
       Text1.Visible = False
       pX = 0: pY = 0
    End If
    End SubPrivate Sub Text1_Change()
    tmpStr = Text1.Text
    End SubPrivate Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = 13 Then
       Text1.Visible = False
       Picture1.ScaleMode = 1
       Picture1.ForeColor = RGB(&HFF, 0, 0)
       Picture1.CurrentX = pX
       Picture1.CurrentY = pY
       Picture1.Print tmpStr
       Picture1.Refresh
    End If
    End Sub
      

  4.   

    注意,Text1是以Picture1为容器的
      

  5.   

    to cooly
    怎么字出不来呢
      

  6.   

    在Text1中输入完后,按回车键(Enter)