Code Monkey home page Code Monkey logo

ydock's Introduction

YDock

This is a layout system similar to visual studio.

The lastest version is based on .NET4.5. if you use .NET4.0, You need to reference the Microsoft.Windows.Shell assembly to replace the WindowChrome class in .NET4.5.

The following is an application example of the framework: image

The steps to add a layoutable window are as follows:

1.First instantiate a DockManager:

var dockManager = new DockManager();

2.Create a class A that you want to add to the layout (must be inherited from UIElement);

3.Let class A implement the interface IDockSource

4.Register the class with dockManager, for example:

var a = new A();

dockManager.RegisterDock(a);

5.Finally, use the IDockSource interface member to display this class. a.DockControl.Show();

ydock's People

Contributors

bobbycannon avatar yzylovepmn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ydock's Issues

Missing IDockSource

\MainWindow.xaml.cs(94,35,94,46): error CS0246: The type or namespace name 'IDockSource' could not be found (are you missing a using directive or an assembly reference?)

DockHelper.cs: Possible bugs

When you dock a pane and try to resize it, it crashes most of the times due a negative width or height:

public static void ComputeSpliterLocation(Popup spliter, Point location, Size size)
{
    if (location.X < 0)
    {
        spliter.HorizontalOffset = 0;
        spliter.Width = size.Width + location.X;
    }
    if (location.Y < 0)
    {
        spliter.VerticalOffset = 0;
        spliter.Height = size.Height + location.Y;
    }
    if (location.X + size.Width > SystemParameters.PrimaryScreenWidth)
        spliter.Width = SystemParameters.PrimaryScreenWidth - location.X;
    if (location.Y + size.Height > SystemParameters.PrimaryScreenHeight)
        spliter.Height = SystemParameters.PrimaryScreenHeight - location.Y;
}

The problem areas are spliter.Width = SystemParameters.PrimaryScreenWidth - location.X; and spliter.Height = SystemParameters.PrimaryScreenHeight - location.Y.

A simple change like below fixes the issue, but it could be better:

public static void ComputeSpliterLocation(Popup spliter, Point location, Size size)
{
    if (location.X < 0)
    {
        spliter.HorizontalOffset = 0;
        spliter.Width = size.Width + location.X;
    }
    if (location.Y < 0)
    {
        spliter.VerticalOffset = 0;
        spliter.Height = size.Height + location.Y;
    }
    if (location.X + size.Width > SystemParameters.PrimaryScreenWidth)
    {
        if ((SystemParameters.PrimaryScreenWidth - location.X) > 0)
        {
            spliter.Width = SystemParameters.PrimaryScreenWidth - location.X;
        }

    }
    if (location.Y + size.Height > SystemParameters.PrimaryScreenHeight)
    {
        if ((SystemParameters.PrimaryScreenHeight - location.Y) > 0)
        {
            spliter.Height = SystemParameters.PrimaryScreenHeight - location.Y;
        }
    }
}

Mixed direction

Hello,

Is it possible to have mixed direction functionality? E.g. To have two documents - top and bottom - and then dock another document on the left/right side of the top/bottom document? It seems to be only possible if I dock document as a tool.

Minor spelling error

Visual Studio is misspelled in the readme.
Nice work on this project!
I may use it in the next release of my gcode editor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.