accessing two struct members in a fuction from a windows form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Balzy
    New Member
    • Apr 2015
    • 1

    accessing two struct members in a fuction from a windows form

    i have a function in which i used a struct to return it two values. now i want to call the function to work from a form and i have a problems with the function.
    here are the codes:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    public struct TriAnaSplit
    {
        public int col1;
        public int col2;
    };
    
     public TriAnaSplit Triadic(int pivotcolor)
            {
    
                int TestVar1, TestVar2, pluscolor, mincolor;
                TriAnaSplit Tri_val;
                TestVar1 = pivotcolor + 120;
                if (TestVar1 <= 360)
                    pluscolor = TestVar1;
                else
                    pluscolor = TestVar1 - 360;
    
                TestVar2 = pivotcolor - 120;
                if (TestVar2 >= 0)
                    mincolor = TestVar2;
                else
                    mincolor = 360 - Math.Abs(TestVar2);
    
                Tri_val.col1 = pluscolor;
                Tri_val.col2 = mincolor;
    
                return Tri_val;
            }
    Last edited by Rabbit; Apr 2 '15, 03:31 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...