Browse by Tags
All Tags » Behavior » Custom Controls (RSS)
Sorry, but there are no more tags available to filter with.
-
|
You have to implement a TypeConverter for your class and override the GetStandardValues and GetStandardValuesSupported method. In your override of GetStandardValuesSupported you have to return true. In your override of GetStandardValues you should return...
|
-
|
Set the Designer attribute for your custom dialog to be ComponentDesigner (instead of the default ControlDesigner). That should make it droppable in the design surface as a component. Contributed from George Shepherd's Windows Forms FAQ
|
-
|
You could override WndProc and listen for (0x114 WM_HSCROLL) and (0x115 WM_VSCROLL) messages (m.Msg will be set to the above values). These messages should be sent when the user scrolls. Contributed from George Shepherd's Windows Forms FAQ
|
-
|
Windows Forms features a ScrollableControl. This will work in most cases where you know the exact dimensions of your control and scroll by pixel. See the MSDN Documentation for ScrollableControl for discussion how to use this control. Sometimes you may...
|
-
|
AutoScrollingMinSize is setup in device coordinates. If you are using a world coordinate system other than pixels this means that you have to translate between world and device coordinates before you set this value. You can use the Graphics.TransformPoints...
|
-
|
AutoScrolling, as provided by ScrollableControl.AutoScroll , does not allow you to dynamically control the scrolling interval. If you are drawing a complex control such as grid then you want to be able to scroll based on the current row height, column...
|
-
|
Change the control's Anchor property so that it is anchored on all four sides. Please note that you can only have one control per form anchored in this manner, i.e., on all four sides. And other controls on the form should be anchored by their sides...
|
-
|
G. G. Arun Ganesh discusses these properties in Working with Anchoring and Docking Properties on C# Corner .
|
-
|
Say textBox1 and canelButton and the control names, then this is how you could do this: [C#] using System.ComponentModel; // Handler to the Validating event of the TextBox. private void TextBox_Validating( object sender, CancelEventArgs e ) { // Do this...
|
-
|
One way is to add code to your Validating handler and only execute the validation routine if the mouse is in the client area. This will avoid the click on the title bar and its system menu. You might also want to add special handling for the tab key so...
|
-
|
You can do so as follows in your Control: private void InvalidateWindow() { NativeMethods.RedrawWindow( Handle, IntPtr.Zero, IntPtr.Zero, 0x0400 | // RDW_FRAME 0x0100 | // RDW_UPDATENOW 0x0001 ); // RDW_INVALIDATE } Contributed from George Shepherd's...
|
-
|
You can do this in the DragDrop event handler of your control: [C#] using System.IO; try { // Use e.Data.GetData("UniformResourceLocator") to get the URL byte[] contents = new Byte[ 512 ]; Stream ioStream= (Stream) e.Data.GetData( "FileGroupDescriptor"...
|
-
|
You can set the control's Enabled property to false. This will prevent clicking but also gives the disabled look. There is a ControlStyles.Selectable flag that determines whether the control can get focus or not. But it does not appear to affect some...
|
-
|
The (DynamicProperties) item that appears on the Properties window is used for setting property initialization through an XML file named app.config. Dynamic properties allow you to change property values without recompiling the application, for example...
|
-
|
When custom initialization is to be done during runtime on certain controls, the best way is to implement the ISupportInitialize interface in that control. Then the BeginInit method will be called as soon as the control gets created, and EndInit will...
|
-
|
IDropTarget is a new interface that factors out the four drag drop methods - OnDragEnter, OnDragLeave, OnDragDrop, and OnDragOver - into an interface so that it can be implemented elsewhere. It is mostly an implementation detail.
|