I am trying to make some rotary knob with WPF and C#, .NET3.5; So right now what I am having is:
but instead, I really want to have something like these:
Anyone has any idea how I can make it look nicer? I am writing the WPF code from scratch. Thanks a lot.
You are using SolidColorBrush right now. Play with RadialGradientBrush instead to achieve the look.
You can create such an effect by finding a nice pictue of a knob, and then apply a rotatetransform on it.
If the picture contains the scale, you will need to edit that out to an other image, which can be under the knob picture.
Related
Here is the actual shape I want to draw using maybe view style properties or are there any alternatives, thanks
Depending on your needs I would choose something like react-native-canvas they have pretty much everything you gonna need to draw.
Other option would be GCanvas.
With those options you will be able to draw free forms as you wish
But there`s always the option to use SVG as well.
In my past experiences SVG forms solved most of the cases, but sometimes I had to use this canvas libs to draw some more complex or dynamic forms.
Hope this can be of any help to you.
I'm currently looking to achieve a gradient effect a bit like the rectangle in http://pjnicholson.com/Fireworks/fillgradients.htm
If I compromise a little I can get close to this using RadialGradientBrush... but is there any (not too painful) way to achieve the rectangular effect?
Use an ImageBrush instead and use this image (or a similar image generated using some image editor) for the background of your rectangle.
One solution a colleague and I came with was to derive a new Panel that used a WriteableBitmap as the source for its background.
The panel will give you the dimensions you need to make your WriteableBitmap. Using whatever algorithm you want you can fill it appropriately. In our case, we needed a radial or cone gradient, but the same concept applies.
Additionally, you can create several properties on your new control to specify the colors for the gradient. We adapted a LinearGradientBrush for our needs, but if you're working on just two colors, simple properties may suffice.
I don't have the code handy but will try to find it and post an update later. But the above should get you going.
I want to make a WPF Grid in which users can drag and drop controls from one cell to another and when the user is dragging I need to draw tips on the screen, like arrows. It's as if the tips were in ANOTHER LAYER in the screen. That is, they are not drawn IN the grid I mentioned.
The problem is: I don't know how to OVERLAP a "transparent" canvas over my Grid so that I can draw on it.
Do you experienced guys have some tip? THANKS.
I think what you are looking for are Adorners. You can read something about them here:
http://marlongrech.wordpress.com/2008/02/28/wpf-overlays-or-better-adorner/
Heres an example with a listView control, pretty good.
Heres a tut also decent.
And even a section in msdn
Is there any effect in WPF I could Make an image shiny etc.?
(I want to use it for a hovered image)
A mask or something like this would be great.
Try applying a BitmapEffect to the image, just keep in mind that they can be expensive to use.
OuterGlowBitmapEffect might help you.
It depends on what do you mean by "shiny". A simple way is to have each image opacity set to 0.5 and change it to 1 when mouse is in.
I'm looking for a WPF Gradient Picker example and source code.
The goal is to allow the user of a WPF application to pick the gradient brush to use for a background or foreground. I've seen pickers in Blend (too confusing for a casual user) and Photo Shop. I'm looking for a WPF implementation of something along the line of the Photo Shop picker implemented as a WPF dialog box.
Any pointers to good examples much appreciated.
Thanks.
Found it, this one too on the CodeProject: .Net Protoshop-like gradient picker. Enjoy ;)
Random gradient wallpaper generator. closest thing I could find... unfortunately it only has four possible gradient stops, one in each corner... worth looking at the code perhaps, and getting a few tips...
It seems like something that would be pretty easy to code, in terms of a custom control.
Just have a canvas that you change the background of, with some other controls for changing the colour and the stop points.