custom-controls

How to draw a custom border inside the non client area of a control with scroll bars?

陌路散爱 提交于 2019-12-01 01:59:04
问题 I have a custom control with both scroll bars enabled and I want to draw a simple red line border around the client area and the scroll bars, like in the image below. How I do this ? This is the control code: unit SuperList; interface uses Windows, Controls, Graphics, Classes, Messages, SysUtils, StdCtrls; type TSuperList = class(TCustomControl) protected procedure Paint; override; procedure CreateParams(var Params: TCreateParams); override; public constructor Create(AOwner: TComponent);

define Custom Event for WebControl in asp.net

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 01:31:22
问题 I need to define 3 events in a Custom Control as OnChange , OnSave , and OnDelete . I have a GridView and work with its rows. Can you help me and show me this code? 回答1: Good article which can help you to achieve your task: Custom Controls in Visual C# .NET Step 1: Create the event handler in your control as below. public event SubmitClickedHandler SubmitClicked; // Add a protected method called OnSubmitClicked(). // You may use this in child classes instead of adding // event handlers.

Blackberry - how to animate Custom Field?

Deadly 提交于 2019-12-01 01:09:59
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[] args) { TestSeek gbResults = new TestSeek(); gbResults.enterEventDispatcher(); } private TestSeek() {

Can't do custom UIButton in iOS6 with enabled storyboard autolayout

感情迁移 提交于 2019-12-01 00:43:30
I faced strange behavior. I'm using custom styled button which I setup in my controller: - (void)viewDidLoad { [super viewDidLoad]; [self.signOutButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.signOutButton setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; CAGradientLayer *btnGradient = [CAGradientLayer layer]; btnGradient.frame = self.signOutButton.bounds; btnGradient.colors = [NSArray arrayWithObjects: (id)[[UIColor colorWithRed:102.0f / 255.0f green:102.0f / 255.0f blue:102.0f / 255.0f alpha:1.0f] CGColor], (id)[[UIColor colorWithRed:51.0f

Two-Way Binding Issue of Unknown Object in WPF Custom Control Dependency Property

北慕城南 提交于 2019-12-01 00:42:10
I'm having a Custom Control - Implemented for AutoComplete TextBox. I got all idea's from the following question Create a Custom Control with the combination of multiple controls in WPF C# . In that Custom Control, they suggest the following code for adding item, its perfectly working and the Two-Way Binding too . (this.ItemsSource as IList<string>).Add(this._textBox.Text); But, I changed the following code to Unknown Object, so I changed IList<string> to IList<object> (this.ItemsSource as IList<object>).Add(item); XAML: <local:BTextBox ItemsSource="{Binding Collection}" ProviderCommand="

Can't do custom UIButton in iOS6 with enabled storyboard autolayout

不羁岁月 提交于 2019-11-30 20:26:42
问题 I faced strange behavior. I'm using custom styled button which I setup in my controller: - (void)viewDidLoad { [super viewDidLoad]; [self.signOutButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.signOutButton setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; CAGradientLayer *btnGradient = [CAGradientLayer layer]; btnGradient.frame = self.signOutButton.bounds; btnGradient.colors = [NSArray arrayWithObjects: (id)[[UIColor colorWithRed:102.0f /

Trying to change the Border Color of a label

家住魔仙堡 提交于 2019-11-30 16:24:43
问题 I'm working in VB, VS2008, winforms. I've got some labels to create, and I'm using the BorderStyle = FixedSingle. Is there any way to change the color of this border? It is always defaulting to black. 回答1: If you don't want to create a custom control you can try this: Hook up to the Label's paint event. void label1_Paint(object sender, PaintEventArgs e) { ControlPaint.DrawBorder(e.Graphics, label1.DisplayRectangle, Color.Blue, ButtonBorderStyle.Solid); } Taken from here by Andrej Tozon 回答2: I

Display multiple custom cells in a UITableView?

爷,独闯天下 提交于 2019-11-30 16:10:24
I am using Xcode 4.2 on SnowLeopard, and my project is using storyboards. I am trying to implement a UITableView with 2 different custom cell types, sessionCell and infoCell . I can get the 2 types to appear within the same list, but now I have a new problem?! The sessionCell is displayed once, and then X number of infoCells are displayed after it - just as I wanted - except that the first infoCell is always overwritten by the sessionCell ! - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.people count]; } //inside cellForRowAtIndexPath if

Creating custom layouts in BlackBerry

心不动则不痛 提交于 2019-11-30 16:08:22
问题 I want to create a RichTextField at the bottom half of the screen, while I paint my own custom graphics at the top half of the screen. Is that possible in BlackBerry? It tried defining a LayoutManager and trying to position the RichTextField at the bottom of the screen but the RichTextField, scroll through the entire screen. This is the code for the LayoutManager(). Is it the right way or is there any other way to do what I have mentioned above. class LayoutManager extends Manager { public

iPhone Custom UISlider preload and rounded edges issues

爱⌒轻易说出口 提交于 2019-11-30 16:07:57
I'm trying to implement a custom UISlider, I've extended it with a class called UISliderCustom which has the following code: @implementation UISliderCustom - (id)initWithCoder:(NSCoder *)aDecoder{ if(self == [super initWithCoder:aDecoder]){ self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, 200, 13); UIImage *slideMin = [[UIImage imageNamed:@"slideMinimum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; UIImage *slideMax = [[UIImage imageNamed:@"slideMaximum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; [self setThumbImage:[UIImage imageNamed:@