private void btnApplyMedian_Click(object sender, EventArgs e) { int maskSizeXInt, maskSizeYInt; maskSize maskSizeX = (maskSize)cbMedianX.SelectedIndex; maskSize maskSizeY = (maskSize)cbMedianY.SelectedIndex; edgeMethods edgeMethod = (edgeMethods)cbEdgeMethods.SelectedIndex; Int32.TryParse(cbMedianX.SelectedItem.ToString(), out maskSizeXInt); Int32.TryParse(cbMedianY.SelectedItem.ToString(), out maskSizeYInt); mainImage.MedianOnImage(maskSizeX, maskSizeY, maskSizeXInt, maskSizeYInt, edgeMethod, (int)userPixel); InvalidateImage(); }