Example #1
0
        void SetBackground( )
        {
            IntPtr hBmp = GetBitmap(this.WatermarkImage);

            NativeApi.LVBKIMAGE lv = new NativeApi.LVBKIMAGE( );

            lv.hbm     = hBmp;
            lv.ulFlags = /*NativeApi.LVBKIF_SOURCE_URL | NativeApi.LVBKIF_STYLE_TILE | */ NativeApi.LVBKIF_TYPE_WATERMARK;

            IntPtr lvPTR = Marshal.AllocCoTaskMem(Marshal.SizeOf(lv));

            Marshal.StructureToPtr(lv, lvPTR, false);

            /*NativeApi.SendMessage ( this.Handle, NativeApi.LVM_SETBKIMAGE, 0, lvPTR );*/
            NativeApi.SendMessage(this.Handle, NativeApi.LVM_SETBKIMAGEW, 0, lvPTR);
            NativeApi.SendMessage(this.Handle, NativeApi.LVM_SETTEXTBKCOLOR, 0, NativeApi.CLR_NONE);
            Marshal.FreeCoTaskMem(lvPTR);
        }
Example #2
0
        void SetBackground( )
        {
            IntPtr hBmp = GetBitmap ( this.WatermarkImage );

              NativeApi.LVBKIMAGE lv = new NativeApi.LVBKIMAGE ( );

              lv.hbm = hBmp;
              lv.ulFlags = /*NativeApi.LVBKIF_SOURCE_URL | NativeApi.LVBKIF_STYLE_TILE | */NativeApi.LVBKIF_TYPE_WATERMARK;

              IntPtr lvPTR = Marshal.AllocCoTaskMem ( Marshal.SizeOf ( lv ) );
              Marshal.StructureToPtr ( lv, lvPTR, false );

              /*NativeApi.SendMessage ( this.Handle, NativeApi.LVM_SETBKIMAGE, 0, lvPTR );*/
              NativeApi.SendMessage ( this.Handle, NativeApi.LVM_SETBKIMAGEW, 0, lvPTR );
              NativeApi.SendMessage ( this.Handle, NativeApi.LVM_SETTEXTBKCOLOR, 0, NativeApi.CLR_NONE );
              Marshal.FreeCoTaskMem ( lvPTR );
        }