예제 #1
0
        //Button控件click事件,切换前景颜色,需要两个标志位
        public static void Click_ChangeForeColor_Two_Address(Control control, int addressOn, int addressOff, Color oriColor, Color changeColor)
        {
            bool on  = Class_ShareMem.Get_M(addressOn) == 1;
            bool off = Class_ShareMem.Get_M(addressOff) == 1;

            if (on)
            {
                control.BackColor = changeColor;
                Class_ShareMem.Set_M(addressOn, false);
            }
            if (off)
            {
                control.BackColor = oriColor;
                Class_ShareMem.Set_M(addressOn, false);
            }
        }
예제 #2
0
        //Button控件click事件,切换背景图片,需要两个标志位
        public static void Click_ChangeBackgroundImage_Two_Address(Control control, int addressOn, int addressOff, Image oriImage, Image changeImage)
        {
            bool on  = Class_ShareMem.Get_M(addressOn) == 1;
            bool off = Class_ShareMem.Get_M(addressOff) == 1;

            if (on)
            {
                control.BackgroundImage = changeImage;
                Class_ShareMem.Set_M(addressOn, false);
            }
            if (off)
            {
                control.BackgroundImage = oriImage;
                Class_ShareMem.Set_M(addressOn, false);
            }
        }
예제 #3
0
        /// <summary>
        /// 读取指定M地址
        /// </summary>
        /// <param name="pos"></param>
        /// <returns></returns>
        public static bool GetM(int pos)
        {
            int value = Class_ShareMem.Get_M(pos);

            return(value == 1 ? true : false);
        }