Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1.  public void LockControl(Control locked)
  2.         {
  3.             if (locked != null)
  4.             {
  5.                 if ((locked.Parent != null) && (locked.Parent.Controls != null))
  6.                 {
  7.                     try
  8.                     {
  9.                         int num = (locked.Size.Height - 0x10) / 2;
  10.                         int num2 = 0;
  11.                         ResourceManager manager = new ResourceManager(typeof(MainForm));
  12.                         PictureBox box = new PictureBox();
  13.                         if (locked is TextBox)
  14.                         {
  15.                             num2 += 5;
  16.                         }
  17.                         else if (!(locked is CheckBox) && !(locked is RadioButton))
  18.                         {
  19.                             num2 = (locked.Size.Width - 0x10) / 2;
  20.                         }
  21.                         box.Cursor = Cursors.Help;
  22.                         box.Image = (Image) manager.GetObject("lockBox.Image");
  23.                         box.Size = new Size(0x10, 0x10);
  24.                         box.SizeMode = PictureBoxSizeMode.AutoSize;
  25.                         box.Click += new EventHandler(this.lockBox_Click);
  26.                         box.TabIndex = locked.TabIndex;
  27.                         box.TabStop = locked.TabStop;
  28.                         box.Location = new Point(locked.Location.X + num2, locked.Location.Y + num);
  29.                         box.Name = locked.Name + "LockBox";
  30.                         box.Tag = locked;
  31.                         box.Visible = true;
  32.                         locked.Parent.Controls.Add(box);
  33.                         locked.Parent.Controls.SetChildIndex(box, 0);
  34.                         this.m_LockBoxes.Add(box);
  35.                     }
  36.                     catch
  37.                     {
  38.                     }
  39.                 }
  40.                 locked.Enabled = false;
  41.             }
  42.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement