The MindFusion Forums
MindFusion.UI controls >> Windows Forms >> How might one maximise/minimise/restore a floating DockItem ?
https://mindfusion.eu/Forum/YaBB.pl?num=1533241879

Message started by MarkAGr on Aug 2nd, 2018 at 8:31pm

Title: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Aug 2nd, 2018 at 8:31pm
I was hoping to add a button to the frame ... ( can't )
or catch a double click on the title bar ... ( can't )
then call a maximise/maximise/restore method ... ( can't )

but alas ... none of those appear possible ...

8^(
Mark

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by Slavcho on Aug 6th, 2018 at 5:05pm
You can get a reference to a DockItem's container like this -

[code]
item.Content.ParentChanged += ContentParentChanged;

void ContentParentChanged(object sender, EventArgs e)
{
     var control = sender as Control;
     var parent = control.Parent as Control;
     if (parent != null)
     {
           var btn = new System.Windows.Forms.Button { Text = "+" };
           parent.Controls.Add(btn);
           btn.BringToFront();
           // how do we move this to titlebar?
     }
}[/code]

Problem is when DockItem is in floating state, its container is a standard Form object and the added child control goes in form's client area below title bar, and not inside the bar. We'll look for some way to allow customizing it in next few days.

Regards,
Slavcho

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Aug 11th, 2018 at 2:23pm
Thank You ... much appreciated :)

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Aug 21st, 2018 at 4:39pm
Any advances?

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Aug 31st, 2018 at 8:15pm
Any Luck Yet?

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by Slavcho on Sep 4th, 2018 at 8:18am
Our developer is working on it.

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Sep 4th, 2018 at 4:49pm
(y) (y) Thanks Guys!

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by Slavcho on Sep 10th, 2018 at 9:59am
Try this build -
https://mindfusion.eu/_beta/dock_tbar_buttons.zip

It adds a TitleBarButton class and three list properties used as titlebar templates,  where you can add buttons depending on the dock-item state: DockedTitleBarButtons, UndockedTitleBarButtons, TabbedTitleBarButtons. You can add a custom button like this -

[code]
var myTitleButton = new TitleBarButton();
myTitleButton.ButtonPen = new Pen(Color.Red);
myTitleButton.ButtonImage = Image.FromFile(...);
//myTitleButton.Draw += MyTitleButton_Draw;
myTitleButton.OnClick += MyTitleButton_OnClick;
dockControl1.DockedTitleBarButtons.Add(myTitleButton);

private void MyTitleButton_OnClick(object sender, MouseEventArgs e)
{
  MessageBox.Show("Custom button clicked", "Custom", MessageBoxButtons.OK);
}

private void MyTitleButton_Draw(object source, DrawEventArgs e)
{
  var tbb = source as TitleBarButton;
  if (tbb == null)
    return;
  e.Graphics.DrawArc(tbb.ButtonPen, new Rectangle(tbb.X, tbb.Y, tbb.Width, tbb.Height), 0, 360);
}[/code]

Regards,
Slavcho

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Sep 10th, 2018 at 1:40pm
Ooooh nice!
I'm going to need some time to mull over these.

Thank You :)

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Sep 11th, 2018 at 8:52am
Hi ...

There appears to be just one or two minor problems ...

1) an exception is caused if there's nothing attached to the click event

There should be an event attached to the button - so that's not really a hardship -

2) the click event triggers whether the mouse is over the button or not when the button is released.

On checking, this might be the mindfusion standard way of doing it ... I was under the impression that a click event isn't activated if the cursor is no longer over the button when the mouse button is lifted. - I could be wrong.

8^)
Mark

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by Slavcho on Sep 12th, 2018 at 10:11am
Hi,

New build here should fix that -
https://mindfusion.eu/_beta/dock_tbar_buttons.zip

Regards,
Slavcho

Title: Re: How might one maximise/minimise/restore a floating DockItem ?
Post by MarkAGr on Sep 13th, 2018 at 12:10pm
Wey hey! This works gr8!

Thanks!!!

8^)
Mark

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.