protected new void Initialize(CodeActivityContext context)
        {
            base.Initialize(context);

            bold      = Bold;
            italic    = Italic;
            underline = Underline;
            font      = Font.ToString();
            fontColor = FontColor.ToString();
            fontSize  = FontSize.Get(context);
            //if (fontSize == 0) fontSize = 5;
        }
Exemplo n.º 2
0
        public void Save(System.IO.FileStream fs, System.Xml.XmlWriter fi)
        {
            UInt16 eSize = (UInt16)(Text.Length + 14);

            utftUtils.Save2Bytes(fs, eSize);
            fs.WriteByte((byte)GetItemTypeNumber());
            fs.WriteByte(ID);
            utftUtils.Save2Bytes(fs, (UInt16)X);
            utftUtils.Save2Bytes(fs, (UInt16)Y);
            fs.WriteByte((byte)width);
            fs.WriteByte((byte)heigth);
            UInt16 clr = utftUtils.GetUTFTColorBytes(BackColor);

            utftUtils.Save2Bytes(fs, clr);
            clr = utftUtils.GetUTFTColorBytes(FontColor);
            utftUtils.Save2Bytes(fs, clr);
            fs.WriteByte(Convert.ToByte(_canSelect));
            fs.WriteByte((byte)Text.Length);
            char[] arr = Text.ToCharArray();
            for (int i = 0; i < Text.Length; i++)
            {
                fs.WriteByte((byte)arr[i]);
            }

            fi.WriteStartElement("Element");
            fi.WriteElementString("ItemType", ItemType);
            fi.WriteElementString("ID", ID.ToString());
            fi.WriteElementString("X", X.ToString());
            fi.WriteElementString("Y", Y.ToString());
            fi.WriteElementString("Width", width.ToString());
            fi.WriteElementString("Height", heigth.ToString());
            fi.WriteElementString("BackColor", BackColor.ToString());
            fi.WriteElementString("FontColor", FontColor.ToString());
            fi.WriteElementString("CanSelect", CanSelect.ToString());
            fi.WriteElementString("Text", Text);
            fi.WriteElementString("ItemName", ItemName);
            fi.WriteEndElement();
        }
Exemplo n.º 3
0
        public void Save(string MainFileName)
        {
            if (MainFileName.Substring(MainFileName.Length - 4) != ".scr")
            {
                MainFileName = MainFileName + ".scr";
            }
            string IDsFileName  = MainFileName.Substring(0, MainFileName.Length - 4) + ".ids";
            string DefsFileName = IDsFileName.Substring(0, IDsFileName.Length - 4) + ".h";

            System.IO.FileStream   fs = new System.IO.FileStream(MainFileName, System.IO.FileMode.Create);
            System.Xml.XmlWriter   fi = System.Xml.XmlWriter.Create(IDsFileName);
            System.IO.StreamWriter fd = new System.IO.StreamWriter(DefsFileName);

            //pnl.Image.Save(null, System.Drawing.Imaging.ImageFormat.Bmp);
            fi.WriteStartDocument();
            fi.WriteStartElement("Document");
            fi.WriteStartElement("Screen");
            fi.WriteElementString("SCREEN_Width", Width.ToString());
            fi.WriteElementString("SCREEN_Height", Height.ToString());
            fi.WriteElementString("SCREEN_BackColor", BackColor.ToString());
            fi.WriteElementString("SCREEN_FontColor", FontColor.ToString());
            fi.WriteElementString("SCREEN_ABorderColor", ActiveBorderColor.ToString());
            fi.WriteElementString("SCREEN_PBorderColor", PassiveBorderColor.ToString());
            if (pnl.Image != null)
            {
                string aname = String.Format("{0}\\{1}", System.IO.Path.GetDirectoryName(MainFileName), ScreenName);
                utftUtils.SaveRAWImage(aname, pnl.Image);
                fi.WriteElementString("Desctop", ScreenName);
            }
            fi.WriteEndElement();

            byte lbl = 0;
            byte btn = 0;

            foreach (KeyValuePair <string, TInterfaceElement> e in listitem)
            {
                if (e.Value.GetItemTypeNumber() == 3)
                {
                    e.Value.ID = lbl++;
                }
                else
                {
                    e.Value.ID = btn++;
                }
            }
            fs.WriteByte((byte)(13 + ScreenName.Length));// размер данных экрана
            utftUtils.Save2Bytes(fs, (UInt16)Width);
            utftUtils.Save2Bytes(fs, (UInt16)Height);

            UInt16 clr = utftUtils.GetUTFTColorBytes(BackColor);

            utftUtils.Save2Bytes(fs, clr);
            clr = utftUtils.GetUTFTColorBytes(FontColor);
            utftUtils.Save2Bytes(fs, clr);
            clr = utftUtils.GetUTFTColorBytes(ActiveBorderColor);
            utftUtils.Save2Bytes(fs, clr);
            clr = utftUtils.GetUTFTColorBytes(PassiveBorderColor);
            utftUtils.Save2Bytes(fs, clr);

            fs.WriteByte((byte)lbl);
            fs.WriteByte((byte)btn);
            fs.WriteByte((byte)ScreenName.Length);
            for (int i = 0; i < ScreenName.Length; i++)
            {
                fs.WriteByte(Convert.ToByte(ScreenName[i]));
            }
            fi.WriteStartElement("Elements");

            foreach (KeyValuePair <string, TInterfaceElement> e in listitem)
            {
                e.Value.Save(fs, fi);
                if (e.Value.ItemType != "Label")
                {
                    fd.WriteLine(String.Format("#define {0} {1}", e.Value.ItemName, e.Value.ID));
                }
            }

            fi.WriteEndElement();

            fi.WriteEndElement();
            fi.WriteEndDocument();

            fs.Close();
            fi.Close();
            fd.Close();

            fs.Dispose();
            fd.Dispose();
        }