Improving maring
This commit is contained in:
parent
189ac792b0
commit
3e98aa43d6
6 changed files with 9 additions and 85 deletions
|
|
@ -143,7 +143,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
&& hasKeyboardFocus)
|
||||
{
|
||||
var bounds = this.LocalBounds;
|
||||
bounds -= BackgroundInset;
|
||||
var stroke = 1 * GuiWidget.DeviceScale;
|
||||
var expand = stroke / 2;
|
||||
var rect = new RoundedRect(bounds.Left + expand,
|
||||
|
|
@ -157,36 +156,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnDrawBackground(Graphics2D graphics2D)
|
||||
{
|
||||
var bounds = this.LocalBounds;
|
||||
bounds -= BackgroundInset;
|
||||
var rect = new RoundedRect(bounds.Left,
|
||||
bounds.Bottom,
|
||||
bounds.Right,
|
||||
bounds.Top,
|
||||
RoundRadius * GuiWidget.DeviceScale);
|
||||
|
||||
if (BackgroundColor.Alpha0To255 > 0)
|
||||
{
|
||||
graphics2D.Render(rect, BackgroundColor);
|
||||
}
|
||||
|
||||
if (BorderColor.Alpha0To255 > 0 && RenderOutline)
|
||||
{
|
||||
var stroke = 1 * GuiWidget.DeviceScale;
|
||||
var expand = stroke / 2;
|
||||
rect = new RoundedRect(bounds.Left + expand,
|
||||
bounds.Bottom + expand,
|
||||
bounds.Right - expand,
|
||||
bounds.Top - expand,
|
||||
RoundRadius * GuiWidget.DeviceScale);
|
||||
var rectOutline = new Stroke(rect, stroke);
|
||||
|
||||
graphics2D.Render(rectOutline, BorderColor);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Enabled
|
||||
{
|
||||
get => base.Enabled;
|
||||
|
|
@ -200,26 +169,10 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BorderDouble BackgroundInset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is in device units and will be scaled when drawn to the screen (do not scale the input by DeviceScale)
|
||||
/// </summary>
|
||||
public double RoundRadius { get; set; }
|
||||
|
||||
public bool RenderOutline { get; set; }
|
||||
}
|
||||
|
||||
public class SimpleFlowButton : FlowLayoutWidget
|
||||
{
|
||||
/// <summary>
|
||||
/// This is in device units and will be scaled when drawn to the screen (do not scale the input by DeviceScale)
|
||||
/// </summary>
|
||||
public double RoundRadius { get; set; }
|
||||
|
||||
public bool RenderOutline { get; set; }
|
||||
|
||||
private bool mouseInBounds = false;
|
||||
|
||||
protected ThemeConfig theme;
|
||||
|
|
@ -262,35 +215,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnDrawBackground(Graphics2D graphics2D)
|
||||
{
|
||||
var bounds = this.LocalBounds;
|
||||
var rect = new RoundedRect(bounds.Left,
|
||||
bounds.Bottom,
|
||||
bounds.Right,
|
||||
bounds.Top,
|
||||
RoundRadius * GuiWidget.DeviceScale);
|
||||
|
||||
if (BackgroundColor.Alpha0To255 > 0)
|
||||
{
|
||||
graphics2D.Render(rect, BackgroundColor);
|
||||
}
|
||||
|
||||
if (BorderColor.Alpha0To255 > 0 && RenderOutline)
|
||||
{
|
||||
var stroke = 1 * GuiWidget.DeviceScale;
|
||||
var expand = stroke / 2;
|
||||
rect = new RoundedRect(bounds.Left + expand,
|
||||
bounds.Bottom + expand,
|
||||
bounds.Right - expand,
|
||||
bounds.Top - expand,
|
||||
RoundRadius * GuiWidget.DeviceScale);
|
||||
var rectOutline = new Stroke(rect, stroke);
|
||||
|
||||
graphics2D.Render(rectOutline, BorderColor);
|
||||
}
|
||||
}
|
||||
|
||||
public override Color BackgroundColor
|
||||
{
|
||||
get
|
||||
|
|
@ -545,7 +469,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
this.Padding = theme.TextButtonPadding;
|
||||
this.TabStop = true;
|
||||
|
||||
this.RoundRadius = 3;
|
||||
this.BackgroundRadius = 3;
|
||||
|
||||
var textSize = (pointSize != -1) ? pointSize : theme.DefaultFontSize;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue