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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Modify drag&drop coursor, and modify the target rectangle

Thread ID:

Created:

Updated:

Platform:

Replies:

61360 May 24,2007 06:17 AM UTC May 31,2007 10:08 PM UTC WinForms 5
loading
Tags: GridControl
Daniel Dusek
Asked On May 24, 2007 06:17 AM UTC

Hi,
I need to modify the drag&drop mouse-cursor of the grid control. The cursor looks like an arrow with a small dashed box. I need to change the color of the box to red. Where can I do it?

Second question : when the cell (or row) is draged, then the target cell (or row) is marked with a dashed rectangle. I need to change the color of this rectangle to red as well. Where can I do it?

Can you send me some code-examples please?
Thank you!
Regards Daniel

haneefm [Syncfusion]
Replied On May 24, 2007 04:06 PM UTC

Hi Dan,

Issue 1 : Change Cursor.
>>>>>>>>>>>>>>>>>>>>>>>>>>
Below is a KB article that shows you "How do I change the mouse cursor in a GridControl?"
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=69

Issue 2 : Change DragDrop rectangle Color.
>>>>>>>>>>>>>>>>>>>>>>>>>>
This can be achieved in two ways. One technique will be to derive the grid control and override OnMouseDown method. Below is a sample that show this task.

Sample :DragDropGridControlV.zip

Another way will be to create your own mouse controller class to have the desired dragging effect. You need to replace the existing MouseController for dragging columns with an alternate MouseController in which you handle outlining the borders with color.

Please refer these forum threads for more information on this.
http://www.syncfusion.com/support/Forums/message.aspx?MessageID=29949
http://www.syncfusion.com/support/Forums/message.aspx?MessageID=35930

Best regards,
Haneef

Daniel Dusek
Replied On May 25, 2007 12:24 PM UTC

Hi Haneef,
thank you for your help so far. I am now trying to implement the first problem. I do it in the third way described in the example, which is a custom mouse-event-handler, a class which implements IMouseController. It works quite well, but I have one problem : I have to re-write the example from c# to c++ (I have to use c++). And I can't get the stream object from the cursor. The stream is always NULL:

System::IO::Stream * stream = control->GetType()->Module->Assembly->GetManifestResourceStream(S"HierarchicalGridNS::COPY4WAY.CUR");


Do you have some example in c++ as well? Or some hint how to create the stream object for the cursor in c++?

Thank you!
Regads Dan

haneefm [Syncfusion]
Replied On May 25, 2007 07:15 PM UTC

Hi Dan,

The reason for getting this issue is that you are not setting the "COPY4WAY.CUR" file build action as Embeded Resource. By default, it should be content. Please try the following steps to resolve this.

1) Open your application
2) Right click on the "COPY4WAY.CUR" file in the solution explorer and go the properties.
3) set the Build Action to Embeded Resource in properties.
4) Run your application.

Reading the information from the resource to a stream is performed with a method call to GetManifestResourceStream. The parameter that is passed to this method is the name of the resource that is to be accessed. The resources are named using the following convention: .. So if you embed a file named minus.bmp into your project in the MyNS namespace, you have a resource in the manifest named MyNS.minus.bmp.If you want to get resource streams, use the following code:

Bitmap bm = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("MyNS.COPY4WAY.CUR"));

The only tricky thing here is you need to prepend the name of your Assembly to the name of the resource stream. If you want to view all the resource streams available to you, use the following code:

Assembly a = Assembly.GetExecutingAssembly();
string resNames[ ] = a.GetManifestResourceNames();

foreach(string s in resNames)
{
Console.WriteLine(s);
}

Best regards,
Haneef

Daniel Dusek
Replied On May 30, 2007 11:46 AM UTC

Hi Haneef,
thank you very much, so far I have finished the first problem, the mouse cursor. By the way, in c++ it is not such a property like BuildAction. You have to do this : go to Project properties - Configuration properties - Linker - Input : 'Embed managed resource file' and write the name of the cursor file you want to use, e.g. 'OUR_DRAG_DROP.CUR' and recompile the project. Then this code will work :
__property System::Windows::Forms::Cursor * get_Cursor()
...
Control * control = m_gridControl->Parent;
while(control->Parent != NULL)
{
control = control->Parent;
}


System::IO::Stream * stream = control->GetType()->Module->Assembly->GetManifestResourceStream(S"OUR_DRAG_DROP.CUR");

if (stream != NULL)
{
m_mouseCursor = new System::Windows::Forms::Cursor(stream);
}

The file OUR_DRAG_DROP.CUR must be located in the same directory as the projekt.

BUT : the second problem is still not solved. I use my own mouse controller now, so I want to modify the target preselected rectangle in this controller. But where? How shoud I do this? I did not find the example 'MouseController', can you send me a link to it? The other examples you have mentioned did not helped me as well :-(.

Thank you so far, regards Dan

haneefm [Syncfusion]
Replied On May 31, 2007 10:08 PM UTC

Hi Dan,

Please follow the below forum thread for more details.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=61704

Best regards,
Haneef

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.

Warning Icon 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.Close Icon

;