GithubHelp home page GithubHelp logo

Comments (2)

RobinPerris avatar RobinPerris commented on August 15, 2024

Docked content doesn't have a set size. It inherits the size of the area instead. The area sizes are not directly accessible from outside of the DarkUI project as they are set to private.

The library was designed around workspaces which could be saved and loaded, rather than programatically setting these values directly. Personally I had a pre-defined workspace configuration which I shipped with the application as the default, then allowed users to save their own custom configurations alongside that. Within that, I set the default area sizes to what I found to be suitable.

There's a working method of doing this in the example project:

#region Serialization Region
private void SerializeDockPanel(string path)
{
var state = DockPanel.GetDockPanelState();
SerializerHelper.Serialize(state, path);
}
private void DeserializeDockPanel(string path)
{
var state = SerializerHelper.Deserialize<DockPanelState>(path);
DockPanel.RestoreDockPanelState(state, GetContentBySerializationKey);
}
private DarkDockContent GetContentBySerializationKey(string key)
{
foreach (var window in _toolWindows)
{
if (window.SerializationKey == key)
return window;
}
return null;
}
#endregion

However, if you do want to directly set the size of an area programatically, you can add the following method to DarkDockPanel.cs and it should allow you to do this.

public void SetAreaSize(DarkDockArea area, Size size)
{
  switch (area)
  {
      case DarkDockArea.Left:
          _regions[DarkDockArea.Left].Size = size;
          break;
      case DarkDockArea.Right:
          _regions[DarkDockArea.Right].Size = size;
          break;
      case DarkDockArea.Bottom:
          _regions[DarkDockArea.Bottom].Size = size;
          break;
  }
}

from darkui.

RobinPerris avatar RobinPerris commented on August 15, 2024

Closing due to inactivity

from darkui.

Related Issues (20)

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.