示例#1
0
        /// <summary>
        /// Initializes a new instance of the Form class.
        /// </summary>
        public Form() : base(AvaloniaGlobals.WindowingInterface.CreateWindow())
        {
            TitleBar = Controls.AddImplicitControl(new FormTitleBar());

            Resizeable = true;
            Window.SetSystemDecorations(false);
        }
示例#2
0
        public Form() : base(AvaloniaGlobals.WindowingInterface.CreateWindow())
        {
            TitleBar = Controls.AddImplicitControl(new FormTitleBar());

            Window.SetSystemDecorations(false);

            SetWindowStartupLocation();
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the TabControl class.
        /// </summary>
        public TabControl()
        {
            tab_strip = Controls.AddImplicitControl(new TabStrip {
                Dock = DockStyle.Top
            });

            tab_strip.SelectedTabChanged += TabStrip_SelectedTabChanged;

            TabPages = new TabPageCollection(this, tab_strip);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the Form class.
        /// </summary>
        public Form() : base(AvaloniaGlobals.GetRequiredService <IWindowingPlatform> ().CreateWindow())
        {
            TitleBar = Controls.AddImplicitControl(new FormTitleBar());

            Resizeable = true;
            Window.SetSystemDecorations(SystemDecorations.None);
            Window.SetExtendClientAreaToDecorationsHint(true);

            Window.Closing = () => {
                var args = new CancelEventArgs();

                OnClosing(args);

                return(args.Cancel);
            };

            Window.Resize(new Size(DefaultSize.Width, DefaultSize.Height));
        }
示例#5
0
        public ListBox()
        {
            Items = new ListBoxItemCollection(this);

            Items.CollectionChanged += (o, e) => UpdateVerticalScrollBar();

            vscrollbar = new VerticalScrollBar {
                Minimum     = 0,
                Maximum     = 0,
                SmallChange = 1,
                LargeChange = 1,
                Visible     = false,
                Dock        = DockStyle.Right
            };

            vscrollbar.ValueChanged += VerticalScrollBar_ValueChanged;

            Controls.AddImplicitControl(vscrollbar);
        }
示例#6
0
        public TreeView()
        {
            root_item = new TreeViewItem(this)
            {
                Expanded = true
            };

            vscrollbar = new VerticalScrollBar {
                Minimum     = 0,
                Maximum     = 0,
                SmallChange = 1,
                LargeChange = 1,
                Visible     = false,
                Dock        = DockStyle.Right
            };

            vscrollbar.ValueChanged += VerticalScrollBar_ValueChanged;

            Controls.AddImplicitControl(vscrollbar);
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the FormTitleBar class.
        /// </summary>
        public FormTitleBar()
        {
            Dock = DockStyle.Top;

            SetControlBehavior(ControlBehaviors.InvalidateOnTextChanged);
            SetControlBehavior(ControlBehaviors.Selectable, false);

            minimize_button        = Controls.AddImplicitControl(new TitleBarButton(TitleBarButton.TitleBarButtonGlyph.Minimize));
            minimize_button.Click += (o, e) => {
                var form_min = FindForm();

                if (form_min != null)
                {
                    form_min.WindowState = FormWindowState.Minimized;
                }
            };

            maximize_button        = Controls.AddImplicitControl(new TitleBarButton(TitleBarButton.TitleBarButtonGlyph.Maximize));
            maximize_button.Click += (o, e) => {
                var form = FindForm();

                if (form != null)
                {
                    form.WindowState = form.WindowState == FormWindowState.Maximized ? FormWindowState.Normal : FormWindowState.Maximized;
                }
            };

            close_button        = Controls.AddImplicitControl(new TitleBarButton(TitleBarButton.TitleBarButtonGlyph.Close));
            close_button.Click += (o, e) => { FindForm()?.Close(); };

            form_image = Controls.AddImplicitControl(new PictureBox {
                Width    = DefaultSize.Height,
                Dock     = DockStyle.Left,
                Visible  = false,
                SizeMode = PictureBoxSizeMode.CenterImage
            });

            form_image.Style.BackgroundColor = SKColors.Transparent;
            form_image.SetControlBehavior(ControlBehaviors.ReceivesMouseEvents, false);
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the ScrollControl class.
        /// </summary>
        public ScrollControl()
        {
            sizegrip = Controls.AddImplicitControl(
                new SizeGrip {
                Visible = false,
                Cursor  = Cursors.Arrow
            });

            hscrollbar = Controls.AddImplicitControl(
                new HorizontalScrollBar {
                Visible = false,
                Dock    = DockStyle.Bottom,
                Cursor  = Cursors.Arrow
            });

            vscrollbar = Controls.AddImplicitControl(
                new VerticalScrollBar {
                Visible = false,
                Dock    = DockStyle.Right,
                Cursor  = Cursors.Arrow
            });
        }