custom-controls

How to make an ownerdraw Trackbar in WinForms

社会主义新天地 提交于 2019-11-29 21:39:53
问题 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

JavaFX custom control (TextField) not working

混江龙づ霸主 提交于 2019-11-29 18:28:30
问题 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

Data Binding not working for User Control's custom Property with Dependency Property (Output window is clean)

百般思念 提交于 2019-11-29 18:03:05
Note: I am not having problem with controls inside User Control like other similar articles on StackOverflow, I am having with a Property of the User Control itself. I am making a Custom Control based on Canvas, with a Dependency Property (using propdb template): public sealed partial class PresentationViewer : Canvas { #region Properties public ISlide PresentationSlide { get { Debug.WriteLine("Get PresentationSlide"); return (ISlide)GetValue(PresentationSlideProperty); } set { Debug.WriteLine("Set PresentationSlide"); SetValue(PresentationSlideProperty, value); this.ShowSlideContent(); } } //

BlackBerry - Custom centered cyclic HorizontalFieldManager

喜欢而已 提交于 2019-11-29 16:54:00
Trying to create a custom cyclical horizontal manager which will work as follows. It will control several field buttons where the buttons will always be positioned so that the focused button will be in the middle of the screen. As it is a cyclical manager once the focus moves to the right or left button, it will move to the center of the screen and all the buttons will move accordingly (and the last button will become the first to give it an cyclic and endless list feeling) Any idea how to address this? I tried doing this by implementing a custom manager which aligns the buttons according to

How to properly refresh a custom shape in WPF?

梦想的初衷 提交于 2019-11-29 16:14:35
I created a custom line with some text next to it. The shape is a subclass of System.Windows.Shapes.Shape . For some reason the text does not refresh when I change the coordinates for the line. I know about the InvalidateVisual() approach, but then every time I move elements around I would have to call it to redraw the shape. I am sure there is a better way of doing it. What am I doing wrong? ATM I am out of ideas. public class MyShape : Shape { LineGeometry line; FormattedText text; public MyShape() { line = new LineGeometry(); text = new FormattedText( Edge.Length.ToString(), Thread

ScrollBars are not visible after changing positions of controls inside a Canvas

放肆的年华 提交于 2019-11-29 16:08:59
I created a custom canvas control inheriting from WPF Canvas . I am using it like this in main window - <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <RTD:RTDesignerCanvas Margin="5" Background="White" x:Name="canvas1" Focusable="True" AllowDrop="True"> </RTD:RTDesignerCanvas> </ScrollViewer> Everything works fine but when I try to set the position of controls inside it like this Canvas.SetTop(item, 200); scrollbars are not visible and control is hidden down somewhere. Interestingly, if I add another control to it scroll bars are visible and I can

How to retrieve XML attribute for custom control

此生再无相见时 提交于 2019-11-29 11:18:14
I've created a combo box control with a edittext and spinner. I'm trying to let the android:prompt attribute be passed onto the spinner, which means I need to catch it in the constructor which passes my the AttributeSet and set it on the spinner. I can't figure out how to get the value of the prompt. I'm trying, int[] ra = { android.R.attr.prompt }; TypedArray ta = context.getTheme().obtainStyledAttributes(ra); int id = ta.getResourceId(0, 0); I get back 0, which means it didn't find the attribute. I also did a ta.count() which returned 0. So I'm not getting anything back. My XML simply

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

蹲街弑〆低调 提交于 2019-11-29 10:51:10
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. Seekbars in Android cannot have negative values. Assuming you have specified a value of '100' for your maximum range of the progress bar (for

Make a custom JScrollBar using an image

青春壹個敷衍的年華 提交于 2019-11-29 10:23:27
问题 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

Custom Designer for a Control

戏子无情 提交于 2019-11-29 09:31:12
问题 I've got a custom class which derives from SplitContainer: namespace Builder.Components { public partial class ProjectSidebar : SplitContainer { public ProjectSidebar() { InitializeComponent(); } } } Now when I right-click and select View Designer I'd like to see the SplitContainer and edit it, like I would with the default controls (drop a panel in it, etc.). All I see is a message to add controls and switch to Code view . How to achieve this? 回答1: In order to add design-time functionality