custom-controls

How to wire up a click event for a custom usercontrol button? Should I use CustomControl?

假如想象 提交于 2019-12-04 02:43:24
I wanted to create a button that had an image and a textblock as content. So I went about looking for an answer and found a post ( Reusable Custom Content for Buttons ) which told me to create a usercontrol. I did this and it works great. I can set the image source and text through dependency properties. However, I am stuck as there is no click event for my control. I did a little more digging and concluded that I probably need a CustomControl derived from Button. Is this correct? Or would it be better to wire up a click event to my UserControl? Here's my UserControl: <UserControl x:Class=

BlackBerry - ButtonField with centered Bitmap

这一生的挚爱 提交于 2019-12-04 02:35:33
问题 I have a class that extends from ButtonField : class BitmapButtonField extends ButtonField { private Bitmap _bitmap; private int _buttonWidth; private int _buttonHeight; BitmapButtonField(Bitmap bitmap, int buttonWidth, int buttonHeight, long style) { super(style); _buttonWidth = buttonWidth; _buttonHeight = buttonHeight; _bitmap = bitmap; } public int getPreferredHeight() { return _buttonHeight; } public int getPreferredWidth() { return _buttonWidth; } protected void layout(int width, int

Can't use onDismiss() when using custom dialogs - Android

Deadly 提交于 2019-12-04 01:44:42
I'm working on a little program, and I need to add a custom dialog that passes some info to the calling acitivity when it closes. I extended the dialog class, and when I try to capture the custom dialog when it closes,using an onDismiss listener, it never reaches it because I used a custom dialog. This is part of my activity - . . . attributes customizeDialog = new attributes(con,position,pick.getLastVisiblePosition()); customizeDialog.show(); (The attributes being the name of the class that extends the dialog class). Here is the event listener I set up when the dialog finishes -

Custom Button frame doesn't look as good as Round Rect UIButton

雨燕双飞 提交于 2019-12-04 00:28:24
问题 I'm trying to draw a custom button frame as follows: UIBezierPath *stroke = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:RECT_CORNECR_RADIUS]; [stroke stroke]; But for some reason the corner curves look thinker than the sides. If you look at the UIButton's default frame it's very uniform. A is a UIButton, B is a custom button. Any ideas how I can make it more like the UIButton. 回答1: You are stroking the bounds of your button. This will draw your line centred over the edge

Blackberry - how to animate Custom Field?

柔情痞子 提交于 2019-12-03 22:36:26
问题 I have created a custom field class "Seek" to draw a fillrectangle. class Seek extends Field { int fill; protected void layout(int width, int height) { setExtent(320, 5); } protected void paint(Graphics graphics) { graphics.setColor(Color.RED); graphics.fillRect(0, 0, fill, 5); } protected void setValue(int value) { fill = value; } } And I have created another class Test seek to set the fill value using a timer public class TestSeek extends UiApplication { public static void main(String[]

Add Custom Control to DataGridViewCell

佐手、 提交于 2019-12-03 21:12:02
问题 I create a custom control inherited from Windows.System.Forms.Controls. This is my code of this control: public partial class MonthEventComponent : Control { private Color couleur; private Label labelEvenement; public MonthEventComponent(Color couleur_c, String labelEvenement_c ) { InitializeComponent(); this.couleur = couleur_c; this.labelEvenement.Text = labelEvenement_c; this.labelEvenement.ForeColor = couleur; this.labelEvenement.BackColor = Color.White; this.labelEvenement.TextAlign =

ListView with a (half- and or) hidable header

旧城冷巷雨未停 提交于 2019-12-03 20:19:01
My Problem, is that I don't even know what to search for. I want a ListView. This ListView has some Elements with a "sticky" state. If I scroll down the List on the device, I want that all ListElements with state "sticky", to be sticky ontop of the list (non-scrollable) till there is another one "pushing it away". The rest of the elements are supposed to scroll as normal. I've seen that kind of List in the Google Market. If you have a big screen you can see that list on the Detailview of any app on the left side or if you have android JB, the same effect is on the google search bar in the

How to properly refresh a custom shape in WPF?

瘦欲@ 提交于 2019-12-03 18:11:37
问题 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

I want a beautiful custom window for my first cocoa app [closed]

感情迁移 提交于 2019-12-03 17:05:00
I'm a graphic designer - turned web designer - turned web developer - who is currently trying to turn into a mac developer. I've nearly done programming my first app. Is a very, very simple application but I'm happy because I'm learning a lot of new stuff. The problem is: I don't like how it looks. As you may guess, design is a very big deal for me, and I think that an app like this, that is very simple, should at least look very good. I'd like to do something like this: http://transmissionapps.com/ a custom window, with custom colors et all. I Think that I've already went trough half of the

Visual studio 2008 IDE not rendering Custom Controls correctly

半腔热情 提交于 2019-12-03 15:45:59
I'm having an issue at design time with all my forms and custom controls within Visual Studios 2008. Up until the previous check in, all of the controls were rendering as expected. The only main difference between the current version and the previous working version was that a Property on the control UIText was renamed from Content to Value . The other changes are adding a new form and 3 new enums, but there's certainly no obvious change that would affect all forms in the program (including new ones). All of the controls (on every form) now render as a box with the name of the control (however