ต้องการ ย่อ ขยาย รูปภาพ ผ่าน ฟอร์ม ทำไงครับ
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 250   1
URL.หัวข้อ / URL
ต้องการ ย่อ ขยาย รูปภาพ ผ่าน ฟอร์ม ทำไงครับ

ต้องการ ย่อ ขยาย รูปภาพ ผ่าน ฟอร์ม ทำไงครับ
จะทำแบบไหนก็ได้ ใครก็ได้ครับช่วยหน่อย

1 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R02031
หมายถึง ต้องการที่จะแสดงภาพให้ใหญ่หรือเล็กในหน้าจอใช่มั๊ยครับ

ให้ลองเปลี่ยนโค้ดต่อไปนี้ในฟอร์ม frmPersonalData จากตัวอย่างเดิม ShowPic2.zip ถ้ายังไม่มี ให้ไปเอาที่ http://agserver.kku.ac.th/basiceng/Computer/download/ShowPic.zip

ซึ่งจะต้องเพิ่มปุ่ม Command Buttons เข้าไป 2 ปุ่ม โดยตั้งชื่อให้เป็น cmdZoomIn และ cmdZoomOut

ลองดูครับ

Dim intSecH As Long, intPictW As Long, intPictH As Long, intLeft As Long

Private Sub cmdZoomIn_Click()
With Me.Pict
.Width = intPictW
.Height = intPictH
.Left = intLeft
End With
Me.Section(acDetail).Height = intSecH
Caption = Me.Pict.Width & " " & Me.Pict.Left & " " & Me.Section(acDetail).Height
End Sub

Private Sub cmdZoomOut_Click()
Me.Section(acDetail).Height = intSecH * 1.6
With Me.Pict
.Width = intPictW * 2
.Height = intPictH * 2
.Left = intLeft - (intPictW / 2)
End With
Caption = Me.Pict.Width & " " & Me.Pict.Left & " " & Me.Section(acDetail).Height
End Sub

Private Sub Form_Current()
On Error Resume Next
If Me.NicName = "" Or IsNull(Me.NicName) Then
Me.PicName = ""
Me.Pict.Picture = ""
Else
Me.PicName = ap_AppDir & Me.NicName & ".JPG"
Me.Pict.Picture = Me.PicName
End If
End Sub

Private Sub Form_Load()
On Error Resume Next
If Me.NicName = "" Or IsNull(Me.NicName) Then
Me.PicName = ""
Me.Pict.Picture = ""
Else
Me.PicName = ap_AppDir & Me.NicName & ".JPG"
Me.Pict.Picture = Me.PicName
End If

intSecH = Me.Section(acDetail).Height
intPictW = Me.Pict.Width
intPictH = Me.Pict.Height
intLeft = Me.Pict.Left
End Sub
*** Edited by Supap Chaiya *** 25/3/2546 12:09:56
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0522s