mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-06 14:34:05 +02:00
Add ControlExtensions.MoveToCenter
This commit is contained in:
parent
dc32285454
commit
f0132f59e5
Core
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Controls{
|
||||
@ -12,6 +13,10 @@ public static void InvokeSafe(this Form form, Action func){
|
||||
}
|
||||
}
|
||||
|
||||
public static void MoveToCenter(this Form targetForm, Form parentForm){
|
||||
targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2,parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2);
|
||||
}
|
||||
|
||||
public static void SetValueInstant(this ProgressBar bar, int value){
|
||||
if (value == bar.Maximum){
|
||||
bar.Value = value;
|
||||
|
@ -52,7 +52,7 @@ public FormBrowser(){
|
||||
|
||||
private void ShowChildForm(Form form){
|
||||
form.Show(this);
|
||||
form.Location = new Point(Location.X+Width/2-form.Width/2,Location.Y+Height/2-form.Height/2);
|
||||
form.MoveToCenter(this);
|
||||
}
|
||||
|
||||
// window setup
|
||||
|
Loading…
Reference in New Issue
Block a user