tastudio: add user text area to screenshot control.
padding height is autocalculated based on string and bitmap width. todo: add branch user text and use it for the above.
This commit is contained in:
parent
2723739a02
commit
5715dc2a84
|
@ -288,10 +288,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
int x = locationOnForm.X - Tastudio.ScreenshotControl.Width;
|
||||
int y = locationOnForm.Y; // keep consistent height, helps when conparing screenshots
|
||||
|
||||
if (x < 0) x = 0;
|
||||
if (x < 1) x = 1;
|
||||
|
||||
Tastudio.ScreenshotControl.UserText = "";
|
||||
Tastudio.ScreenshotControl.RecalculatePadding();
|
||||
Tastudio.ScreenshotControl.Location = new Point(x, y);
|
||||
|
||||
Tastudio.ScreenshotControl.Visible = true;
|
||||
Tastudio.ScreenshotControl.Branch = branch;
|
||||
Tastudio.ScreenshotControl.Refresh();
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public ScreenshotPopupControl()
|
||||
{
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
SetStyle(ControlStyles.Opaque, true);
|
||||
this.BackColor = Color.Transparent;
|
||||
//SetStyle(ControlStyles.Opaque, true);
|
||||
//this.BackColor = Color.Transparent;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
@ -28,7 +28,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
var bitmap = Branch.OSDFrameBuffer.ToSysdrawingBitmap();
|
||||
e.Graphics.DrawImage(bitmap, new Rectangle(0, 0, Width, Height));
|
||||
e.Graphics.DrawImage(bitmap, new Rectangle(0, 0, Width, DrawingHeight));
|
||||
if (UserPadding > 0)
|
||||
{
|
||||
e.Graphics.DrawRectangle(new Pen(Brushes.Black), new Rectangle(new Point(0, DrawingHeight), new Size(Width - 1, UserPadding - 1)));
|
||||
e.Graphics.DrawString(UserText, _font, Brushes.Black, new Rectangle(1, DrawingHeight, Width - 1, Height));
|
||||
}
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
||||
|
@ -41,5 +46,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// todo: switch screenshots by hotkey
|
||||
}
|
||||
|
||||
public void RecalculatePadding()
|
||||
{
|
||||
UserPadding = (int)Graphics.FromHwnd(this.Handle).MeasureString(UserText, _font, Width).Height;
|
||||
if (UserPadding > 0)
|
||||
UserPadding += 2;
|
||||
Height = DrawingHeight + UserPadding;
|
||||
}
|
||||
|
||||
public int DrawingHeight = 0;
|
||||
public int UserPadding = 0;
|
||||
public string UserText;
|
||||
|
||||
private Font _font = new Font(new FontFamily("Courier New"), 8);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,9 +110,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
width = 320;
|
||||
height = (int)((double)(height) * ratio);
|
||||
}
|
||||
|
||||
|
||||
ScreenshotControl.Size = new Size(width, height);
|
||||
ScreenshotControl.DrawingHeight = height;
|
||||
ScreenshotControl.Size = new Size(width, ScreenshotControl.DrawingHeight + ScreenshotControl.UserPadding);
|
||||
}
|
||||
|
||||
ScreenshotControl.Visible = false;
|
||||
|
|
Loading…
Reference in New Issue