The ISupportIntegralResizing interface indicates that the implementing control supports integral resizing. A control implementing the ISupportIntegralResizing interface can be resized according to the "preferred" height and width defined in the interface's implementation. If the interface is not implemented, the control will be resized pixel by pixel.
Implementation
Implementing the ISupportIntegralResizing interface implies that definitions for the following properties and methods are provided:
Property/Method |
Description |
IntegralHeight property |
Indicates if the height of the control should be adjusted to completely display the last visible item in the dropdown. |
IntegralWidth property |
Indicates if the width of the control should be adjusted to completely display the visible items in the dropdown. |
GetPreferredHeight method |
Returns the height required to fit the maximum number of items within the specified height. |
GetPreferredWidth method |
Returns the width required to fit the maximum number of items within the specified width. |
The following example demonstrates how to use a UserControl (PictureViewer) that implements the ISupportIntegralResizing interface as a dropdown of a
WinButton control. Both
C# and
VB.NET implementations of the PictureViewer class are provided.
VB.NET |
Copy Code |
Dim button As New WinButton button.ButtonType = New ButtonType( ButtonBackgroundImageType.Close, ButtonImageType.Plus )
Dim images As New ArrayList
images.Add(New Bitmap( "D:\images\first.bmp" ) ) images.Add(New Bitmap( "D:\images\second.bmp" ) ) images.Add(New Bitmap( "D:\images\third.bmp" ) ) images.Add(New Bitmap( "D:\images\fourth.bmp" ) ) images.Add(New Bitmap( "D:\images\fifth.bmp" ) ) images.Add(New Bitmap( "D:\images\sixth.bmp" ) )
Dim viewer As New Xceed.Editors.Samples.PictureViewer( images )
button.DropDownControl = viewer AddHandler button.Click, AddressOf Me.button_click
button.Location = New Point( 10, 10 ) Me.Controls.Add( button )
Private Sub button_click( ByVal sender As Object, ByVal e As EventArgs ) CType( sender, WinButton ).DroppedDown = Not CType( sender, WinButton ).DroppedDown End Sub
|
C# |
Copy Code |
WinButton button = new WinButton(); button.ButtonType = new ButtonType( ButtonBackgroundImageType.Close, ButtonImageType.Plus );
ArrayList images = new ArrayList();
images.Add( new Bitmap( @"D:\images\first.bmp") ); images.Add( new Bitmap( @"D:\images\second.bmp") ); images.Add( new Bitmap( @"D:\images\third.bmp" ) ); images.Add( new Bitmap( @"D:\images\fourth.bmp") ); images.Add( new Bitmap( @"D:\images\fifth.bmp") ); images.Add( new Bitmap( @"D:\images\sixth.bmp") );
PictureViewer viewer = new Xceed.Editors.Samples.PictureViewer( images );
button.DropDownControl = viewer; button.Click += new EventHandler( this.button_click );
button.Location = new Point( 10, 10 ); this.Controls.Add( button );
private void button_click( object sender, EventArgs e ) { ( ( WinButton )sender ).DroppedDown = !( ( WinButton )sender ).DroppedDown; }
|