private void HScrollBar1_miScroll(object sender, ScrollEventArgs e)
        {
            if (_win.GetType() == typeof(ListView) || (_win.GetType() == typeof(KryptonListView)))
            {
                ListView listView1 = (ListView)_win;

                int nIsAt       = WIN32ScrollBars.GetScrollPos(listView1.Handle, WIN32ScrollBars.SB_HORZ);
                int nShouldBeAt = (int)e.NewValue;

                int pixelsToScroll = Convert.ToInt32((nShouldBeAt - nIsAt));

                WIN32ScrollBars.SendMessage(listView1.Handle, (int)WIN32ScrollBars.LVM_SCROLL, pixelsToScroll, 0);

                Invalidate();
            }
            else
            {
                if (_win.GetType() == typeof(KryptonGrid) || _win.GetType() == typeof(DataGridView) || (_win.GetType() == typeof(KryptonDataGridView)))
                {
                    DataGridView dgv = (DataGridView)_win;
                    if (GetDGHScrollbar(ref dgv, out HSC))
                    {
                        foreach (Control control in dgv.Controls)
                        {
                            if (control is HScrollBar)
                            {
                                HScrollBar hscroll = (HScrollBar)control;
                                if (hscroll.Visible)
                                {
                                    switch (e.Type)
                                    {
                                    case ScrollEventType.ThumbTrack:
                                        if (e.NewValue >= e.OldValue)
                                        {
                                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEDOWN, HSC.Handle);
                                        }
                                        else
                                        {
                                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEUP, HSC.Handle);
                                        }

                                        WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)WIN32ScrollBars.SB_THUMBTRACK, HSC.Handle);
                                        break;

                                    default:
                                        WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)e.Type, HSC.Handle);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        HScrollBar1.Visible = false;
                    }
                }
                else
                {
                    if (_win.GetType() == typeof(TreeView) || (_win.GetType() == typeof(Krypton.Toolkit.KryptonTreeView)))
                    {
                        switch (e.Type)
                        {
                        case ScrollEventType.ThumbTrack:
                            if (e.NewValue >= e.OldValue)
                            {
                                WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEDOWN, IntPtr.Zero);
                            }
                            else
                            {
                                WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEUP, IntPtr.Zero);
                            }

                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)WIN32ScrollBars.SB_THUMBTRACK, IntPtr.Zero);
                            break;

                        default:
                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_HSCROLL, (IntPtr)e.Type, IntPtr.Zero);
                            break;
                        }
                    }
                    else
                    {
                        WIN32ScrollBars.PostMessageA(_win.Handle, WIN32ScrollBars.WM_HSCROLL, WIN32ScrollBars.SB_THUMBPOSITION + (0x10000 * HScrollBar1.Value), 0);
                    }
                }
            }
        }
        /// <summary>
        /// Overrided to controll del scrolling of the customControl VScrollBar1
        /// </summary>
        /// <param name="m"></param>
        /// <remarks></remarks>
        protected override void WndProc(ref Message m)
        {
            if (!DesignMode && !(!Parent.CanFocus | (_win == null)))
            {
                //int listStyle = WIN32ScrollBars.GetWindowLong(_win.Handle, WIN32ScrollBars.GWL_STYLE);
                //listStyle |= WIN32ScrollBars.WS_VSCROLL | WIN32ScrollBars.WS_HSCROLL;
                //listStyle |= WIN32ScrollBars.WS_VSCROLL;
                //listStyle |= WIN32ScrollBars.WS_HSCROLL;
                //listStyle = WIN32ScrollBars.SetWindowLong(_win.Handle, WIN32ScrollBars.GWL_STYLE, listStyle);

                int  wndStyle  = WIN32ScrollBars.GetWindowLong(_win.Handle, WIN32ScrollBars.GWL_STYLE);
                bool hsVisible = (wndStyle & WIN32ScrollBars.WS_HSCROLL) != 0;
                bool vsVisible = (wndStyle & WIN32ScrollBars.WS_VSCROLL) != 0;

                //Vertical
                if (vsVisible)
                {
                    si.fMask  = (int)WIN32ScrollBars.ScrollInfoMask.SIF_ALL;
                    si.cbSize = Marshal.SizeOf(si);
                    WIN32ScrollBars.GetScrollInfo(_win.Handle, (int)WIN32ScrollBars.ScrollBarDirection.SB_VERT, ref si);

                    if ((si.nMax + 0) <= si.nPage)
                    {
                        VScrollBar1.Visible = false;
                    }
                    else
                    {
                        VScrollBar1.Visible = true;
                        if (si.nPage != 0)
                        {
                            VScrollBar1.LargeChange = si.nPage;
                            VScrollBar1.Maximum     = si.nMax;
                            VScrollBar1.Minimum     = si.nMin;
                            VScrollBar1.SmallChange = 1;
                            VScrollBar1.Update();//.SyncThumbPositionWithLogicalValue();
                        }
                    }
                }

                //horizontal
                if (hsVisible)
                {
                    si.fMask  = (int)WIN32ScrollBars.ScrollInfoMask.SIF_ALL;
                    si.cbSize = Marshal.SizeOf(si);
                    WIN32ScrollBars.GetScrollInfo(_win.Handle, (int)WIN32ScrollBars.ScrollBarDirection.SB_HORZ, ref si);

                    if ((si.nMax + 0) <= si.nPage)
                    {
                        HScrollBar1.Visible = false;
                    }
                    else
                    {
                        HScrollBar1.Visible = true;
                        if (si.nPage != 0)
                        {
                            HScrollBar1.LargeChange = si.nPage;
                            HScrollBar1.Maximum     = si.nMax;
                            HScrollBar1.Minimum     = si.nMin;
                            HScrollBar1.SmallChange = 1;
                            HScrollBar1.Update();//.SyncThumbPositionWithLogicalValue();
                        }
                    }
                }

                if (_win.GetType() == typeof(ListView) || (_win.GetType() == typeof(KryptonListView)))
                {
                    ListView listView1 = (ListView)_win;

                    WIN32ScrollBars.ScrollInfo si = new WIN32ScrollBars.ScrollInfo();
                    si.cbSize = Marshal.SizeOf(si);
                    si.fMask  = (int)WIN32ScrollBars.ScrollInfoMask.SIF_ALL;
                    if (WIN32ScrollBars.GetScrollInfo(listView1.Handle, (int)WIN32ScrollBars.ScrollBarDirection.SB_VERT, ref si))
                    {
                        VScrollBar1.LargeChange = si.nPage;
                        VScrollBar1.Maximum     = si.nMax;
                        VScrollBar1.Minimum     = si.nMin;
                        VScrollBar1.SmallChange = 1;
                        VScrollBar1.Update();//.SyncThumbPositionWithLogicalValue();
                    }


                    si        = new WIN32ScrollBars.ScrollInfo();
                    si.cbSize = Marshal.SizeOf(si);
                    si.fMask  = (int)WIN32ScrollBars.ScrollInfoMask.SIF_ALL;
                    if (WIN32ScrollBars.GetScrollInfo(listView1.Handle, (int)WIN32ScrollBars.ScrollBarDirection.SB_HORZ, ref si))
                    {
                        HScrollBar1.LargeChange = si.nPage;
                        HScrollBar1.Maximum     = si.nMax;
                        HScrollBar1.Minimum     = si.nMin;
                        HScrollBar1.SmallChange = 1;
                        HScrollBar1.Update();//.SyncThumbPositionWithLogicalValue();
                    }
                }
            }

            base.WndProc(ref m);
        }
        /// <summary>
        /// Comming from the customControl
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks></remarks>
        private void VScrollBar1_miScroll(object sender, ScrollEventArgs e)
        {
            if (_win.GetType() == typeof(ListView) || (_win.GetType() == typeof(KryptonListView)))
            {
                ListView listView1 = (ListView)_win;

                IntPtr min = IntPtr.Zero;
                IntPtr max = IntPtr.Zero;
                WIN32ScrollBars.GetScrollRange(listView1.Handle, WIN32ScrollBars.SB_VERT, ref min, ref max);

                int nMax = max.ToInt32();
                nMax += 3;

                int nHeight        = listView1.DisplayRectangle.Height;
                int ItemRectHeight = listView1.GetItemRect(0).Height;

                int nTimes           = (nHeight - 17) / ItemRectHeight;
                int nScrollPositions = (nMax - nTimes) + 1;

                double nThePos = VScrollBar1.Maximum / nScrollPositions;

                double RealPos = 0.0;
                if (nThePos <= 0.0)
                {
                    RealPos = VScrollBar1.Value;
                }
                else
                {
                    RealPos = VScrollBar1.Value / nThePos;
                }

                int nPos = WIN32ScrollBars.GetScrollPos(listView1.Handle, WIN32ScrollBars.SB_VERT);

                double nShouldBeAt = RealPos * ItemRectHeight;
                double nIsAt       = nPos * ItemRectHeight;

                int pixelsToScroll = Convert.ToInt32((nShouldBeAt - nIsAt));

                WIN32ScrollBars.SendMessage(listView1.Handle, WIN32ScrollBars.LVM_SCROLL, IntPtr.Zero, (IntPtr)pixelsToScroll);

                Invalidate();
            }
            else
            {
                if (_win.GetType() == typeof(KryptonGrid) || _win.GetType() == typeof(DataGridView) || (_win.GetType() == typeof(KryptonDataGridView)))
                {
                    DataGridView dgv = (DataGridView)_win;
                    if (GetDGVScrollbar(ref dgv, out VSB))
                    {
                        foreach (Control control in dgv.Controls)
                        {
                            if (control is VScrollBar)
                            {
                                VScrollBar vscroll = (VScrollBar)control;
                                if (vscroll.Visible)
                                {
                                    switch (e.Type)
                                    {
                                    case ScrollEventType.ThumbTrack:
                                        if (e.NewValue >= e.OldValue)
                                        {
                                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEDOWN, VSB.Handle);
                                        }
                                        else
                                        {
                                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEUP, VSB.Handle);
                                        }

                                        WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)WIN32ScrollBars.SB_THUMBTRACK, VSB.Handle);
                                        break;

                                    default:
                                        WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)e.Type, VSB.Handle);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        VScrollBar1.Visible = false;
                    }
                }
                else
                {
                    if (_win.GetType() == typeof(TreeView) || (_win.GetType() == typeof(Krypton.Toolkit.KryptonTreeView)))
                    {
                        switch (e.Type)
                        {
                        case ScrollEventType.ThumbTrack:
                            if (e.NewValue >= e.OldValue)
                            {
                                WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEDOWN, IntPtr.Zero);
                            }
                            else
                            {
                                WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)WIN32ScrollBars.SB_LINEUP, IntPtr.Zero);
                            }

                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)WIN32ScrollBars.SB_THUMBTRACK, IntPtr.Zero);
                            break;

                        default:
                            WIN32ScrollBars.SendMessage(_win.Handle, WIN32ScrollBars.WM_VSCROLL, (IntPtr)e.Type, IntPtr.Zero);
                            break;
                        }
                    }
                    else
                    {
                        WIN32ScrollBars.PostMessageA(_win.Handle, WIN32ScrollBars.WM_VSCROLL, WIN32ScrollBars.SB_THUMBPOSITION + (0x10000 * VScrollBar1.Value), 0);
                    }
                }
            }
        }