Control background not displaying the way I want - c#

Ok so I have a custom control and I am applying a background gradient to it. The control that it is in is set to anchor left and right and the image is set to Stretch on the control.
Here is what the background image looks like when its in the normal size of the form.
Here is what the background image looks like when the control is stretched.
Obviously I want it to look like the top one as far as the edges go. I am using Inkscape to develop the background image. Any help on how to avoid this blurry edge would be much appreciated.

I suggest trying 9 images in your control, one for every edge and one for every corner plus the middle container, maybe you've seen this technique in a lot of websites. If you set all images with good anchor, the top and bottom edges will stretch only sideways and the right and left will stretch upward and downward. The corners would never change and the container would be completly stretchable. I am worried about flickering though since it is in a winform. Worth trying.
If you use a fixed image, even if it is bigger and you shrink it, you'll lose the corners proportions.

When the system resizes the image it is approximating the missing pixels in the new stretched image. There is nothing you can do to prevent the blurring from occurring. The only sensible option I think is adding the image in higher resolution (which should be easy since you use Inkscape to create them) and have the system shrink it instead of stretch it.

Related

How do I make a chamfered corner using XAML?

I'm trying to make a chamfered corner on a custom control for Windows Phone 8. I'd like to achieve something much like the following:
http://jdcard.com/engl3007/arpln02.gif (I cannot post images yet because of my reputation)
I know it's possible to create a rounded corner, but I haven't had much luck at creating a chamfered corner. I'd like the corner to be only on the bottom right. The control should resize according to its contents.
Why not just create a control which puts an image with the desired effect in the background and aligned to the appropriate corner?

Any descent WPF Custom Window Theme, no border transparent with resize on simulated borders?

I've been looking around for quite a while now and can't really find a complete example and may just be missing some small element.
I'm trying to create a WPF Theme/Style/ControlTemplate/etc for a WINDOW. The one where Window borders set to none, allow transparency, and background set to transparent. So, yes, this means I have to define the buttons, borders, background, etc as I've found in other samples.
I've found a few links that utilize (and have that working) through the use of a "Thumb" control anchored to the lower-right.
What I'm missing is how to do resize from the respective borders that are constructed within the new ControlTemplate of the theme. I do have the buttons working for things like min/max/restore/close, but can't quite get how to handle the resize.
Thanks
I've used this link once. If I remember well, the resize border could be set to work as an arbitrary amount of pixels from the sides of the Window, even without a "real" border element.
http://www.codeproject.com/Articles/131515/WPF-Custom-Chrome-Library

WPF control for image manipulation

I need to load an image in a WPF window, an be able to read and modify individual pixels (in an efficient way), zoom the image (and scroll it), get the value RGB/grayscale of the pixel under the cursor, select areas (I guess knowing the cursor position and being able to modify pixels I could draw myself the square which represents the selected area)...
What is the best combination of WPF controls and classes to accomplish this?
I've been trying to do it loading a System.Windows.Media.Imaging.BitmapImage and putting it into a System.Windows.Controls.Image, but it's taking much longer than I expected.
Thank you very much
I once used this WPF Interactive Image Cropping Control. Go check it out, it should at the very least give you a good place to start. Oh, and welcome to Stackoverflow. :)

How to shrink a UISplitView

I've seen apps that place a colorful border or image around split view controls. To me, it looks like these apps add an image to the window, and then resize the split to be slight smaller then the screen.
How to change background graphic/theme in splitview on ipad?
http://www.iosinspires.me/category/appinterfaces/post/446/Timix_Interface.html
I've tried to manually resize the UISplitView by changing it Frame (UISplitViewwill resizes to cover screen), or by setting a border width, with a clear color (border is ignored when clear).
Does it look like the two examples used split views? Is that the correct control to use for this look?
Would this help?
https://github.com/mono/monotouch-bindings/tree/master/MGSplitViewController

Creating Overlay Control in winforms

I am using c# winforms to show an Image. The displaying of the image is done using a user control. Now I want to provide the user to draw lines, put other small images, write text etc over the image on an overlay control. How can I provide this functionality? If I use another user control to show the overlay control with transparent back, will that work?? any other solution will be welcome.
You might try approaching this with a canvas (Panel) that handles painting the image as the background and all the annotations/markup afterwards. This will make the foreground appear to be transparent. I expect you'll want to set Control.DoubleBuffer for performance.
You might experiment with setting the style ControlStyles.AllPaintingInWmPaint. Also, try overriding Control.OnPaintBackground and do nothing, and override Control.OnPaint and do all your painting inside there.
If performance is still unacceptable, pay close attention to the PaintEventArgs.ClipRect property. This is the only area you need to paint. The trick is figuring out which of your annotations/overlays intersect with this rectangle and painting them in the correct order.
Either this canvas or a higher level control will need to track mouse movement so you know where to draw the lines, paste images, etc.

Categories

Resources