在网上下了个全屏显示的程序,自动将各个控位的位置重绘.里面有一个PICTURE控件,加载了一个画有设备相对位置的图形,再里面就是几个LABEL用于实时地显示产品的位置.用了这个全屏程序后,PICTURE,及LABEL的位置与大小都变了,但加载的图片却不能按比例增加最终的结果就造成了显示的LABEL的位置不在相应的生产位置上了有没有更好的办法达到我的要求谢谢

解决方案 »

  1.   

    picture可用image控件代替,它能够自动缩放
      

  2.   

    Dim l, t, w, h
    Private Sub Form_Load()
    Picture1.AutoSize = True
    Picture1.AutoRedraw = True
    Picture1.BackColor = vbBlack
    l = Picture1.Left / Me.Width
    t = Picture1.Top / Me.Height
    w = Picture1.Width / Me.Width
    h = Picture1.Height / Me.Height
    End SubPrivate Sub Form_Resize()
    With Picture1
    .Left = l * Me.Width
    .Top = t * Me.Height
    .Width = w * Me.Width
    .Height = h * Me.Height
    End With
    End Sub
      

  3.   

    Dim l, t, w, h
    Private Sub Form_Load()
    Picture1.AutoSize = True
    Picture1.AutoRedraw = True
    Picture1.BackColor = vbBlack
    l = Picture1.Left / Me.Width
    t = Picture1.Top / Me.Height
    w = Picture1.Width / Me.Width
    h = Picture1.Height / Me.Height
    End SubPrivate Sub Form_Resize()
    With Picture1
    .Left = l * Me.Width
    .Top = t * Me.Height
    .Width = w * Me.Width
    .Height = h * Me.Height
    End With
     Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Picture1.Width, Picture1.Height
      

  4.   

    使用Image,配合在Form_Resize里面更改大小。或者用ls的办法,paintpicture,略微麻烦一点。
      

  5.   

    PICTURE控件若始终和完全符合体一样大也简单,3楼代码因保持了等比例的边距,代码就略多了一点
    关键是
     Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Picture1.Width, Picture1.Height
    可使ImageList1中的图片刚好和图片框一样大.
      

  6.   

    方案一
    Picture属性中没有,在代码中可以实现,设置图片符合图片框的大小...
    Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Picture1.Width, Picture1.Height
    方案二
    用Image,这样在属性里就可以设置了...