Skip to content

Commit b8bf42e

Browse files
Ashley DaviesAshley Davies
authored andcommitted
fixed ui properties
changed webclient pointer
1 parent cc76c1a commit b8bf42e

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

FileMasta/Extensions/ControlExtensions.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public static void ShowDataWindow(string title, string url)
3232
{
3333
DataWindow frmInfo = new DataWindow { Text = title };
3434

35-
using (var client = MainForm._webClient)
36-
using (var stream = client.OpenRead(url))
35+
//using (var client = Program._webClient)
36+
using (var stream = Program._webClient.OpenRead(url))
3737
using (var reader = new StreamReader(stream))
3838
frmInfo.labelData.Text = reader.ReadToEnd();
3939

@@ -44,14 +44,15 @@ public static void ShowDataWindow(string title, string url)
4444
/// <summary>
4545
/// Change button text and auto size
4646
/// </summary>
47-
/// <param name="ctrl">CButton control to set text</param>
47+
/// <param name="ctrl">Control to set text</param>
4848
/// <param name="text">Text to set to control</param>
49-
public static void SetControlText(Button control, string text)
49+
public static void SetControlTextWidth(Button ctrl, string text)
5050
{
51-
control.Text = text;
52-
var myFont = new Font(control.Font.FontFamily, control.Font.Size);
53-
var mySize = control.CreateGraphics().MeasureString(control.Text, myFont);
54-
control.Width = (((int)(Math.Round(mySize.Width, 0))) + 34);
51+
ctrl.Text = text;
52+
var myFont = new Font(ctrl.Font.FontFamily, ctrl.Font.Size);
53+
var mySize = ctrl.CreateGraphics().MeasureString(ctrl.Text, myFont);
54+
ctrl.Width = (int)Math.Round(mySize.Width, 0) + 22;
55+
ctrl.Refresh();
5556
}
5657

5758
/// <summary>
@@ -66,19 +67,19 @@ public static Label LabelMostSearch(string text, int count)
6667
{
6768
Text = text,
6869
TextAlign = ContentAlignment.MiddleCenter,
69-
Font = new Font("Segoe UI Semibold", 9F, FontStyle.Regular | FontStyle.Underline),
70+
Font = new Font("Verdana", 8.25F, FontStyle.Regular | FontStyle.Underline),
7071
AutoSize = true,
7172
BackColor = Color.Transparent,
7273
ForeColor = Color.Black,
73-
Margin = new Padding(0, 0, 1, 1),
74+
Margin = new Padding(0, 0, 0, 1),
7475
Cursor = Cursors.Hand,
7576
Name = "MostSearch" + count,
7677
};
7778

7879
// Click event performs a search in main form
7980
a.Click += delegate
8081
{
81-
MainForm.Form.TextBoxSearchQuery.Text = a.Text;
82+
MainForm.Form.TextboxSearchName.Text = a.Text;
8283
MainForm.Form.SearchFiles();
8384
};
8485

0 commit comments

Comments
 (0)