VintageRice

[Visual Studio] - Reverse Panelling

Dec 1st, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace sourceCode
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         int pCount = 0;
  21.  
  22.         private void Form1_Load(object sender, EventArgs e)
  23.         {
  24.             foreach(Control C in this.Controls)
  25.             {
  26.                 if(C.Name.Contains("panel"))
  27.                 {
  28.                     pCount++;
  29.                 }
  30.             }
  31.         }
  32.  
  33.         private void timer1_Tick(object sender, EventArgs e)
  34.         {
  35.             foreach(Control C in this.Controls)
  36.             {
  37.                 if(C.Name.Contains("panel"))
  38.                 {
  39.                     int theValue = (this.Location.X - Cursor.Position.X) + this.Width - (((pCount + 2) * 65) - 30) / 2;
  40.  
  41.                     ((Panel)C).Left = theValue + (65 * Convert.ToInt16(((Panel)C).Name.Remove(0, 5)));
  42.                 }
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment