We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Weird problem with DragHelper/DragWindow

Thread ID:

Created:

Updated:

Platform:

Replies:

31814 Jul 14,2005 06:02 PM Oct 13,2005 04:04 PM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 14, 2005 06:02 PM

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

Administrator [Syncfusion]
Replied On July 14, 2005 06:19 PM

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

Administrator [Syncfusion]
Replied On July 15, 2005 05:47 AM

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.

Administrator [Syncfusion]
Replied On July 17, 2005 04:49 AM

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.

Administrator [Syncfusion]
Replied On July 18, 2005 09:58 AM

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. > >

Administrator [Syncfusion]
Replied On October 13, 2005 04:04 PM

Anyone found a fix to this ?

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;