MNGuiLabel.SetScalePos
Skip to content
mnscript
MNGuiLabel.SetScalePos(number, number) 

Description ​

Sets the position of the UI element using a percentage (0-1).

Arguments ​

number - The new X position scaled.
number - The new Y position scaled.

Example ​

msc
using Surface;
using System;

MNGuiFrame frame = Surface.CreateApplicationFrame();
MNGuiPanel pnl = frame.GetPanel();

// Creates a panel in the center of the screen.
// We must offset the position by half the panel size to position it centered,
// otherwise it's corner will be in the center instead.
MNGuiPanel centeredPanel = Surface.CreatePanel(pnl);
centeredPanel.SetSize(100, 100);
centeredPanel.SetPos(-50, -50);
centeredPanel.SetScalePos(0.5, 0.5);

// Update to add the new UI to the screen.
Surface.Update();

// Keep the program alive so the UI stays.
while(true){
    System.Sleep(1);
}