Resizing componenets

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Resizing componenets

 
0
  #1
Sep 25th, 2009
Hi all,
Can anybody tell me hoe to resize a control to fit the width of the window when its resized. I'm trying to fit a webbrowser control and the panel its on to the width of the window if its resized.

Dave
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Resizing componenets

 
0
  #2
Sep 25th, 2009
Use the docking property. Set the DockStyle = DockStyle.Fill;
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Re: Resizing componenets

 
0
  #3
Sep 25th, 2009
Scott,
I am informed through a build error that the webbrowser object does not have a dockstyle property. The only similar one in the properties list is dock.

Dave
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Resizing componenets

 
0
  #4
Sep 25th, 2009
That is the one I meant.... set the property in the designer, not in code.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Re: Resizing componenets

 
0
  #5
Sep 25th, 2009
Scott,
I dont see a DockStyle property in the designer? Can you be a little more specific.

Dave
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Resizing componenets

 
0
  #6
Sep 25th, 2009
Use the "dock" property. You set webBrowser.Dock = DockStyle.Fill;
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Re: Resizing componenets

 
0
  #7
Sep 25th, 2009
Scott,
I found the fill property - the sqaure in the middle of the drop-down box - that was the missing piece of information. But now it expands to fill the entire tab that it is on - covering all the other controls. I need it to stay where it is - relative to its top left corner and resize from there, moving the position of the bottom right corner as I drag out the forms right and lower edges.

Dave
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Resizing componenets

 
0
  #8
Sep 25th, 2009
Unset the fill property and set the Anchor property Left, Top, Bottom, and Right.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: Resizing componenets

 
0
  #9
Sep 25th, 2009
See the attached project

Form1.Designer.cs :

  1. namespace fitwebbrowserindinwindow
  2. {
  3. partial class Form1
  4. {
  5. /// <summary>
  6. /// Required designer variable.
  7. /// </summary>
  8. private System.ComponentModel.IContainer components = null;
  9.  
  10. /// <summary>
  11. /// Clean up any resources being used.
  12. /// </summary>
  13. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  14. protected override void Dispose(bool disposing)
  15. {
  16. if (disposing && (components != null))
  17. {
  18. components.Dispose();
  19. }
  20. base.Dispose(disposing);
  21. }
  22.  
  23. #region Windows Form Designer generated code
  24.  
  25. /// <summary>
  26. /// Required method for Designer support - do not modify
  27. /// the contents of this method with the code editor.
  28. /// </summary>
  29. private void InitializeComponent()
  30. {
  31. this.webBrowser1 = new System.Windows.Forms.WebBrowser();
  32. this.SuspendLayout();
  33. //
  34. // webBrowser1
  35. //
  36. this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  37. | System.Windows.Forms.AnchorStyles.Right)));
  38. this.webBrowser1.Location = new System.Drawing.Point(-2, 129);
  39. this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
  40. this.webBrowser1.Name = "webBrowser1";
  41. this.webBrowser1.Size = new System.Drawing.Size(620, 250);
  42. this.webBrowser1.TabIndex = 0;
  43. this.webBrowser1.Url = new System.Uri("http://www.google.com", System.UriKind.Absolute);
  44. //
  45. // Form1
  46. //
  47. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  48. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  49. this.ClientSize = new System.Drawing.Size(618, 379);
  50. this.Controls.Add(this.webBrowser1);
  51. this.Name = "Form1";
  52. this.Text = "Form1";
  53. this.ResumeLayout(false);
  54.  
  55. }
  56.  
  57. #endregion
  58.  
  59. private System.Windows.Forms.WebBrowser webBrowser1;
  60. }
  61. }
Attached Files
File Type: zip fitwebbrowserindinwindow.zip (31.8 KB, 1 views)
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC