custom-controls

How can I access the host of a custom element

旧时模样 提交于 2019-11-30 15:31:34
问题 I have a custom element which itself hosts a custom element. <polymer-element name="flex-nonvisual"> <template> <polymer-flex-layout></polymer-flex-layout> </template> </polymer-element> Now in attached() (or some other callback) of PolymerFlexLayout I want to set the class attribute of the flex-nonvisual element. In Javascript the code looks like this.parentNode.host.classList.add('someclass'); In Dart in attached() (after the call to super.attached() ) this.parent is null and I couldn't

How to make an ownerdraw Trackbar in WinForms

半城伤御伤魂 提交于 2019-11-30 14:44:29
I'm trying to make a trackbar with a custom graphic for the slider thumb. I have started out with the following code: namespace testapp { partial class MyTrackBar : System.Windows.Forms.TrackBar { public MyTrackBar() { InitializeComponent(); } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { // base.OnPaint(e); e.Graphics.FillRectangle(System.Drawing.Brushes.DarkSalmon, ClientRectangle); } } } But it never calls OnPaint. Anyone else come across this? I have used this technique before to create an ownerdraw button but for some reason it doesn't work with TrackBar. PS.

How to customize Button Control like this one?

故事扮演 提交于 2019-11-30 14:23:33
问题 I want to make a custom button control (image button is ok) like this one. I'm a new user, so I can't post image here. So I uploaded the picture here I'm kind of desperate right now after trying some tutorials Any suggestion is highly appreciated. Thanks Updated 08/10/2019 : I asked this question so many years ago, and at that time I didn't have the permission to upload image, so the image I uploaded to the third party site is long gone now. I got many requests about re-uploading the image,

Putting IME in a custom text box, derived from Control

心不动则不痛 提交于 2019-11-30 13:21:57
问题 I have created my own single-line textbox control in C# .net 3.5 I've written this completely from scratch, including my own selection code, scrolling, copy/paste etc. It can even select left-to-right text, not that I'd ever use that... The problem I'm having is with IME (input method editor) integration. The IME does work to an extent, but I have a few problems. I'll just list one of them here. Normally, using a TextBox, the IME construction is rendered inside the TextBox. However, in my

JavaFX custom control (TextField) not working

十年热恋 提交于 2019-11-30 12:44:55
I am trying to make a custom control with JavaFX and SceneBuilder 1.1. I have this code: FXML <?import libreria.javaFX.componentes.componenteTextField.*?> <AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml"> <children> <CustomComponent fx:id="pastaTxt" layoutX="69.0" layoutY="87.0" prefWidth="200.0" /> </children> </AnchorPane> CustomComponent.java package libreria.javaFX.componentes.componenteTextField; import javafx.scene.control.TextField; public class

When I use custom stars for Android RatingBar, always show half star for decimal values below 0.5

寵の児 提交于 2019-11-30 12:32:20
I've looked up a number of posts (e.g. Android RatingBar change star colors , Change the color of the stars in the rating bar where the rating bar is created dynamically in android , How can I set the star color of the ratingbar? ) in order to change the colours of the stars in the RatingBar. I followed the posts and was able to change the stars for the custom RatingBar, but in doing this I was no longer able to set the value to be a decimal lower than a half (e.g. 0.2). It would always show up as the half (e.g. 0.5). When I set the value to be above the half (e.g. 0.7) it displays perfectly.

Displaying custom icon for custom control?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 11:49:58
In visual studio when you create a custom control you get this ugly little purple gear thing for an icon of your control instead of a custom control . So how can I change the icon for my control? Simon Broadhead Use the ToolboxBitmap attribute on the class. Put your icon (for exemple "icon.bmp" 16x16 pixels) on the root folder of your custom control project Include this line just before your control class : [ToolboxBitmap(typeof(yourControl), "yourControl.bmp")] Here are further steps you need to take care of:- Verify your bitmap has the following properties : Height of 16 pixel Width of 16

How to customize Button Control like this one?

折月煮酒 提交于 2019-11-30 10:07:41
I want to make a custom button control (image button is ok) like this one. I'm a new user, so I can't post image here. So I uploaded the picture here I'm kind of desperate right now after trying some tutorials Any suggestion is highly appreciated. Thanks You could create a class that inherits from Button to keep all your styling in one place. To do the hover and pressed states you can override the mouse enter / leave events of the button and change style. Here is an example from one of our projects (I changed the colours but your get the idea). Where we change some colours you could switch the

wpf custom control not recognized

▼魔方 西西 提交于 2019-11-30 08:41:41
问题 This is my first foray into custom controls, and it's not going well. I have a custom graph control derived from Canvas. namespace Grapher2 { public class SeriesManager : Canvas { public SeriesManager() { ... } } } It's defined in the same project and namespace as my app. I tried adding a reference to the control in XAML as follows: <Window x:Class="Grapher2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns

Make a custom JScrollBar using an image

老子叫甜甜 提交于 2019-11-30 07:36:13
So I use Java Swing to build the UI for my app and use custom images to replace the ugly Java ones, the custom images have a style and are very easy to integrate into Java Swing. Right now my problem is I need to use a JScrollBar with a JScrollPane in an app and I really don't want to use either the default Java Scroll Bar or even the native OS Scroll Bar. I just want to be able to have a custom image be the Background of the scroll bar and an image to be the Thumb of the scroll bar. How to make a custom JScrollBar using an image? I wrote an example that shows how to set a custom image for the