How do I make a chamfered corner using XAML? - c#

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?

Related

How to resize an image/chat bubble accordingly?

I am making something like the WhatsApp Chat. When you send a message, a greenish rectanglepops up with a small arrow on the top right hand which resizes according to the amount of text you put in.
I would like to ask for help in doing the same using Xamarin Android (C#)
How do I resize a rectangle according to the text one inputs??
Thanks!!
P.S. - Please provide me the greenish color of the rectangle whatsapp uses
I don't know how Xamarin does it but in Android we use 9-patch images for these kind of backgrounds. It is very simple actually. You can check the below links.
http://radleymarx.com/blog/simple-guide-to-9-patch/
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/nine-patches.html
Using a textview you can set a background for it.
add some padding so the text doesnt go off the edge.
if the background image is a bubble it should stretch to the text.(try use a slightly high res).

PictureBox with shadow [duplicate]

I am trying to figure out how to add a full shadow around a borderless form, using WinForms. I am looking at adding a shadow around all four sides of the form.
I have tried using the DropShadow class, although it only adds the shadow to the bottom and right side corners.
I have seen this question asked many times before in my searches but nothing I cam upon had an answer for all four sides.
I am using both C# and VB.net languages in my solution so any help regarding either language would be a big help.
You are going to have to manually draw this. I have done something similar before with a splash screen, I think. You need to decide the offset of the shadow from the client area of the form and either create a container (easier layout wise) to host its constituent controls or redefine its client rectangle programmatically if you need dynamic shadow size, and then draw your border. If memory serves, you will get the best results using alpha blending + lineargradientbrush to fade the shadow transparency out to the edges.

Control background not displaying the way I want

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.

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

WinForms (.NET) Button Anchoring when Maximized

Ok, I have googled, but maybe I put my search in weirdly. :/
I have a VB.NET WinForms application. I have the anchor properties set for all the controls so that it will resize all the controls to look decent when the form is maximized. (Haven't gotten around to manual resizing yet however).
Anyway, the problem:
I go to set the same properties for a button (testing with a single button for now) on the main GUI form/picture. When I go to run the program via F5, it looks decent. But when I maximize the form, the entire button covers up more than it should.
I've taken screenshots of the form so you can see a visual of what I'm talking about. :/
Before: http://zack.scudstorm.com/before.png
After: http://zack.scudstorm.com/after.png
What other propert(y|ies) do I need to set for the buttons to show up correctly? :/ (The buttons go over the boxes that say, for example, "1-1", "2-3", etc.
Thanks,
-Zack
Seems like you have anchored top-left and bottom-right when what you want is just top-left.
Edit: If it's just an image that does not change when the winform changes, then don't anchor your buttons at all. Just put them where they go. If you are scaling the image, then I would either detect the clicks on the image and do the scaling math or do the scaling math and set my buttons in code in the Form.OnResize event.
As it appears that your goal is just to be able to handle clicks on the "computers"...
One option that can be useful for this sort of task is to create an "overlay" bitmap (not displayed, but which is the exact same size as your source bitmap) which uses different colors to represent all the clickable regions. (e.g. (R=0,G=0,B=0) for computer 0, (0,0,1) for computer 1, etc)
You could even generate this bitmap somewhat automatically without too much trouble (If you have a mode where you can click the top left and then bottom right corners of the image to define a new region)
When the mouse is clicked, you can check the pixel at the scaled coordinates of the mouse position in the overlay and determine what their click corresponds to. This can be a lot easier than creating loads of controls, and makes it a lot easier to have clickable regions that aren't rectangular.

Categories

Resources