How to Round Out the Corners of a Rectangular Button on .axml (Visual Studios 2019, Xamarin Forms) - rounded-corners

I am newer to coding but, usually, when I have a question it is answered by a quick google search or video explaining my issue. The title is basically the question but I will elaborate: How do you round out the corners of a rectangular button in .axml? I have tried making a drawable folder with specific corner parameters set and applying that to the button background but it doesn't change the button in any way. I know that in .xaml you can simply use the CornerRadius tag but that isn't defined in .axml. Sorry if I am not being specific enough with my issue, like I said, I am new, but would be willing to elaborate further if need be.
Thank you all:)

Related

WinRT - ImageButton for transparent PNGs

I'm using XAML Toolkit ImageButton control to be able to create normal and pressed states for a button. Code is:
<toolkit:ImageButton NormalStateImageSource="ms-appx:///Assets/1_off.png"
PressedStateImageSource="ms-appx:///Assets/1_on.png"
Width="500"
Height="200">
</toolkit:ImageButton>
Issue I'm facing is, say I have a shape which isn't rectangle or square. For example I have PNGs for star and arrow object. Is there a way to set their boundary corresponding to shape? If not, please advice the best approach to handle such scenarios.
There are two options I tried
When clicking using mouse or touch - you'd check the last position of the pointer before click and see if the image in your button has a non-transparent pixel at that position.
Pros:
It's simpler than option 2.
You get most precise information
Cons:
You can't tell if a button got clicked with mouse, touch, pen, keyboard or by narrator using automation, so you could end up filtering out keyboard clicks just because the mouse cursor is a bit off. You could possibly use some heuristics like how long ago was the pointer move or pointer down event before the click event, but it's a bit hacky and might be unreliable.
Generate a vector path for your image and put it in the button template as a Path element with Fill="Transparent", then mark any other non-transparent or hit testable template elements (buttons, borders with Background="Transparent", etc.) as IsHitTestVisible="false".
Pros:
Doesn't break any input methods
Can be quite precise
For some shapes like a circle - the Path.Data could be quite simple or you could even use something like an Ellipse element instead
Cons:
You need to generate the path somehow
A complex path might adversely affect performance
A better solution overall in most cases is to leave the hit-testable area rectangular. The reason is - an arbitrary shape is a finicky and unreliable hit test target so it makes clicking your button more difficult. Using the default rectangular border or at most - an ellipse shape is a lot simpler and more usable.

Want To Create A Floating Speech Bubble Form

Wondering if someone could help me....
I have a small .NET application where I have an Edit button on a main form. When the user clicks the Edit button, I want to popup a small form right next to it (on top of the main form) with a speech balloon tail attached on the side of the form pointing to the Edit button. So it gives the effect of a floating form pushed out from the Edit button.
I don't want the appearance of a normal speech bubble, I want it to look like an actual borderless form (with square corners). It could be a custom control or anything (however, I am not yet familiar with creating my own custom controls), but I need to add Text Controls, Pictures, Label Controls, etc. to this floating form.
Any help would be appreciated.
Thanks
UPDATE
I am trying to create something to this affect:
So imagine the ? being the Edit button and the other being a form with custom controls.
Like this?
To get this behavior:
Select an image which will represent your speech bubble. Put a PictureBox on the form, make it use this image. Place two labels, as above, adjust the font.
Pick your transparency key (color). Your image background and form background need to be set to that. I used black for demo purposes, which is a bad choice if you plan to have any black or text in your speech bubble. Set form's TransparencyKey property to this color in designer. More about TransparencyKey on MSDN.
(final step, not shown on the screenshot). Set FormBorderStyle = None.
Also make sure you have other ways to close your bubble, because X will be unavailable.
The final result may look something like the following:
Note: You may notice some drawing artifacts, most images on the internet have smooth borders, and transparency key does not support shades, has to be exact color. If you are fine with these minor artifacts, feel free to leave it at that. Or, edit it to get rough borders. Or find another one that better suits your needs.

