Notifications
Clear all

[Closed] Mouse input window

 PEN

Well I’m having to rethink this. Although I have corrected some of the issues I was seeing when using pictureBox it is slow once I added all the other joy stick controls. I’m comming up on 17 controls and I just isn’t working fast enough. I have a couple of other change I’m going to make first but I don’t think that it will help. The next option will be to have two images, one is the background and the second the target and just move it. I thought it would be cleaner to do it all in one but it isn’t happing. I also tried using the backGroundImage param and then set a target to the image param but I can’t find a way to move it. I’m using pictureBox if you have any ideas.

 PEN

Oh and the size is 80×80 and the large one is 160 square.

Hi Paul,

Are you overriding the onpaint handler to draw the background grid or just setting the background image property? in my current implementation i’ve got a two label controls embedded in a user control, the background has a custom onpaint handler which draws according to properties on the joystick class. the actual widget that you move is a slightly rehashed moveable label control. as this inherits the label class propeties i have embedded an imagelist with the cursor appearance types. it is then simple to alter the shape of the widget. Since i am using predefined windows brushes for the grid background it is fast. I was worried about the onpaint refresh slowing it down, but it seems acceptable to me with the small test i have been doing. however, im hoping to iron out my last issues with getting feedback from the maxobject to the control and post the results.

I dont know why the picturebox is giving you slowdown issues, i reckon setting the image or backgroundimage property of a picturebox is slower than the onpaint handler of something like a label. The best i can understand it is that using the onpaint method uses a GDI+ graphics class for drawing and is much faster.

This is certainly evident in another dotnet project I have also been working on – I’ve been writing a new RAM player for sequence playback, and have been using GDI+ in order to speed things up. It is currently working about 3-4 times quicker than the one in max to cache frames.

 PEN

I’m not using on paint, just setting the backGroundImage and Image properties directly. I will look into the on paint and see what I get. It is slow as I’m drawing pixels but I didn’t think that it should be that slow.

I’ll let you know what I find today.

 PEN

I’m just reading up on the paint event, If I get this right it looks like you can determine where it paints, does this mean I can use it to position a the bitmap that I’m placing in the Image property?

yes – the way the onpaint will work is you pass it the background image and it is converted to a GDI graphics via Graphics.FromImage
then, you draw whatever you want on it (there are many brushes, shapes etc to do this) and then dispose of your resources when done.

this was one example of this but there’s absolutely loads around –
http://www.bobpowell.net/modifyImage.htm

if you want to overlay a bitmap of the cursor you can do this too with a transparent color passed as the background – there is an example here –

http://www.syncfusion.com/faq/windowsforms/faq_c3c.aspx#q657q

one additional option is that you could pass the cursor postion to the onpaint event and that would allow you to draw your overlay at the correct postion. i have used this on my ram player to paint the progress of the sequence load on the bottom of the frame, replacing the need for a progressbar. you can setup a case expression to handle different paint states according to properties of the class you are using.

again, there are quite a few ways of doing this, and this may not be the best for what you are doing but it will certainly be quicker.

 PEN

In looking through some of that it might just work. Thanks. I will probably get to this next week now, have to deliver the first tests today work work on targets more so I’m going to have to try and speed up the UI once the client complains about it:S

 PEN

Here is where I’m at with the UI, Lots more to go as far as tools go. I have done it all in a scritped modifier as I know that it will not change really for other characters and I find scripted plugins easier to deal with then CA defs.

You can use shift or alt to constrain moving to one axis or another. Shift+Ctrl to press the imbedded buttons and right click to get a pop up menu with the same options.

are you binding the movement to the tracks you are controlling – ie does it update on scrub, or just using it to set the values?

 PEN

It updates on scrubbing, I’m using time call backs when each of the rollouts is open to pass the data from the params to each control. I thought of using on get val events in the param block but that can get slow as well I have found unless you do a pile of management on them. Each time the file is opened for instance they will be called so load times go up unless you determine that it shouldn’t change.

Page 6 / 10