Beispiel #1
0
        //----------------------------------------------------------------------------------------
        private void DrawMemo(Graphics g, int frame)
        {
            int x0 = 0;
            int y0 = frame * tsd.CellHeight - tsg.OffsetY;
            int w  = tsd.MemoWidth;
            int h  = tsd.CellHeight;
            int x1 = x0 + w;
            int y1 = y0 + h;

            //画面外なら何もしない
            if ((x0 > this.Width) || (x1 < 0) || (y0 > this.Height) || (y1 < 0))
            {
                return;
            }
            SolidBrush b   = new SolidBrush(cols.MemoBase);
            Pen        p   = new Pen(cols.MemoLine, 1);
            Rectangle  rct = new Rectangle(x0, y0, w, h);
            int        frm = frame + tsd.FrameOffset;

            try
            {
                bool n = (tsd.FrameEnabeld(frame) < 0);
                if (n)
                {
                    b.Color = cols.None;
                }
                //セルを背景色で塗る
                g.FillRectangle(b, x0, y0, tsd.MemoWidth, tsd.CellHeight);

                string s = tsd.Memo(frame);
                if (s != "")
                {
                    b = new SolidBrush(cols.Text);
                    if (n)
                    {
                        b.Color = cols.NoneText;
                    }
                    Rectangle rct1 = new Rectangle(x0 + 6, y0, w - 4, h);
                    g.DrawString(s, this.Font, b, rct1, format);
                }
                //横線
                g.DrawLine(p, x0, y0, x1, y0);
                if (((frm + 1) % (int)tsd.FrameRate) == 0)
                {
                    p.Width = 2;
                    g.DrawLine(p, x0, y1 - 1, x1, y1 - 1);
                }
                else if (((frm + 1) % tsd.HorLine) == 0)
                {
                    p.Width = 1;
                    g.DrawLine(p, x0, y1 - 1, x1, y1 - 1);
                }
            }
            finally
            {
                b.Dispose();
                p.Dispose();
            }
        }
Beispiel #2
0
        //----------------------------------------------------------
        public List <string> SetSaveData( )
        {
            List <string> lines = new List <string>();

            if (data == null)
            {
                return(lines);
            }
            //ヘッダー
            lines.Add(D_Header);
            lines.Add("");
            //コメント
            lines.Add(D_Comment);
            if (data.Comment.Count > 0)
            {
                foreach (string s in data.Comment)
                {
                    lines.Add(s);
                }
            }
            lines.Add("");
            //パラメータブロック
            data.ChkTimes();
            lines.Add(D_Param);
            data.ToParams();
            foreach (ard_prms p in data.Params)
            {
                lines.Add(p.Tag + TAB + p.Value);
            }
            lines.Add("");
            //CellName
            lines.Add(D_CellName);
            for (int i = 0; i < data.CellCount; i++)
            {
                string s = i.ToString() + TAB + data.CellCaption(i);
                lines.Add(s);
            }
            lines.Add("");
            //Memo
            lines.Add(D_Memo);
            for (int i = 0; i < data.FrameCount; i++)
            {
                string s = data.Memo(i);
                if (s != string.Empty)
                {
                    s = FrameStr(i + 1) + TAB + s;
                    lines.Add(s);
                }
            }
            lines.Add("");
            //FrameEnabled
            lines.Add(D_FrameEnabled);
            int[] fe = data.getFrameEnabled();
            for (int i = 0; i < fe.Length; i++)
            {
                if (fe[i] < 0)
                {
                    fe[i] = 1;
                }
                else
                {
                    fe[i] = 0;
                }
            }

            lines.Add(FrameStr(1) + TAB + fe[0].ToString());
            for (int i = 1; i < fe.Length; i++)
            {
                if (fe[i - 1] != fe[i])
                {
                    lines.Add(FrameStr(i + 1) + TAB + fe[i].ToString());
                }
            }
            lines.Add("");
            //cellData
            lines.Add(D_CellDataStart);
            for (int i = 0; i < data.CellCount; i++)
            {
                if (data.IsCellData(i))
                {
                    lines.Add(D_Cell + TAB + i.ToString());
                    int c = data.GetCellData(i, 0);
                    lines.Add(FrameStr(1) + TAB + c.ToString());
                    int bef = c;
                    for (int frm = 1; frm < data.FrameCount; frm++)
                    {
                        c = data.GetCellData(i, frm);
                        if (c != bef)
                        {
                            lines.Add(FrameStr(frm + 1) + TAB + c.ToString());
                        }
                        bef = c;
                    }
                    lines.Add(D_CellEnd + TAB + i.ToString());
                }
            }
            lines.Add(D_End);
            return(lines);
        }