Görüntüyü elle çevirmek istiyorum, iki resim kutuluyorum, orijinal görüntüyü 1 kutuya yüklerim ve başka bir yerde çalışırım, çalıştığım algoritma orijinal görüntüyü başlangıç pikseli pikselinden okumaktır. Bu pikseli boş bir görüntünün sağ üst köşesine koyup, kodum çalışmıyor, her ne yaparsam yapsın, her zaman bir istisna atarım> _ < Sadece numaralı çağrı ile ilgili ayrıntılar için bu mesajın son bölümüne bakın. Bu iletişim kutusu yerine zaman (JIT) hata ayıklama.El ile Görüntü Çevirme Kodu C#
************** İstisna Metin ************** System.ArgumentOutOfRangeException: Parametre pozitif ve < Yükseklik olmalıdır. Parametre adı: c ImageFlip.Form1.flip (bit eşlem görüntüsü) ile System.Drawing.Bitmap.GetPixel (Int32 x, ınt32 y) de y : \ kullanıcı \ ahsan belgeler görsel stüdyo \ \ 2015 Projeler \ \ ImageFlip \ Form1.cs: Line 43 , ImageFlip.Form1.button2_Click (Object sender, EventArgs e) c: \ users \ ahsan \ documents \ visual studio 2015 \ Projects \ ImageFlip \ Form1.cs: satır 54 Sistem'de. System.Windows.Forms.Control de System.Windows.Forms.Button.OnClick de Windows.Forms.Control.OnClick (EventArgs e) (EventArgs e) System.Windows.Forms.Button.OnMouseUp de (MouseEventArgs mevent) .WmMouseUp (Message & m, MouseButtons düğmesi, Int32 tıklamaları) Sys'de Sistem en tem.Windows.Forms.Control.WndProc (Mesaj & m) System.Windows.Forms.ButtonBase.WndProc de (Message & m) System.Windows.Forms.Button.WndProc de (Message & m) . Windows.Forms.Control.ControlNativeWindow.OnMessage (Mesaj & m) System.Windows.Forms.Control.ControlNativeWindow.WndProc de (Message & m) System.Windows.Forms.NativeWindow.Callback (ıntptr hWnd, ınt32 MSG de , ıntptr wParam, ıntptr lparam) buraya
o
olduğunu Sen den 0 < = image.width (ve yükseklik) Sen 0'dan yerine < image.width (ve yükseklik) gidiş düşünmelisinizşekilde iki yöne hareket ediyoruz
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ImageFlip
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap temp;
OpenFileDialog Dialog = new OpenFileDialog();
Dialog.Title = "Open an image file";
if (Dialog.ShowDialog() == DialogResult.OK)
pictureBox1.Image = System.Drawing.Image.FromFile(Dialog.FileName);
temp = (Bitmap)pictureBox1.Image;
}
private Bitmap flip (Bitmap image)
{
Bitmap tp = new Bitmap(image.Width, image.Height);
int x, y;
int w=image.Width, h=image.Height;
int w = 100, h = 100;
//MessageBox.Show(image.Width.ToString());
//MessageBox.Show(image.Height.ToString());
Color pix;
for (x = 0; x <= image.Width; x++)
{
for (y = 0; y <= image.Height; y++)
{
pix = image.GetPixel(x, y);
tp.SetPixel(w, h, pix);
h--;
}
w--;
}
return tp;
}
private void button2_Click(object sender, EventArgs e)
{
pictureBox2.Image = flip((Bitmap)pictureBox1.Image);
}
}
}
İstisna nedir? Lütfen bu soruyu –
'a uygulayın. Bu iletişim kutusu yerine tam zamanında (JIT) hata ayıklama hakkında bilgi almak için bu iletinin sonuna bakın. ************** İstisna Metni ************** System.ArgumentOutOfRangeException: Parametre pozitif ve
w ve 99 ve 100 değil misin? (for-döngüleriniz 0-99 arası) –