Resizing an ActiveX control in RadForm

Article Info

Rating: Not rated

Article information

Article relates to

 RadForm for WinForms

Created by

 Tsvetan Raykov, Telerik

Last modified

 June 23, 2008

Last modified by

 Tsvetan Raykov, Telerik


 
HOW-TO
Resize an ActiveX control in RadForm

DESCRIPTION
Currently RadForm does not resize ActiveX controls that are anchored or docked inside the form. For example this issue occurs when a WebBrowser is dropped on a RadForm and the form is maximized at run time.

SOLUTION
The solution is to resize the ActiveX control when resizing the form:
  1. Set an appropriate size for your ActiveX control.

    this.webBrowser1.Size = new System.Drawing.Size(1024, 768); 

  2. Process the Resize event of the form.

    Resize += new System.EventHandler(this.frmWindow_Resize); 
    private void frmWindow_Resize(object sender, EventArgs e) 
        Point pt = (Point)this.Size; 
        radTitleBar1.Width = pt.X; 
        webBrowser1.Width = pt.X - 20; 
        webBrowser1.Height = pt.Y - 30; 
     
The above will allow you to expand and contract the window by using the form's handles or using the Maximize/Restore on the title bar. If you have a custom title bar this code will also allow it to resize  according to the window size.
 

Comments

There are no comments yet.
If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.