예제 #1
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount = pageArrayBin.pageCount;
            UInt32 areaCount = pageArrayBin.pageArray[pageCount].areaNum++;

            if (pageArrayBin.pageArray[pageCount].m_area == null)
            {
                pageArrayBin.pageArray[pageCount].m_area = new AreaBin[SVLimit.PAGE_AREA_MAXNUM];
            }

            AreaBin areaBin = pageArrayBin.pageArray[pageCount].m_area[areaCount];

            areaBin.id      = ID;
            areaBin.rect.sX = (UInt16)Rect.X;
            areaBin.rect.sY = (UInt16)Rect.Y;
            areaBin.rect.eX = (UInt16)(Rect.Width + areaBin.rect.sX);
            areaBin.rect.eY = (UInt16)(Rect.Height + areaBin.rect.sY);

            areaBin.fontClr = (UInt32)FrontColorground.ToArgb();
            areaBin.bgClr   = (UInt32)BackColorground.ToArgb();

            areaBin.text = new Byte[SVLimit.TEXT_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(Text), areaBin.text);

            areaBin.font        = (Byte)_font.Size;
            areaBin.align       = Align;
            areaBin.transparent = Transparent ? (Byte)1 : (Byte)0;

            pageArrayBin.pageArray[pageCount].m_area[areaCount] = areaBin;
        }
예제 #2
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageNum = pageArrayBin.pageCount;
            UInt32 btnNum  = pageArrayBin.pageArray[pageNum].btnNum++;

            if (pageArrayBin.pageArray[pageNum].m_btn == null)
            {
                pageArrayBin.pageArray[pageNum].m_btn = new ButtonBin[SVLimit.PAGE_BTN_MAXNUM];
            }

            ButtonBin btnBin = pageArrayBin.pageArray[pageNum].m_btn[btnNum];

            btnBin.id      = ID;
            btnBin.rect.sX = (UInt16)Rect.X;
            btnBin.rect.sY = (UInt16)Rect.Y;
            btnBin.rect.eX = (UInt16)(Rect.Width + btnBin.rect.sX);
            btnBin.rect.eY = (UInt16)(Rect.Height + btnBin.rect.sY);

            btnBin.fontClr = (UInt32)FrontColorground.ToArgb();

            ///为真的文本
            btnBin.text = new Byte[SVLimit.BTN_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(Text), btnBin.text);
            ///为假的文本
            btnBin.fText = new Byte[SVLimit.BTN_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(FText), btnBin.fText);
            ///备注信息
            btnBin.fMemo = new Byte[SVLimit.BTN_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(FMemo), btnBin.fMemo);

            btnBin.font = (Byte)_font.Size;
            //是否有确认窗口
            btnBin.confirm = Comfirm ? (byte)1 : (byte)0;
            //按钮的类型
            if (_buttonType == 0)
            {
                btnBin.type         = 0;
                btnBin.param.pageId = _btnType.PageID;
            }
            else
            {
                var varInstance = SVVaribleType.instance();

                btnBin.param.addrOffset = varInstance.strToAddress(_btnVarText.VarName, _btnVarText.VarBlockType);
                btnBin.varTypeBtn       = (Byte)varInstance.strToType(_btnVarText.VarName, _btnVarText.VarBlockType);
                btnBin.type             = _buttonType;
                btnBin.enable           = Convert.ToByte(_btnEnable);
                btnBin.enableAddrOffset = varInstance.strToAddress(_enVarText.VarName, _enVarText.VarBlockType);
                btnBin.varTypeEn        = (Byte)varInstance.strToType(_enVarText.VarName, _enVarText.VarBlockType);
            }

            ///显示背景图片或者显示背景颜色
            if (!IsShowPic)
            {
                btnBin.bgUpFlag    = 0;
                btnBin.bgDownFlag  = 0;
                btnBin.bgUpColor   = (UInt32)BackColorground.ToArgb();
                btnBin.bgDownColor = (UInt32)BackColorgroundDown.ToArgb();
            }
            else
            {
                btnBin.bgUpFlag   = 1;
                btnBin.bgDownFlag = 1;

                //设置弹起图片

                var upAddress = BtnUpPic.bitmap8Data(Rect.Width, Rect.Height);
                if (upAddress != null)
                {
                    btnBin.bgUpColor = (UInt32)serialize.ToArray().Length;
                    serialize.pack(upAddress);
                }

                //设置按下图片
                var downAddress = BtnDownPic.bitmap8Data(Rect.Width, Rect.Height);
                if (downAddress != null)
                {
                    btnBin.bgDownColor = (UInt32)serialize.ToArray().Length;
                    serialize.pack(downAddress);
                }
            }

            pageArrayBin.pageArray[pageNum].m_btn[btnNum] = btnBin;
        }