I have adapted the GridDragSelectMouseController to create my own column drag controller.
I am trying to reuse as much of the syncfusion code as possible and the area in question is largely unchanged.
In the CreateHeaderBitmap, if I''m creating a drag bitmap that''s one row tall then it draws correctly. But if I create a bitmap that''s two rows tall (39px in the case of this grid), then the lower 1/4 or so of the bitmap fills in with black.
To simplify thing for testing, I modified the CreateBitmapHeader() method to simply create a solid transparent bitmap as follows:
private Bitmap CreateHeaderBitmap(int rowIndex, int colIndex)
{
Bitmap bm = null;
Graphics g = null;
Size size = GetBitmapSize(rowIndex, colIndex);
Rectangle bounds = new Rectangle(Point.Empty, size);
try
{
bm = new Bitmap(size.Width, size.Height);
g = Graphics.FromImage(bm);
Color backColor = Color.Green;
g.FillRectangle(new SolidBrush(backColor), bounds);
Brush br = new SolidBrush(backColor != Color.Black ? Color.Black : Color.Blue);
bm.MakeTransparent(backColor);
br.Dispose();
}
finally
{
if (g != null)
g.Dispose();
}
return bm;
}
GetBitmapSize() will, in this case, return a size of 8x19 or 8x39. When it returns 8x19, everything works fine. When it returns 8x39, the bottom 1/4 of the bitmap turns out solid black.
Now, if I remove the bm.MakeTransparent(backColor) line, the entire 8x39 will be solid green (no black, no transparency).
This makes no sense to me at all.
I have looked through the DragHelper and DragWindow classes and can see nothing in them that''s restricting the size. I''m stumped.
Do you have any idea why this would be happening?
Otherwise my drag controller deals with the DragHelper class the same as the original controller. The only modification was a change to the CalcCenterPoint() method in the controller to account for the bitmap being taller than one row.
Thanks for any ideas you have on how to solve this.
Pete Davis
AD
Administrator
Syncfusion Team
July 14, 2005 10:19 PM UTC
It occurred to me that this would be much easier if I could simply reproduce the problem with the regular Syncfusion grid and fortunately I can.
Create a grid with draggable columns.
Then add:
grid.RowHeights[0] = 40;
You''ll notice the lower 1/4 or so of the drag cursor is solid black instead of the I-Bar shape it should be.
Pete
AD
Administrator
Syncfusion Team
July 15, 2005 09:47 AM UTC
I see the behavior you described, but do not have a resolution for this yet. It makes no sense to me either. It looks like something is interfering with or clipping the transparency at the bottom of the bitmap. I will discuss this with Stefan later today, and update this thread when I have more information.
AD
Administrator
Syncfusion Team
July 17, 2005 08:49 AM UTC
This seems to be a bug in GDIplus.
It happens when you call that method:
bm.MakeTransparent(backColor);
It seems to be related to calling this method on a TopMostWindow. If you comment out the method things will be fine but the transparency effect is lost.
With Whidbey Beta 2, the problem is gone in this sample.
So far I haven’t been able to find a work-around.
AD
Administrator
Syncfusion Team
July 18, 2005 01:58 PM UTC
That''s odd. Well, thanks. I guess for now we''re just going to go with a solid black 2px wide vertical line as the indicator. That should work until we come up with something better.
Pete
>This seems to be a bug in GDIplus.
>
>It happens when you call that method:
>
> bm.MakeTransparent(backColor);
>
>
>It seems to be related to calling this method on a TopMostWindow. If you comment out the method things will be fine but the transparency effect is lost.
>
>With Whidbey Beta 2, the problem is gone in this sample.
>
>
>
>So far I haven’t been able to find a work-around.
>
>
AD
Administrator
Syncfusion Team
October 13, 2005 08:04 PM UTC
Anyone found a fix to this ?