Example #1
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 20)
     {
         m.Result = IntPtr.Zero;
     }
     else
     {
         base.WndProc(ref m);
         if (m.Msg == 8270)
         {
             Fusionbird.FusionToolkit.NativeMethods.NMHDR nmhdr = (Fusionbird.FusionToolkit.NativeMethods.NMHDR)Marshal.PtrToStructure(m.LParam, typeof(Fusionbird.FusionToolkit.NativeMethods.NMHDR));
             if (nmhdr.code == -12)
             {
                 Marshal.StructureToPtr((object)nmhdr, m.LParam, false);
                 Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW nmcustomdraw = (Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW)Marshal.PtrToStructure(m.LParam, typeof(Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW));
                 if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_PREPAINT)
                 {
                     Graphics       graphics = Graphics.FromHdc(nmcustomdraw.hdc);
                     PaintEventArgs e        = new PaintEventArgs(graphics, this.Bounds);
                     e.Graphics.TranslateTransform((float)-this.Left, (float)-this.Top);
                     this.InvokePaintBackground(this.Parent, e);
                     this.InvokePaint(this.Parent, e);
                     SolidBrush solidBrush = new SolidBrush(this.BackColor);
                     e.Graphics.FillRectangle((Brush)solidBrush, this.Bounds);
                     solidBrush.Dispose();
                     e.Graphics.ResetTransform();
                     e.Dispose();
                     graphics.Dispose();
                     IntPtr num = new IntPtr(48);
                     m.Result = num;
                 }
                 else if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_POSTPAINT)
                 {
                     this.OnDrawTicks(nmcustomdraw.hdc);
                     this.OnDrawChannel(nmcustomdraw.hdc);
                     this.OnDrawThumb(nmcustomdraw.hdc);
                 }
                 else if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_ITEMPREPAINT)
                 {
                     if (nmcustomdraw.dwItemSpec.ToInt32() == 2)
                     {
                         this.ThumbBounds = nmcustomdraw.rc.ToRectangle();
                         this.ThumbState  = !this.Enabled ? 5 : (nmcustomdraw.uItemState != Fusionbird.FusionToolkit.NativeMethods.CustomDrawItemState.CDIS_SELECTED ? 1 : 3);
                         this.OnDrawThumb(nmcustomdraw.hdc);
                     }
                     else if (nmcustomdraw.dwItemSpec.ToInt32() == 3)
                     {
                         this.ChannelBounds = nmcustomdraw.rc.ToRectangle();
                         this.OnDrawChannel(nmcustomdraw.hdc);
                     }
                     else if (nmcustomdraw.dwItemSpec.ToInt32() == 1)
                     {
                         this.OnDrawTicks(nmcustomdraw.hdc);
                     }
                     IntPtr num = new IntPtr(4);
                     m.Result = num;
                 }
             }
         }
     }
 }
Example #2
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 20)
     {
         m.Result = IntPtr.Zero;
     }
     else
     {
         base.WndProc(ref m);
         if (m.Msg == 0x204e)
         {
             Fusionbird.FusionToolkit.NativeMethods.NMHDR structure = (Fusionbird.FusionToolkit.NativeMethods.NMHDR)Marshal.PtrToStructure(m.LParam, typeof(Fusionbird.FusionToolkit.NativeMethods.NMHDR));
             if (structure.code == -12)
             {
                 IntPtr ptr;
                 Marshal.StructureToPtr(structure, m.LParam, false);
                 Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW nmcustomdraw = (Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW)Marshal.PtrToStructure(m.LParam, typeof(Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW));
                 if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_PREPAINT)
                 {
                     Graphics       graphics = Graphics.FromHdc(nmcustomdraw.hdc);
                     PaintEventArgs e        = new PaintEventArgs(graphics, base.Bounds);
                     e.Graphics.TranslateTransform((float)-base.Left, (float)-base.Top);
                     base.InvokePaintBackground(base.Parent, e);
                     base.InvokePaint(base.Parent, e);
                     SolidBrush brush = new SolidBrush(BackColor);
                     e.Graphics.FillRectangle(brush, base.Bounds);
                     brush.Dispose();
                     e.Graphics.ResetTransform();
                     e.Dispose();
                     graphics.Dispose();
                     ptr      = new IntPtr(0x30);
                     m.Result = ptr;
                 }
                 else if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_POSTPAINT)
                 {
                     OnDrawTicks(nmcustomdraw.hdc);
                     OnDrawChannel(nmcustomdraw.hdc);
                     OnDrawThumb(nmcustomdraw.hdc);
                 }
                 else if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_ITEMPREPAINT)
                 {
                     if (nmcustomdraw.dwItemSpec.ToInt32() == 2)
                     {
                         ThumbBounds = nmcustomdraw.rc.ToRectangle();
                         if (base.Enabled)
                         {
                             if (nmcustomdraw.uItemState == Fusionbird.FusionToolkit.NativeMethods.CustomDrawItemState.CDIS_SELECTED)
                             {
                                 ThumbState = 3;
                             }
                             else
                             {
                                 ThumbState = 1;
                             }
                         }
                         else
                         {
                             ThumbState = 5;
                         }
                         OnDrawThumb(nmcustomdraw.hdc);
                     }
                     else if (nmcustomdraw.dwItemSpec.ToInt32() == 3)
                     {
                         ChannelBounds = nmcustomdraw.rc.ToRectangle();
                         OnDrawChannel(nmcustomdraw.hdc);
                     }
                     else if (nmcustomdraw.dwItemSpec.ToInt32() == 1)
                     {
                         OnDrawTicks(nmcustomdraw.hdc);
                     }
                     ptr      = new IntPtr(4);
                     m.Result = ptr;
                 }
             }
         }
     }
 }