custom-controls

Creating a custom progress bar with images

▼魔方 西西 提交于 2019-11-28 09:31:47
Pretty much what I am trying to do, is create the following image: So this is a progress bar, which will show how many votes the client get in that option. How can I do that? I was wondering if I can use a mask (as I would in flex), but all the masking implementations that I found on the web are doing masks for UIImage s, and not for UIImageView . I cannot do the mask in the UIImage , because the two images have the same dimensions. I have to use the X and Y of the images to crop them?! So, any suggestions? Here are the two images that I have to create that progress bar: Cheers. you want to

Button template with image and text in wpf

前提是你 提交于 2019-11-28 09:12:54
I want to create buttons with images and text inside. For example, i would use different images and text for buttons like 'Browse folders' and 'Import'. One of the options would be to use a template. I had a look at simliar question Creating an image+text button with a control template? But is there any way by which i can bind the source of image without using a dependency property or any other class? Thanks No. What would you bind the Image.Source to? You need a DependencyProperty for this. Of course, you could also define a normal class which contains two properties: Text and ImageSource or

How can a control handle a Mouse click outside of that control?

假装没事ソ 提交于 2019-11-28 07:22:36
I'm writing a custom control and I'd like the control to switch from an editing state to it's normal state when a user clicks off of the control. I'm handling the LostFocus event and that helps when a user tabs away or if they click on to another control that's Focusable. But if they don't click on something Focusable, it won't switch out of it's editing state. So I have two solutions in mind: Walk up the tree to the top most element when it goes in to an editing state and add a handler for MouseDownEvent (and handle "handled" events). In the handler I'd kick the control out of it's editing

Google map v2 Custom Infowindow with two clickable buttons or ImageView

流过昼夜 提交于 2019-11-28 06:52:37
I need custom info window with two clickable button as above.In it when more then marker and click any one of them then window should be open and when click on another marker another window should open and close previous window as well in single click. is there any specific reason why google map v2 not support live component like button ,check box? MaciejGórski What you are trying to achieve is possible. You can see the recipe in this answer: https://stackoverflow.com/a/15040761/2183804 And a working implementation on Google Play . swati srivastav MainActivity.java @TargetApi(Build.VERSION

How do I make a seekbar whose initail progress which is zero, starts in the middle

一笑奈何 提交于 2019-11-28 04:43:51
问题 I want to customize the SeekBar as shown below in the image. I'm a beginner in programming and I looked for tutorials, but every where the progress starts in the leftmost corner. Can someone please guide me how can I customize the SeekBar. So In onProgresschanged. @Override public void onProgressChanged(SeekBar seekBar,int progress, boolean fromUser) { brightness = progress; putGestureImageOnScreen(doBrightness(imageBitmap, brightness)); } Thanks. 回答1: Seekbars in Android cannot have negative

Setting Focus to a .NET UserControl…?

本秂侑毒 提交于 2019-11-28 03:10:12
问题 I'm creating a custom control derived from UserControl that I would like to set focus to. The custom control contains a ComboBox control and I draw some strings beside it. The ComboBox can receive focus, but I would like to be able to set focus to the UserControl itself. My OnPaint handler is set up to draw the control slightly differently if it has focus but I call CanFocus() from the parent form when I create my custom control and it returns false. Is there a property or something to set?

How to add a Custom Windows Forms Control into Visual Studio Toolbox

混江龙づ霸主 提交于 2019-11-28 02:22:55
I want to add my custom control into the VS Toolbox. But I need it to appear in toolbox always when a new project is open. How can I do that? Create a VSIX package to install the control You can create a VSIX package to distribute and install user controls to toolbox. To do so, you can create a VSIX Project and add a Windows Forms ToolBox Control to the project. The control is decorated with a ProvideToolboxControl attribute which determines the tab that the control will appear in. You can pass an existing or a new tab name to the attribute: [ProvideToolboxControl("Some Tab Name", false)]

Convert Shape into reusable Geometry in WPF

房东的猫 提交于 2019-11-28 02:06:16
I am trying to convert a System.Windows.Shapes.Shape object into a System.Windows.Media.Geometry object. With the Geometry object, I am going to render it multiple times with a custom graph control depending on a set of data points. This requires that each instance of the Geometry object has a unique TranslateTransform object. Now, I am approaching the issue in two different ways, but neither seems to be working correctly. My custom control uses the following code in order to draw the geometry: //Create an instance of the geometry the shape uses. Geometry geo = DataPointShape.RenderedGeometry

NumericUpDown with Unit | Custom control | Field padding

前提是你 提交于 2019-11-28 01:24:33
Im trying to create a custom control that inherits NumericUpDown to show a settable unit. This is (visually) what I've got so far: My Code: Looks a bit long, but isnt doing that much class NumericUpDownUnit : NumericUpDown { public event EventHandler ValueChanged; /// <summary> /// Constructor creates a label /// </summary> public NumericUpDownUnit() { this.TextChanged += new EventHandler(TextChanged_Base); this.Maximum = 100000000000000000; this.DecimalPlaces = 5; this.Controls.Add(lblUnit); lblUnit.BringToFront(); UpdateUnit(); } public void TextChanged_Base(object sender, EventArgs e) { if

Wpf custom control template - relative font size

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 00:50:04
问题 I am creating a custom WPF control that let's say for simplicity sake has a vertical stack panel with a "title" TextBlock, followed by a ContentPresenter. I want the font size for the "title" to be 5 Points LARGER than the size used in the content, which is inherited by whatever container the user places this control in. How can I specify a font size in the control template for the header element using a relative value without exposing a property like "TitleFontSize" to the user? I want do