Description ​
Sets the UI element dock margin.
Arguments ​
number
- The left margin.number
- The top margin.number
- The right margin.number
- The bottom margin.
Example ​
msc
using Surface;
using System;
MNGuiFrame frame = Surface.CreateApplicationFrame();
MNGuiPanel pnl = frame.GetPanel();
// Creates four panels docked to the top, left, right and bottom
MNGuiPanel topPanel = Surface.CreatePanel(pnl);
topPanel.DockTop();
MNGuiPanel leftPanel = Surface.CreatePanel(pnl);
leftPanel.DockLeft();
MNGuiPanel rightPanel = Surface.CreatePanel(pnl);
rightPanel.DockRight();
MNGuiPanel bottomPanel = Surface.CreatePanel(pnl);
bottomPanel.DockBottom();
Color red = new Color(200,100,100,255);
// The filled panel will take up the remaining area in the center of the screen.
MNGuiPanel filledPanel = Surface.CreatePanel(pnl);
filledPanel.DockFill();
// The dock margin will add a 15 pixel border around the entire middle panel.
filledPanel.SetDockMargin(15, 15, 15, 15);
filledPanel.SetBackgroundColor(red);
// Update to add the new UI to the screen.
Surface.Update();
// Keep the program alive so the UI stays.
while(true){
System.Sleep(1);
}