custom-controls

Changing the border color of a Combobox on focus

∥☆過路亽.° 提交于 2019-12-01 08:09:11
问题 I have a custom ComboBox . I want to give a custom BorderColor to the ComboBox , when it is focused. To do this, I'm using the following code: Graphics g = Graphics.FromHwnd(Handle); Rectangle bounds = new Rectangle(0, 0, Width, Height); ControlPaint.DrawBorder(g, bounds, BaseConfigurations.StyleColor, ButtonBorderStyle.Solid); The thing is, if I use the code inside the MouseHover event when I move the mouse on the ComboBox control, I can see that it works. However, the same code does not

Get the ID of a custom Control

我是研究僧i 提交于 2019-12-01 08:02:43
I have a fairly complex Custom Control that may be used multiple times on any given XPage. In the control I create a couple of viewScope variables that have to be unique to the specific custom Control. I would like to do something like viewScope.put(customControlID + "variableName","Stuff) But I don't know how to get the custom controls ID You can get the current custom control ID with this.getId() at the <xp:view> level. If you put this ID into a compositeData variable (e.g. compositeData.id ) then you can use the ID inside the custom control everywhere you want. <xp:view xmlns:xp="http://www

Create a Custom Control with the combination of multiple controls in WPF C#

有些话、适合烂在心里 提交于 2019-12-01 07:46:01
问题 I wish to create a Custom Control, it should be a combination of predefined controls like Textbox, Button, ListBox, etc., Kindly refer the following Controls (Just a Sample) <Grid.RowDefinitions> <RowDefinition Height="30" /> <RowDefinition Height="50" /> </Grid.RowDefinitions> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="300" /> <ColumnDefinition Width="100" /> </Grid.ColumnDefinitions> <TextBox Grid.Column="0" /> <Button Grid.Column="1" Content="Add" Margin="20,0" /> </Grid>

Get the ID of a custom Control

廉价感情. 提交于 2019-12-01 06:05:08
问题 I have a fairly complex Custom Control that may be used multiple times on any given XPage. In the control I create a couple of viewScope variables that have to be unique to the specific custom Control. I would like to do something like viewScope.put(customControlID + "variableName","Stuff) But I don't know how to get the custom controls ID 回答1: You can get the current custom control ID with this.getId() at the <xp:view> level. If you put this ID into a compositeData variable (e.g.

ASP.NET custom control, can template fields have attributes?

。_饼干妹妹 提交于 2019-12-01 05:40:35
问题 For example: <uc:AdmiralAckbar runat="server" id="myCustomControl"> <Warning SomeAttribute="It's A Trap"> My Data </Warning> </uc:AdmiralAckbar> I'm not sure how to add SomeAttribute. Any ideas? Code without the attribute is: private ITemplate warning = null; [TemplateContainer(typeof(INamingContainer))] [PersistenceMode(PersistenceMode.InnerProperty)] public ITemplate Warning { get { return warning; } set { warning = value; } } 回答1: The answer is yes. For this you should create a type which

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

不问归期 提交于 2019-12-01 05:14:54
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); override; end; implementation procedure TSuperList.CreateParams(var Params: TCreateParams); begin inherited

creating custom button in gwt

孤街浪徒 提交于 2019-12-01 04:35:16
问题 I am trying to do something pretty common with GWT - creating a button behavior with an image and a text by positioning the text on top of the image. I have used the HTML widget but how can I make the text not selectable? 回答1: I recently had the same need for a GWT button which allows to add image AND text. So I coded one myself since the already available implementations didn't work. I wrote a post on my blog but I also copy the code here: Here's the code for my custom button import com

define Custom Event for WebControl in asp.net

孤街浪徒 提交于 2019-12-01 04:01:06
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? Pranay Rana 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. protected virtual void OnSubmitClicked() { // If an event has no subscribers registered, it will //

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

拜拜、爱过 提交于 2019-12-01 03:23:05
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. You are stroking the bounds of your button. This will draw your line centred over the edge the view, so half of the thickness of the line is outside the bounds and is not drawn. This is why it is

Overriding init() in a CustomUIView crashes app (EXC_BAD ACCESS)

て烟熏妆下的殇ゞ 提交于 2019-12-01 03:21:55
I am trying to subclass a UIView in Swift. Howver the app crashes (EXC_BAD_ACCESS) when the initializer is called Here is the class class CustomActionSheet: UIView { private var cancelButtonTitle: String!; private var destructiveButtonTitle: String!; private var otherButtonTitles: [String]!; convenience init() { self.init();//EXC_BAD_ACCESS } required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder); } convenience init(cancelButtonTitle: String!, destructiveButtonTitle: String!, otherButtonTitles: [String]!) { self.init(); self.cancelButtonTitle = cancelButtonTitle; self