@@ -44,10 +44,8 @@ public frmMain(string passedDirectory, int cursorPosX, int cursorPosY)
4444 System . Runtime . ProfileOptimization . StartProfile ( "frmMain.Profile" ) ;
4545 mouseClick = new Point ( cursorPosX , cursorPosY ) ; // Consstruct point p based on passed x y mouse values
4646 passedDirec = passedDirectory ;
47- //InitializeComponent();
4847 FormBorderStyle = FormBorderStyle . None ;
4948
50-
5149 using ( MemoryStream ms = new MemoryStream ( System . IO . File . ReadAllBytes ( MainPath . path + "\\ config\\ " + passedDirec + "\\ GroupIcon.ico" ) ) )
5250 this . Icon = new Icon ( ms ) ;
5351
@@ -66,27 +64,22 @@ public frmMain(string passedDirectory, int cursorPosX, int cursorPosY)
6664 else
6765 //light backcolor is light, set hover color as darker
6866 HoverColor = Color . FromArgb ( BackColor . A , ( BackColor . R + 50 ) , ( BackColor . G + 50 ) , ( BackColor . B + 50 ) ) ;
69-
70- LoadCategory ( ) ;
7167 }
7268 else
7369 {
7470 Application . Exit ( ) ;
7571 }
76-
7772 }
7873
7974 private void frmMain_Load ( object sender , EventArgs e )
8075 {
81- //System.Diagnostics.Debugger.Launch ();
76+ LoadCategory ( ) ;
8277 SetLocation ( ) ;
8378 }
8479
8580 // Sets location of form
8681 private void SetLocation ( )
8782 {
88- //System.Diagnostics.Debugger.Launch();
89-
9083 List < Rectangle > taskbarList = FindDockedTaskBars ( ) ;
9184 Rectangle taskbar = new Rectangle ( ) ;
9285 Rectangle screen = new Rectangle ( ) ;
@@ -154,6 +147,7 @@ private void SetLocation()
154147 this . Top = screen . Top + 10 ;
155148 if ( this . Right > screen . Right )
156149 this . Left = screen . Right - this . Width - 10 ;
150+
157151 // If form goes over taskbar
158152 if ( taskbar . Contains ( this . Left , this . Top ) && taskbar . Contains ( this . Right , this . Top ) ) // Top taskbar
159153 this . Top = screen . Top + 10 + taskbar . Height ;
@@ -184,13 +178,15 @@ private void SetLocation()
184178 locationx = mouseClick . X - ( this . Width / 2 ) ;
185179
186180 this . Location = new Point ( locationx , locationy ) ;
181+
187182 // If form goes over screen edge
188183 if ( this . Left < screen . Left )
189184 this . Left = screen . Left + 10 ;
190185 if ( this . Top < screen . Top )
191186 this . Top = screen . Top + 10 ;
192187 if ( this . Right > screen . Right )
193188 this . Left = screen . Right - this . Width - 10 ;
189+
194190 // If form goes over taskbar
195191 if ( taskbar . Contains ( this . Left , this . Top ) && taskbar . Contains ( this . Right , this . Top ) ) // Top taskbar
196192 this . Top = screen . Top + 10 + taskbar . Height ;
@@ -265,6 +261,8 @@ public static List<Rectangle> FindDockedTaskBars()
265261 // Loading category and building shortcuts
266262 private void LoadCategory ( )
267263 {
264+ //System.Diagnostics.Debugger.Launch();
265+
268266 this . Width = 0 ;
269267 this . Height = 45 ;
270268 int x = 0 ;
0 commit comments