Resim göstermek için bir UserControl

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Unutulan Değil iz bırakan OL!
Süper Üye
Katılım
19 Mar 2016
Mesajlar
1,329
Tepki puanı
22
Ödüller
10
Yaş
94
10 HİZMET YILI
Yeni bir user control oluşturun adını imageresize yapın ve aşağıdaki componentleri içine ekleyin...
'-> 1 adet textbox
'-> 1 adet image
'----------------------------------------------------------------------------------------------------
'-> text1 In visible özelliğini False yapın
'->image1 In stretch=True , Height=3000 , Width=4000, Left=0, top= 0
'->imageresize width=90 , height=90, backstyle=Transparent

'Kod:
'------------------------------------------------------------------------------------------------------

Private Sub Text1_Change()
If Text1.Text <> "" Then
Image1.Picture = LoadPicture(Text1.Text)
End If
boyutlandır
End Sub
Private Sub UserControl_Initialize()
boyutlandır
End Sub
Public Property Get resim() As String
resim = Text1.Text
End Property
Public Property Let resim(ByVal vNewValue As String)
Text1.Text = vNewValue
End Property
Private Sub boyutlandır()
Image1.Stretch = False
If Image1.Width > UserControl.Width / 1000 Then
If Image1.Height > UserControl.Height / 1000 Then
If Image1.Width / Image1.Height > UserControl.Width / UserControl.Height Then
a = Image1.Width / UserControl.Width
Image1.Stretch = True
Image1.Width = Image1.Width / a
Image1.Height = Image1.Height / a
Else
b = Image1.Height / UserControl.Height
Image1.Stretch = True
Image1.Width = Image1.Width / b
Image1.Height = Image1.Height / b
End If
Else
c = Image1.Width / UserControl.Width
Image1.Stretch = True
Image1.Width = Image1.Width / c
Image1.Height = Image1.Height / c
End If
Else
If Image1.Height > UserControl.Height / 1000 Then
If Image1.Width / Image1.Height > UserControl.Width / UserControl.Height Then
d = Image1.Width / UserControl.Width
Image1.Stretch = True
Image1.Width = Image1.Width / d
Image1.Height = Image1.Height / d
Else
e = Image1.Height / UserControl.Height
Image1.Stretch = True
Image1.Width = Image1.Width / e
Image1.Height = Image1.Height / e
End If
Else
f = Image1.Width / UserControl.Width
Image1.Stretch = True
Image1.Width = Image1.Width / f
Image1.Height = Image1.Height / f
End If
End If
Image1.Top = (UserControl.Height - Image1.Height) / 2
Image1.Left = (UserControl.Width - Image1.Width) / 2
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst