Esempio n. 1
0
        /// <summary>
        /// Creates all text fields for an MFD panel (28 items)
        /// Copies the display attributes from the prototype TextItem
        /// </summary>
        /// <param name="labels">The list of labels to print (takes from the beginning as long as it lasts if not 28 provided)</param>
        /// <returns>A TextItem("LABELS") containing all labels as SubItemList</returns>
        public static TextItem LabelList(TextItem prototype, Dictionary <string, string> labels)
        {
            var list = new DisplayList( );
            // create an item that just carries the sublist of text items
            var ret = new TextItem( )
            {
                Key = c_LabelKey, String = "", // no show item
            };

            TextItem item = null; // sub item to add

            //setup the label rectangles
            for (int i = 0; i < labels.Count; i++)
            {
                item           = prototype.Clone( );
                item.Key       = labels.ElementAt(i).Key;
                item.String    = labels.ElementAt(i).Value;
                item.Rectangle = MfdLabelRect[i];
                item.StringFormat.Alignment = MfdLabelStringAlignment[i];
                list.AddItem(item);
            }

            // finally add the stuff and return
            ret.SubItemList.AddRange(list);
            return(ret);
        }