Blackberry – how to resize image?

You can do this pretty simply using the EncodedImage.scaleImage32() method. You’ll need to provide it with the factors by which you want to scale the width and height (as a Fixed32). Here’s some sample code which determines the scale factor for the width and height by dividing the original image size by the desired size, … Read more

Custom UITableViewCell programmatically using Swift

Let’s make a few assumptions: You have an iOS8 project with a Storyboard that contains a single UITableViewController. Its tableView has a unique prototype UITableViewCell with custom style and identifier: “cell”. The UITableViewController will be linked to Class TableViewController, the cell will be linked to Class CustomTableViewCell. You will then be able to set the … Read more

Raise an event when I hover the mouse over a ComboBox item

You can create a Custom Control, derived from ComboBox, override its WndProc method to intercept the CB_GETCURSEL message. Call base.WndProc(ref m) first. When the message is processed, the Message object’s m.Result property is set to a value (as IntPtr) that represents the Item currently tracked in the ListBox (the Item highlighted when the Mouse Pointer … Read more

Blackberry – fields layout animation

This effect may be easily achived with custom layout: class AnimatedManager extends Manager { int ANIMATION_NONE = 0; int ANIMATION_CROSS_FLY = 1; boolean mAnimationStart = false; Bitmap mBmpBNormal = Bitmap.getBitmapResource(“blue_normal.png”); Bitmap mBmpBFocused = Bitmap.getBitmapResource(“blue_focused.png”); Bitmap mBmpRNormal = Bitmap.getBitmapResource(“red_normal.png”); Bitmap mBmpRFocused = Bitmap.getBitmapResource(“red_focused.png”); Bitmap mBmpYNormal = Bitmap.getBitmapResource(“yellow_normal.png”); Bitmap mBmpYFocused = Bitmap.getBitmapResource(“yellow_focused.png”); Bitmap mBmpGNormal = Bitmap.getBitmapResource(“green_normal.png”); Bitmap … Read more

What is the difference between a User Control Library and a Custom Control Library?

In practice custom controls are something you implement on the code level while you can use XAML for user controls. The custom controls extend one of the WPF control base classes and provide additional functionality through code so all the added logic and representation must be implemented inside the code. A user control is technically … Read more

Using Custom Colored Cursors in a C# Windows Application [closed]

The Cursor class is rather poorly done. For some mysterious reason it uses a legacy COM interface (IPicture), that interface doesn’t support colored and animated cursors. It is fixable with some fairly ugly elbow grease: using System; using System.ComponentModel; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Reflection; static class NativeMethods { public static Cursor LoadCustomCursor(string path) { … Read more

How to make an expandable/collapsable section widget in Qt

I stumbled upon the same problem and solved it by implementing the collapsible widget as a QScrollArea whose maximum height is animated by a QPropertyAnimation. But since I don’t use QDesigner, I can’t tell you if it works there. I still have one problem: Instead of only expanding towards the bottom direction, the collapsible widget … Read more

Android – custom UI with custom attributes

Yes. Short guide: 1. Create an attribute XML Create a new XML file inside /res/values/attrs.xml, with the attribute and it’s type <?xml version=”1.0″ encoding=”UTF-8″?> <resources> <declare-styleable name=”MyCustomElement”> <attr name=”distanceExample” format=”dimension”/> </declare-styleable> </resources> Basically you have to set up one <declare-styleable /> for your view that contains all your custom attributes (here just one). I never … Read more