Помогите пожайлуста кто-нибудь, целый месяц уже бьюсь не могу разобраться программой на Vusial Basic 2005 для слияния двух изображений. У меня при компеляции появляется ошибка: Image is not a member of MergedImage/ Подскажите пожалуйста как исправить данную ошибку, программа приведена ниже:
| Код | Public Class Form1 Private SourceImages(1) As Bitmap Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim counter As Integer Dim locateFile As New OpenFileDialog Me.Show() locateFile.Filter = "JPG files (*.jpg)|*.jpg" For counter = 0 To 1 If (locateFile.ShowDialog() <> Windows.Forms.DialogResult.OK) Then Me.Close() Return End If SourceImages(counter) = New Bitmap(locateFile.FileName) Next counter DoMergeImages() End Sub
Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed End End Sub Private Sub DoMergeImages() Dim workBitmap As Bitmap Dim across As Integer Dim down As Integer Dim firstColor As Color Dim secondColor As Color Dim mixedColor As Color Dim redPart As Integer Dim greenPart As Integer Dim bluePart As Integer Dim canvas As Graphics workBitmap = SourceImages(0) canvas = Graphics.FromImage(workBitmap) For down = 0 To SourceImages(0).Height - 1 For across = 0 To SourceImages(0).Width - 1 Try firstColor = SourceImages(0).GetPixel(across, down) secondColor = SourceImages(1).GetPixel(across, down) Catch Continue For End Try redPart = (CInt(firstColor.R) + secondColor.R) \ 2 greenPart = (CInt(firstColor.G) + secondColor.G) \ 2 bluePart = (CInt(firstColor.B) + secondColor.B) \ 2 mixedColor = Color.FromArgb(redPart, greenPart, bluePart) workBitmap.SetPixel(across, down, mixedColor) Next across MergedImage.Image = workBitmap Application.DoEvents() Next down canvas.Dispose() End Sub End Class
|
|