有列子最好
email:   [email protected]

解决方案 »

  1.   

    image控件不就支持缩放吗?也许我没明白意思
      

  2.   

    我的意思是:假如我的显示分辨率为800*600,如果有一幅图的大小为1024*778(没错),我要图片显示在一个窗体内,要如何办?
    to griefforyou(为你伤心) :
    能让我瞧一瞧吗?
    email:   [email protected]
      

  3.   

    用StretchBlt把图形缩小不就得了VB声明 
    Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long 
    说明 
    将一幅位图从一个设备场景复制到另一个。源和目标DC相互间必须兼容。这个函数会在设备场景中定义一个目标矩形,并在位图中定义一个源图象。源矩形会根据需要进行伸缩,以便与目标矩形的大小相符 
    返回值 
    Long,非零表示成功,零表示失败。会设置GetLastError 
    参数表 
    参数 类型及说明 
    hdc Long,目标设备场景 
    x,y Long,目标矩形左上角的x,y坐标,以逻辑坐标表示 
    nWidth,nHeight Long,目标矩形的宽度和高度,以逻辑坐标表示 
    hSrcDC Long,源设备场景。如光栅运算未指定一个源,则这个参数应为零 
    xSrc,ySrc Long,用源DC的逻辑坐标表示的源矩形左上角位置 
    nSrcWidth,nSrcHeight Long,分别指定用逻辑单位(以源DC为基础)传输的一幅图象的宽度和高度。如其中有一个参数的符号(指正负号)与对应的目标参数不符,位图就会在对应的轴上作镜像转换处理 
    dwRop Long,传输过程中进行的光栅运算。如刷子属于光栅运算的一部分,就使用选入目标DC的刷子 
      

  4.   

    在pivtureBox 内加一个 image控件, 将其拉伸属性设为 true. 
    把pivtureBox设为同窗体一样大
      

  5.   

    TO :DeityFox(神狐) 能给一列子吗?
      

  6.   

    add image1,command1
    Private Sub Command1_Click()
        Dim preImgWidth As Long
        Dim preImgHeight As Long
        Dim WndWidth As Long
        Dim WndHeight As Long
        Dim WRatio As Double
        Dim HRatio As Double
        Dim Ratio As Double
        Dim preScaleMode As Integer
        preScaleMode = Form1.ScaleMode
        Form1.ScaleMode = 1
        Image1.Stretch = False
        'Image1.Visible = False
        Image1.Picture = LoadPicture("d:\my pictures\06722.jpg")
        Image1.Stretch = True
        preImgWidth = Image1.Width
        preImgHeight = Image1.Height
        WndWidth = Form1.ScaleWidth
        WndHeight = Form1.ScaleHeight
        WRatio = WndWidth / preImgWidth
        HRatio = WndHeight / preImgHeight
        If WRatio > HRatio Then Ratio = HRatio
        If Ratio < 1 Then
            Image1.Width = preImgWidth * Ratio
            Image1.Height = preImgHeight * Ratio
        End If
        Image1.Move (Form1.ScaleWidth - Image1.Width) / 2, (Form1.ScaleHeight - Image1.Height) / 2
        Image1.Visible = True
        Form1.ScaleMode = preScaleMode
        
    End Sub
      

  7.   

    add image1,command1
    Private Sub Command1_Click()
        Dim preImgWidth As Long
        Dim preImgHeight As Long
        Dim WndWidth As Long
        Dim WndHeight As Long
        Dim WRatio As Double
        Dim HRatio As Double
        Dim Ratio As Double
        Dim preScaleMode As Integer
        preScaleMode = Form1.ScaleMode
        Form1.ScaleMode = 1
        Image1.Stretch = False
        'Image1.Visible = False
        Image1.Picture = LoadPicture("d:\my pictures\06722.jpg")
        Image1.Stretch = True
        preImgWidth = Image1.Width
        preImgHeight = Image1.Height
        WndWidth = Form1.ScaleWidth
        WndHeight = Form1.ScaleHeight
        WRatio = WndWidth / preImgWidth
        HRatio = WndHeight / preImgHeight
        If WRatio > HRatio Then Ratio = HRatio
        If Ratio < 1 Then
            Image1.Width = preImgWidth * Ratio
            Image1.Height = preImgHeight * Ratio
        End If
        Image1.Move (Form1.ScaleWidth - Image1.Width) / 2, (Form1.ScaleHeight - Image1.Height) / 2
        Image1.Visible = True
        Form1.ScaleMode = preScaleMode
        
    End Sub
      

  8.   

    to yangzhaoyu(老妖) ,谢谢,可以说一下原理吗?
      

  9.   

    修正
    If WRatio > HRatio Then 
        Ratio = HRatio
    Else
        Ratio=WRatio
    End if    preImgWidth 图的实际宽度
        preImgHeight 图的实际高度
        WndWidth 窗口的宽度
        WndHeight 窗口的高度
        WRatio  图与窗口的宽度比    HRatio  图与窗口的高度比
        Ratio 图全部显示的比例
        图大于窗口时(Ratio>1)对图进行缩放
      

  10.   

     图大于窗口时(Ratio<1)对图进行缩放 
      

  11.   

    图大于窗口时(Ratio<1)对图进行缩放 
      

  12.   

    不必要这么麻烦了,上面老兄说得对,用image什么都能解决,不过要把image的。stretch属性设置为TRUE
      

  13.   

    用image控件,大小设为窗口大小.