Slot machine like control in WP7? - c#

I am writing a program for WP7 in C# where I would like to utilize a slot machine like effect where the numbers roll like they are mounted on a drum. Is there an efficient implementation of such a control? Any suggestions to implement such a control?

It sounds like you want something similar to the iPhone date picker, but for any set of numbers. A group called Bee Mobile released such a DatePicker in a control pack they are selling, which suggests that it can be done efficiently. You might find Nick Randolph's adaptation* of the wheel effect to the standard ListBox to be helpful. Depending on your requirements, you may be able to just alter the style to make that work for you. If not, a similar question at MSDN has a helpful outline of a possible approach among the replies:
build the basic elements
reuse and animate TextBoxes
add styling for 3D appearance
*The original post referred to on Nick Randolph's blog is here. It has a bit more explanation, and a screenshot.

Related

c# - changing the appearance of my windows form

I am developing a windows form. I want to change the physical appearance of the form and its controls. I was able to use the Skincrafter demo, however this is making the application substantially heavier. I am not satisfied with how "heavy" it feels when navigating through tabs, moving the window, etc. It's fairly simple program and I do not have this issue when not using skincrafter. When not using it, the GUI is very responsive and I want to keep it that way.
I've tried many different skins and the results are very similar in every case.
So I will not be using skincrafter unless someone points me out to possible reasons for this slower GUI. I followed their tutorial and didn't do anything else. Simple process. Before: fast GUI - after: slow GUI.
Can anyone recommend me another way to change the appearance of my controls/form? Is there way to programatically change the appearance of controls and form, without relying on a third party skinning software?
Note that I do not want my users to change skins. I want to apply one and that's it.
thank you
Steve
Edit:
The project is far from done so I am going to give WPF some real good thoughts so I don't end up doing this when I have a 4x times as large as it is right now.
I've already start converting and it shouldn't be much of problem. Found timer and serialport cannot be front from the toolbox and timer are replaced by dispatchtimer. No big deal so far.
One another thing that makes me want to work with WPF is that I may have the need to make graphs (plotting) to show temperature over time. I use serialport to communicate with an external USB controller (virtual COM port) that reads a bunch of temperature sensors and fan speeds. I suspect graphing to be better with WPF.
One last thing: it's just about colors/fonts but more about looks of the buttons, looks of the actual window (border shapes). What I wanted to do was something similar that is done with html and css. I do want to have custom labels to give them the look of a "digital display" for real time temperatures and fan speed measurements.
again thanks all for the help provided!
In the distant past, I added lightweight skinning to WinForms projects by subclassing the out-of-the-box controls (Label, TextBox, etc), and having that subclass read in appearance configuration (e.g. color, font) from an XML file (one could also use app.config).
That approach was easy to implement, and I saw no visible performance degradation.
If you just want a consistent, new look and don't need to enable the end user to pick from a variety of skins, the subclassing approach is very straightforward. For example, to modify the look of a Label:
public MyLabel : Label
{
MyLabel()
{
this.ForeColor = Colors.Blue;
}
}
Then, everywhere you currently have a Label in your code, use a MyLabel instead.
If you are starting a new project, I would highly recommend using WPF instead. It provides a much more flexible UI framework. One key feature is that it separates the look from the UI implementation.

What is the equivalent of a UITableView for WinForms

Is there any component that mimics or provides functionality similar to the iOSs UITableView? I want a nice list, with smooth animations on ordering, delete , custom items in list?
Is there any 'ready-made' open source or commercial component that gives me an equivalent for ordinary WinForms (no XAML/WPF)?
The basic WinForms ListBox has completely no animations or any kind of "nice looking appearance". You can check that pack http://www.telerik.com/products/winforms.aspx or devart analogue.
Since you're going to WPF (congratulations for that), you may want to have a look at the ReorderListBox control in the WPF Bag of Tricks.
It supports reordering by dragging items and the like. You can find the full source code and many interesting examples in the Bag.

How do I make a more sophisticated "Roller"?

How do I make a more sophisticated "Roller"?
I am looking for a good example of a percentage roller in Silverlight. (someone told me that they were called rollers)
The little default BusyIndicator is nice but I have a lot going on in the backgroud for a particular app and because of this, I want one of those rollers that give a percentage of how much time the use can expect to wait. I already have a way of determining what sort of percentage is going on. In other words, I know what sort of data to send the roller. Can anyone help me?
Use the ProgressBar control and override the ControlTemplate to make it look the way you want.
If I understood correctly you want to change custom BusyIndicator. Here are couple of articles that may help you:
Custom Busyindicator style in Silverlight 4
Ajax-style Style for Silverlight BusyIndicator?
And there is a lot of other nicely created styles for this Control. Try to google it.
Regarding ProgressBar take a look at The ProgressBar control in Silverlight.

