Try If OpenFD.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox3.Image = Image.FromFile(OpenFD.FileName) Dim NewSize As New Size(800, 600) ResizedImage = New Bitmap(PictureBox3.Image, NewSize) PictureBox3.Image = ResizedImage PictureBox3.BackgroundImageLayout = ImageLayout.Stretch End If If PictureBox3.Image Is Nothing Then Exit Sub End If Dim i As Integer = Me.Panel2.Controls.Count - 1 Dim x1 As Integer Dim y1 As Integer If i = -1 Then x1 = Panel2.Location.X + 10 y1 = Panel2.Location.Y + 10 Else x1 = Panel2.Controls(i).Location.X + 110 y1 = Panel2.Controls(i).Location.Y End If If x1 < Panel2.Width - 50 Then x1 = Panel2.Location.X + 10 y1 = Panel2.Controls(i).Location.Y + 110 End If Dim ctlLocation As New Point(x1, y1) Dim ctrl As New PictureBox ctrl.Image = PictureBox3.Image ctrl.Location = ctlLocation ctrl.Size = New Size(100, 100) ctrl.SizeMode = PictureBoxSizeMode.StretchImage ctrl.BorderStyle = BorderStyle.FixedSingle Me.Panel2.Controls.Add(ctrl) PictureBox3.Image = Nothing AddHandler ctrl.Click, AddressOf ClickHandler1 Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "بروز خطا،لطفا دوباه سعی کنید") End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)