Пример #1
0
        /// <summary>
        /// Dialog template representation in a standard text format.
        /// </summary>
        /// <returns>Multiline string.</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format("{0}, {1}, {2}, {3}", x, y, x + cx, y + cy));

            string style = DialogTemplateUtil.StyleToString <User32.WindowStyles, User32.DialogStyles>(Style);

            if (!string.IsNullOrEmpty(style))
            {
                sb.AppendLine("STYLE " + style);
            }

            string exstyle = DialogTemplateUtil.StyleToString <User32.WindowStyles, User32.ExtendedDialogStyles>(ExtendedStyle);

            if (!string.IsNullOrEmpty(exstyle))
            {
                sb.AppendLine("EXSTYLE " + exstyle);
            }

            sb.AppendLine(string.Format("CAPTION \"{0}\"", _caption));
            sb.AppendLine(string.Format("FONT {0}, \"{1}\"", _pointSize, _typeface));

            if (_controls.Count > 0)
            {
                sb.AppendLine("{");
                foreach (DialogTemplateControlBase control in _controls)
                {
                    sb.AppendLine(" " + control.ToString());
                }
                sb.AppendLine("}");
            }

            return(sb.ToString());
        }
Пример #2
0
        /// <summary>
        /// Return a string representation of the dialog control.
        /// </summary>
        /// <returns>A single line in the "CLASS name id, dimensions and styles' format.</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0} \"{1}\" {2}, {3}, {4}, {5}, {6}, {7}, {8}",
                            ControlClass, CaptionId, Id, ControlClass, x, y, cx, cy,
                            DialogTemplateUtil.StyleToString <User32.WindowStyles, User32.StaticControlStyles>(Style, ExtendedStyle));

            switch (ControlClass)
            {
            case User32.DialogItemClass.Button:
                sb.AppendFormat("| {0}", (User32.ButtonControlStyles)(Style & 0xFFFF));
                break;

            case User32.DialogItemClass.Edit:
                sb.AppendFormat("| {0}", DialogTemplateUtil.StyleToString <User32.EditControlStyles>(Style & 0xFFFF));
                break;
            }

            return(sb.ToString());
        }