Как вызвать класс на кнопку в C#
Я пытаюсь назвать этот класс :
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace tes_skripsi { class RGB2HSV { public int[] ApplyFilter(int red, int green, int blue) { int[] Results = new int[3]; int HSV_H = 0; int HSV_S = 0; int HSV_V = 0; double MaxHSV = (double)(Math.Max(red, Math.Max(green, blue))); double MinHSV = (double)(Math.Min(red, Math.Min(green, blue))); // V HSV_V = (int)(MaxHSV); // S HSV_S = 0; if (MaxHSV != 0) HSV_S = (int)(255 - 255 * (MinHSV / MaxHSV)); // H if (MaxHSV != MinHSV) { int IntegerMaxHSV = (int)(MaxHSV); if (IntegerMaxHSV == red && green >= blue) { HSV_H = (int)(60 * (green - blue) / (MaxHSV - MinHSV)); } else if (IntegerMaxHSV == red && green < blue) { HSV_H = (int)(359 + 60 * (green - blue) / (MaxHSV - MinHSV)); } else if (IntegerMaxHSV == green) { HSV_H = (int)(119 + 60 * (blue - red) / (MaxHSV - MinHSV)); } else if (IntegerMaxHSV == blue) { HSV_H = (int)(239 + 60 * (red - green) / (MaxHSV - MinHSV)); } } else HSV_H = 0; Results[0] = HSV_H; Results[1] = HSV_S; Results[2] = HSV_V; return (Results); } } }
в эту кнопку :
private void button2_Click(object sender, EventArgs e) { Bitmap Temp = new Bitmap(File); //warna = RGB2HSV(Temp); //pictureBox2.Image = warna; if (pictureBox2.Image != null) return; else HSVColor(); }
что же мне делать? Любая помощь будет оценена по достоинству. Спасибо.
Что я уже пробовал:
я уже пробовал это. но все равно не получится
private void button2_Click(object sender, EventArgs e) { Bitmap Temp = new Bitmap(File); RGB2HSV warna = new RGB2HSV(); warna = RGB2HSV(); pictureBox2.Image = warna; }