c# Tree/MindMap GUI

i am trying to research some gui technology for c# where i can display a tree view (opposed to the standard one provided.)
Essentially i want to have the gui draw a tree of data (as if you were going to draw a binary tree on a piece of paper or something) Then making each of the nodes clickable.
If this isnt available does anyone know of something where i could have a mindmap type GUI which shows links between elements and those are clickable?
I can guess people will say make one yourself, in which case i give up already ;) thats too advanced for me and as i am on a work placement i dont think i would be granted the time to make it as there are more pressing issues to get working first, like actually making the programme work!
Thank you
You can take a look at the controls in Kevin's WPF Bag-o-Tricks which has a WPF mind map style layout. Here is a nice example. If you want to use more professional components take a look at the product from Nevron Software, they have some great controls. There is also an opensource WPF graphing library - graphsharp (which I have no experience with, but I found a nice article by Sacha Barber). Since it's used in nDepend it must be pretty mature.
I hope you get some inspiration from those links :)
I also found XMind API for C#
https://xmindapi.codeplex.com/
It's free and looks easy to use.

C#/.NET: Creating Dynamic Visuals in C#

NOTE: I am not exactly sure how to title or tag this question, so if you have any ideas, PLEASE help!
I'm currently envisioning a few possible projects that involve dynamically rendering something (whether it is a point, a line, text, or music notes on a staff, for hypothetical example), but, if I were to undertake these projects, I'm not really sure how to approach this design. What I'm curious about is sort of how programs like Word, or Geometer's Sketchpad, or Finale, create a blank "canvas" and render text, geometry, or music on it, respectively - how can this be done in C#, or in .NET, in general?
First of all, what is the best framework/platform to use: WinForms, WPF, something else? I'm open to many options, as I'm just trying to understand the different ways this can be done.
Next, how can I create such a "canvas" (if we go back to that metaphor) using the different frameworks you answered for part 1? And also, how can I render stuff onto it?
I hope my question isn't too confusing or n00bie. I just don't know how to approach such a prospect. Thanks!
UPDATE: I have now posted a follow-up question which is less broad. I have provided an hypothetical example of what I would like to accomplish. However, I will still accept an answer here, even though my question isn't fully answered.
WPF would probably suit your project well. I like the book Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, it covers most of the topics you're asking about.
You'll probably get better answers with a more focused question. The scope of your question is too large to be answered easily or concisely.
WPF makes it easier to refactor designs for such a project by easily moving shape drawing code between just drawing simple shapes and contents of controls. If you need the richness of custom controls, WPF allows a fairly smooth transition.
Most of the graphics can be defined in XAML which means you can export them from programs like Illustrator or anything that generates the standard SVG vector graphics, via an SVG-XAML converter.
I like WPF Unleashed and it has a nice discussion of 2D graphics and how to use the DrawingContext class for such a visual editor.
Do you know that there's an event called Paint? Everytime Windows OS needs to displays or repaint something on your form, this event is triggered. So, you create a Paint event handler, and everything is possible in that. For eg:
Word: you have a WordDocument data structure with the formatted tags and stuffs, you paint each character/ each word or each block of words one-by-one using a desired brush/paint and font. You might also wanna paint your background and stuff... If, for example the user change the font of 1 particular block, your WordDocument must change something to reflect that font change. And then you do an myForm.Invalidate() to repaint your form (and thus update your font). => Dynamically update your GUI.
Sketchpad: you need datastructures such as Line, Point, Triangle, etc. And then, each time OnPaint is triggered, you paint it dynamically. E.g: myGraphics.DrawLine(..), myGraphics.DrawCircle(..)
Similarly to Finale.
One thing you should do is to handle your data structure and drawing classes carefully, and instead of drawing everything in your OnPaint() method, you create several DrawMe(..) methods in your entity classes, and ask them to draw themselves. E.g: myCircle.DrawMe(..), myScore.DrawMe(..)
Hope that'll help,
Ben
There is no universal answer to your question - it is too generic.
Are you talking about dynamicly created controls, standard UI components (dropdowns, buttons)?
Is it vector graphics - like in drawings, or may be it is 2D image processing - or is it 3D?

Categories