Exemplo n.º 1
0
        internal static Size ReadAttributeSize(XmlNode node, string attributeName)
        {
            CheckAttributeExists(node, attributeName);
            string text = node.Attributes[attributeName].Value;

            return(SizeConverter.ConvertFromString(null, System.Globalization.CultureInfo.CurrentCulture, text));
        }
Exemplo n.º 2
0
        private void cmsPredefinedSizes_Opening(object sender, CancelEventArgs e)
        {
            SizeConverter sizeConverter = new SizeConverter();

            foreach (ToolStripItem item in this.cmsPredefinedSizes.Items)
            {
                object tag = item.Tag;
                if (item is ToolStripMenuItem && tag is string)
                {
                    ToolStripMenuItem menuItem = ((ToolStripMenuItem)item);
                    bool      check            = false;
                    Rectangle bounds           = Rectangle.Empty;
                    if (tag.Equals(fullScreenTag))
                    {
                        bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
                    }
                    else
                    {
                        try {
                            Size size = (Size)sizeConverter.ConvertFromString((string)tag);
                            bounds = new Rectangle(this.Location, size);
                        }
                        catch (NotSupportedException) {
                        }
                    }
                    if (bounds.Equals(this.Bounds))
                    {
                        check = true;
                    }
                    menuItem.Checked = check;
                }
            }
        }
Exemplo n.º 3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Verify.IsNotNull(value, "value");
            Verify.IsNotNull(parameter, "parameter");

            var element = (UIElement)value;
            var size    = (Size)_SizeConverter.ConvertFromString((string)parameter);

            return(Utility.GenerateBitmapSource(element, size.Width, size.Height, true));
        }
Exemplo n.º 4
0
        public void ReadXml(XmlReader reader)
        {
            var pointConverter = new PointConverter();
            var sizeConverter  = new SizeConverter();

            reader.Read(); // To skip the starting 'WindowSettings' element
            WindowState    = (FormWindowState)Enum.Parse(typeof(FormWindowState), reader.ReadElementContentAsString());
            Location       = (Point)pointConverter.ConvertFromString(reader.ReadElementContentAsString());
            Size           = (Size)sizeConverter.ConvertFromString(reader.ReadElementContentAsString());
            Zoom           = reader.ReadElementContentAsInt();
            PositionInText = reader.ReadElementContentAsInt();
            reader.Read(); // To skip the ending 'WindowSettings' element
        }
Exemplo n.º 5
0
    public static Size ConvertStringToSize(string size)
    {
        SizeConverter sizeconvertor = new SizeConverter();

        return((Size)sizeconvertor.ConvertFromString(size));
    }
Exemplo n.º 6
0
 public override object ConvertFromInvariantString(string value)
 {
     return(new Wrapper.Size(SizeConverter.ConvertFromString(value)));
 }
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object valueObject)
 {
     return(new SizeWpf(SizeConverter.ConvertFromString(GetValueAsString(valueObject))));
 }