Exemplo n.º 1
0
        public static void Shift <T>(this Control.ControlCollection source, T from, T to, Func <T, bool> isItemMovable, Action <int, int> fromIndexToIndexAction = null, Action <T, T> fromToAction = null) where T : Control
        {
            var fromIndex = source.IndexOf(from);
            var toIndex   = source.IndexOf(to);

            source.Shift(fromIndex, toIndex, isItemMovable, fromIndexToIndexAction, fromToAction);
        }
Exemplo n.º 2
0
        public static void MakeTransparent(Control control, Graphics g)
        {
            Control parent = control.Parent;

            if (parent != null)
            {
                Rectangle rectangle = control.Bounds;
                Control.ControlCollection controls = parent.Controls;
                int    index  = controls.IndexOf(control);
                Bitmap bitmap = null;
                for (int i = controls.Count - 1; i > index; i--)
                {
                    Control control3 = controls[i];
                    if (control3.Bounds.IntersectsWith(rectangle))
                    {
                        if (bitmap == null)
                        {
                            bitmap = new Bitmap(control.Parent.ClientSize.Width, control.Parent.ClientSize.Height);
                        }
                        control3.DrawToBitmap(bitmap, control3.Bounds);
                    }
                }
                if (bitmap != null)
                {
                    g.DrawImage((Image)bitmap, control.ClientRectangle, rectangle, (GraphicsUnit)GraphicsUnit.Pixel);
                    bitmap.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        public static void smethod_0(this Control control_0, bool bool_0, Image image_0)
        {
            if (control_0.Parent == null && !(control_0 is RadForm))
            {
                return;
            }
            if (!GClass123.dictionary_0.ContainsKey(control_0))
            {
                GClass123.dictionary_0.Add(control_0, (Control)null);
            }
            Control control = GClass123.dictionary_0[control_0];

            Control.ControlCollection controlCollection = control_0 is RadForm ? control_0.Controls : control_0.Parent.Controls;
            controlCollection.IndexOf(control_0);
            if (bool_0 && control == null)
            {
                PictureBox pictureBox1 = new PictureBox();
                pictureBox1.Image    = image_0;
                pictureBox1.Size     = control_0.Size;
                pictureBox1.Location = control_0.Location;
                pictureBox1.Anchor   = control_0.Anchor;
                pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
                PictureBox pictureBox2 = pictureBox1;
                controlCollection.Add((Control)pictureBox2);
                GClass123.dictionary_0[control_0] = (Control)pictureBox2;
                pictureBox2.BringToFront();
            }
            else
            {
                if (control == null)
                {
                    return;
                }
                controlCollection.Remove(control);
                GClass123.dictionary_0[control_0] = (Control)null;
            }
        }
 /// <summary>
 /// Provides the index position of the control specified
 /// </summary>
 /// <param name="value">The control to search for</param>
 /// <returns>Returns the index position if found, or -1</returns>
 public int IndexOf(IControlHabanero value)
 {
     return(_col.IndexOf((Control)value));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns the index of the specified XPanderPanel in the collection.
 /// </summary>
 /// <param name="xpanderPanel">The xpanderPanel to find the index of.</param>
 /// <returns>The index of the xpanderPanel, or -1 if the xpanderPanel is not in the <see ref="ControlCollection">ControlCollection</see> instance.</returns>
 public int IndexOf(XPanderPanel xpanderPanel)
 {
     return(m_controlCollection.IndexOf(xpanderPanel));
 }
Exemplo n.º 6
0
        private void InitializeCustomInputs(Control.ControlCollection ctrls)
        {
            LogHelper.Write(LogWriterLevel.FUNCTIONS, LogWriterIO.START);
            LogHelper.Write(LogWriterLevel.PARAMETERS, "Controls count: " + ctrls.Count);
            ctrls.Cast <Control>().ToList().ForEach(ctrl =>
            {
                LogHelper.Write(LogWriterLevel.PARAMETERS, "Control[" + ctrls.IndexOf(ctrl).ToString().PadLeft(ctrls.Count.ToString().Length, '0') + "].Name: " + ctrl.Name);
                if (ctrl.Tag != null && ctrl.Tag.ToString().Contains("#container#"))
                {
                    if (ctrl.Tag.ToString().Contains("#text#"))
                    {
                        ctrl.BackColor = frmMain.colorCustomTextColorLeave;
                        var ppnl       = (Panel)ctrl.Controls[0];
                        var ctxt       = ppnl.Controls.OfType <TextBox>().Single();
                        //
                        // root/parent :: panel => border
                        //
                        ctrl.MouseEnter /**/ += (s, e) => ctrl.BackColor = frmMain.colorCustomTextColorEnter;
                        ctrl.MouseLeave /**/ += (s, e) => ctrl.BackColor = ctxt.Focused ? frmMain.colorCustomTextColorEnter : frmMain.colorCustomTextColorLeave;
                        ctrl.Click /**/      += (s, e) => ctxt.Focus();
                        //
                        // parent.child :: panel => padding
                        //
                        ppnl.MouseEnter /**/ += (s, e) => ctrl.BackColor = frmMain.colorCustomTextColorEnter;
                        ppnl.MouseLeave /**/ += (s, e) => ctrl.BackColor = ctxt.Focused ? frmMain.colorCustomTextColorEnter : frmMain.colorCustomTextColorLeave;
                        ppnl.Click /**/      += (s, e) => ctxt.Focus();
                        //
                        // parent.parent.child :: textbox => input
                        //
                        ctxt.GotFocus /**/   += (s, e) => ctrl.BackColor = frmMain.colorCustomTextColorEnter;
                        ctxt.LostFocus /**/  += (s, e) => ctrl.BackColor = frmMain.colorCustomTextColorLeave;
                        ctxt.MouseEnter /**/ += (s, e) => ctrl.BackColor = frmMain.colorCustomTextColorEnter;
                        ctxt.MouseLeave /**/ += (s, e) => ctrl.BackColor = ((Control)s).Focused ? frmMain.colorCustomTextColorEnter : frmMain.colorCustomTextColorLeave;

                        if (ctrl.Tag.ToString().Contains("#check.path#"))
                        {
                            var cpic          = ppnl.Controls.OfType <PictureBox>().Single();
                            ctxt.TextChanged += (s, e) =>
                            {
                                if (ctxt.Text.Trim().Length == 0)
                                {
                                    cpic.Image = global::AnimeExtractor.Properties.Resources.png_circle_cross;
                                    this.toolTip1.SetToolTip(cpic, "this field is required");
                                }
                                else if (!Directory.Exists(ctxt.Text))
                                {
                                    cpic.Image = global::AnimeExtractor.Properties.Resources.png_circle_cross;
                                    this.toolTip1.SetToolTip(cpic, "directory not found");
                                }
                                else
                                {
                                    cpic.Image = global::AnimeExtractor.Properties.Resources.png_circle_check;
                                    this.toolTip1.SetToolTip(cpic, "okay");
                                }
                            };
                        }
                    }
                }
                else if (ctrl.Controls.Count > 0)
                {
                    LogHelper.Write(LogWriterLevel.FUNCTIONS, "InitializeCustomInputs from " + ctrl.Name);
                    InitializeCustomInputs(ctrl.Controls);
                }
            });
            LogHelper.Write(LogWriterLevel.FUNCTIONS, LogWriterIO.CLOSE);
        }
 /// <summary>
 /// Provides the index position of the control specified
 /// </summary>
 /// <param name="value">The control to search for</param>
 /// <returns>Returns the index position if found, or -1</returns>
 public int IndexOf(IControlHabanero value)
 {
     return(_col.IndexOf(value.GetControl()));
 }