DragDrop - Change Cursor to USER-DEFINED CustomCursor - vb.net

Maybe I have missed something obvious. Currently I am using the feedback interrupt to change the cursor to one of the Windows supplied cursors (thanks to being put on the right track by Hans Passant in answer to a previous request for help - thanks).
Instead of using the pre-packaged cursors, is it possible to use my own custom-cursor (icon), and if so - are there any rules re size etc., or can I use something like a png/jpg etc.. ?
Regards,
Oliver

Yes, no problem. But it has to be a cursor, it can't be an image.
You can turn an image into an icon with Bitmap.GetHicon() method and pass that to the Cursor class constructor. It does however a very poor job on images that contain a lot of colors. The color mapping algorithm is miserable, in general that's something that's hard to do well. It is best to use a good graphics program. Check my answer here for a trick to use text as a cursor, using the same technique.

Related

How can I replace a full image placeholder by an empty one?

I would like to programatically delete image placeholders which are full (PlaceholderPicture objects in the python-pptx API)
and replace them with empty ones (PicturePlaceholder), the goal being to "refresh" pictures instead of always having to fill out an empty presentation.
I think I know how to delete a shape, but creating a new PicturePlaceholder proves harder than expected.
When I try to create one I am asked to provide a sp and a parent and I cannot find in the documentation what these parameters refer to.
Does my approach make sense, and if so is it possible to create new placeholders programmatically? Could anyone explain what are the parameters I should pass to the constructor?
Thanks in advance.
python-pptx has no API support for this, which means you would need to directly manipulate the underlying XML of the slide to accomplish it (and be outside the python-pptx "safety net").
sp is the shape element (generally an <p:sp> element, hence the name) and parent would be a reference to the slide.
As a general approach, I would create an empty placeholder and compare its XML to that of a "filled" placeholder which is the same in every respect. Then the job is to make one into the other.
Note that a picture placeholder has a relationship to the "image part" (e.g. PNG file) stored elsewhere in the PPTX package (.pptx file). This will need to be dealt with and not left dangling.
Another possibility is just to swap the image and leave everything else in place, which on paper at least would be less disruptive.
Because none of these options has API support, pursuing them involves taking on responsibility for a lot of details that python-pptx takes care of for you and learning a fair amount about the internals. If that sounds like something you'd rather avoid then you'll want to find another way to accomplish the broader outcome you have in mind.

Is there a way to write a LabView VI to do slow conversion on DIO lines?

I am not looking for an answer/solution to this problem, rather I am so so lost and just need help figuring out a starting point. Are there any controls or functions in the pallet that definitely need to be used. I know I will need a loop function to do this repeatedly...
I think there's some details not shared in the post above, but here's what's probably be asked:
Is there some broader context for the challenge in the image? Because it doesn't really make much sense as posted.
One thing that leaps out at me is talking about setting the digital value on the DIO lines. In LabVIEW DIO normally refers to a binary output or input, so it can only be 0 or 1. Maybe when they say "lines" they mean to use multiple DIO lines to output the value bit by bit?
It makes me think there's more to the question, for example a diagram showing that multiple DIO lines will be used in that way. Maybe there's another VI that sets the Vguess analog line too.

Dynamically changing style without using Dynamic Resource?

I want to define 2 styles, 1 for high end and 1 for low end. On initial app run, system determines which one to use.
I'm thinking how to implement this. I read about DynamicResource but also know about performance considerations using it (since I'm also targeting low end devices). This is a main style used by buttons through the app.
Is it possible to use Binding of the style? Something like Bind a static variable?
What would be the best approach for this?
Thank you!
You might want to look into TemplateSelector, it might help:
Here's an example...
http://www.jerriepelser.com/blog/3-ways-dynamic-data-templates

How do I serialise Lambdas and Event delegates when Tombstoning on the Windows Phone 7?

I've been using the Game State Management sample which has worked so far. I've hit a snag though: when Tombstoning, the screens are serialised; the only trouble is, the MessageBoxScreen has event handlers for Accepted and Cancelled.
What's the best way to serialise these? I did a bit of research on using Expression Trees but this seemed overly complex for what I wanted to do.
How do you serialise these? Or... What alternative approach do you use to save the state of a screen that contains delegates?
I'd definitely steer clear of attempting to serialize anything remotely resembling a lambda, or for that matter, named methods. Remember: you're storing state, and nothing else.
Depending on how far and wide your various assignments to these delegates are, you might be able to get away with maintaining a Dictionary<String, WhateverDelagateType>, serializing the keys and looking up the callbacks after deserialization.
Another thing to consider--I'm no expert, but reading between the lines it sounds as if you're working towards tombstoning a very temporary modal dialog. Do you really want that? You might be better off bringing your user right to the high scores table, or whatever follows your dialog, on his/her return.
I decided against this. I instead persists game flow as a kind of 'flow chart'.
The flow chart is declared in code and has properties 'LastShape' and 'LastResultFromShape'.
In my code, I rebuild the flow chart definitions each time, something like this:
flowChart.AddShape( "ShowSplash" );
flowChart.AddLine( "MainMenu", ()=>lastResult=="Clicked" || lastResult=="TimedOut");
flowChart.AddShape( "MainMenu");
flowChart.AddLine( #"ShowOptions", ()=>lastResult=="OptionsClicked");
flowChar.AddLine( #"ShowSplash", ()=>lastResult==#"TimedOut");
etc.etc.
The flow goes from the top down, so 'AddLine' relates to the last shape added.
After tombstoning, I just read the last shape and the last result and decide where to go in the flowchart based on that.

Modelica - how to implement a constructor for a record

What is the best way to implement a constructor for a record? It seems like a function should be able to return a record object in the instantiation of the record in some later model higher up the tree, but I can't get that to work. For now I just use a bunch of parameters at the top of the record that populate the variables stored in the record, but it seems like that will only work in simple cases.
Can anyone shed a little light? Perhaps I shouldn't be using a record but a model. Also does anyone know how the PDE functionality is coming? The book only says that it is coming, but I have seen some other things around.
I don't seem to have the clout to add tags (which makes sense, since my "reputation" is lower than yours) so sorry about that. I thought I had actually added one at one point, but perhaps I am mistaken.
I think you need to be clear what you mean by constructor since it has a very specific meaning in Modelica. If I understand your question correctly, it sounds like what you want to do is create an instance of a record that has some fields that are specified in the constructor arguments and from those arguments a bunch of other fields in the record are computed. Is that correct?
If so, there is a mechanism to do this. You mention "the book" but it isn't clear which one you mean. If it is mine, it definitely has no mention of these so called "record constructors" because it is too old. I do not know if Peter Fritzson's book mentions them either. However, they do exist and are documented in Section 12.6 of the Modelica 3.2 specification.
As for PDEs, there has been work into this kind of thing but nothing has really been done within the design group on this topic. I would add that if you want to solve either elliptical or parabolic PDEs on regular grids, this isn't too hard even with the current language. The only real drawback is that most tools probably don't handle sparsity very efficiently. Irregular grids would also be possible, but then you get into complicated basis functions. Finally, hyperbolic PDEs are, in my opinion, quite tricky (in any environment) due to the implicit physical constraints between time and space which are difficult to express (i.e. the CFL condition).
I hope that answers your questions so far.
I can only comment on your question regarding the book of Peter Fritzson. He confirmed that he's working on an update and he hopes to get it ready 'in the course of 2011'.
Original post here:
http://openmodelica.org/index.php/forum/topic?id=50
And thanks for initiating the modelica tag, I might be useful in the near future for me too... :-)
regards,
Roel