iOS Text Wrapping

In the app I am currently developing, I have to implement a screen which allows the user to ask a question. This screen contains a UIImageView next to the UITextView, taking up a portion of the space. It looks like the below image.
My question is, how can I wrap the UITextView text around the UIImageView, so that the text won't be in a block, but flowing around the UIImageView?
Thanks in advanced.
I don't think you can do this, unless your UITextView was a rich text or HTML editor, with the image embedded inside it. Basically what you're asking for is a non-rectangular UITextView. To the best of my knowledge, that is impossible in iOS, unless you were to create something brand new from scratch, which would be extremely complex. I have seen plenty of UILabel-style controls that can display HTML-like text, but not edit it.
EDIT: this might help: http://www.cocoanetics.com/2011/01/rich-text-editing-on-ios/
Unfortunately that's not a trivial issue as the UITextField does not provide any functionality that would be useful here.
However what you could do is to implement your own text view using UITextInput (for text input) and Core Text (for text display) and then define the drawing rectangle for Core Text (you can read more on Core Text here) from a custom CGPath that would exclude the images frame.
It does sound a bit complex (insane, perhaps), however as (nearly always) there are open source solutions that already found a solution. The OmniGroup framework contains custom text input controls based on Core Text and UITextInput. They're licensed under MIT License (well, moreless) so you should be just fine.

Xcode/iTunes/Instruments central toolbar item; what's it called and how do I create one?

I'd like to create a toolbar item like the central item seen in Xcode/iTune/Instruments/etc:
Can anyone tell me what it's called and how to go about creating my own?
Also, will I face problems getting my app approved by Apple when I submit it to the Mac App Store, for imitating Apple's own apps too much?
I finally implemented the solution from here:
iTunes or Xcode style information box at top of window
Here are the initial results:
This is an Apple's private control, but you cannot create it as a NSToolbarItem. Check this other Q/A to know how to add a custom view in the window's main frame.
Is it possible to draw in the label area of NSToolbar?
I've noticed some interesting things about Instruments:
If you make the window narrow such that the overflow menu is triggered, the items in that menu are all blank.
You can't change the icon size or turn labels on/off.
Colors does not have a label when you add it to the toolbar.
The labels on Space, Flexible Space, and Colors do not line up with the other items' labels.
These are interesting because they seem to fit an idea I had for implementing this: turn labels off, and give all your items custom views, where normal-looking items actually have manually drawn labels. It would obviously be a lot of work, but it gives you enough freedom to effectively do full-height items.
The nice thing is that, unlike the view/window hack that Xcode seems to use, you still have a customizable toolbar with draggable items.

Retaining Alpha channel on buttons in Outlook Toolbar

I am developing a COM Add-in using VB.NET in Visual Studio 2008 Pro for Outlook 2003 and am having trouble assigning images to custom toolbar buttons.
In a nutshell, I am having to convert from an Icon type to a stdole.IPictureDisp type so that I can assign my buttons a picture.
The picture displays, but it loses the Alpha channel and the background is no longer transparent. I can verify that before the conversion to IPictureDisp object, that the PixelFormat property is set to Format32bppArgb (2498570). I am using a coding technique suggested here: http://msdn.microsoft.com/en-us/library/ms268747%28VS.80%29.aspx.
For C# users, this link blogs.msdn.com/andreww/archive/2007/10/10/preserving-the-alpha-channel-when-converting-images.aspx (sorry I am newbie and can't post more than one link! Dumb rule BTW) shows how to modify the IPictureDisp one pixel at a time and rebuild the transparency, but I can't find similar functions in VB.NET...
I would appreciate any advice regarding this. Thanks.
If you read to end of the article the author notes in one of the comments that the command bars API doesnt support alpha channels on images. You can of course cheat a little, if you draw your image onto a bitmap that matches the background of the toolbar and assign that composite image to the toolbar button, you would have a toolbar image that "looks" transparent.