예제 #1
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);
            }
        }
예제 #2
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);
            }
        }
예제 #3
0
 /// <summary>
 /// 往指定M设假
 /// </summary>
 /// <param name="pos"></param>
 public static void BitOffM(int pos)
 {
     Class_ShareMem.Set_M(pos, false);
 }
예제 #4
0
 /// <summary>
 /// 往指定M设真
 /// </summary>
 /// <param name="pos"></param>
 public static void BitOnM(int pos)
 {
     Class_ShareMem.Set_M(pos, true);
 }
예제 #5
0
 private void button2_Click(object sender, EventArgs e)
 {
     Class_ShareMem.Set_M(IMP_Address.M20000, true);
     Class_ShareMem.Set_M(IMP_Address.M10000, true);
 }