What’s new in the 1.1 framework?

This MSDN article by Chris Sells provides a good introduction to the 1.1 framework: http://msdn.microsoft.com/msdnmag/issues/03/03/WindowsForms/default.aspx For a list of breaking changes in 1.1: http://www.gotdotnet.com/team/changeinfo/default.aspx We will include more information here that is not covered in the above article. Please email any more info. you have to winformsfaq@syncfusion.com After preliminary testing, it seems like the reordering of tab pages in the TabControl by the design time seems to be fixed. Why do I have to use the STAThread attribute for my main method in my app.? What are some common gotchas while trying to embed a Windows Forms Control in IE?

How can the child controls be created in server controls?

Child controls can be created by overridding the CreateChildControl method as below using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebCustomControl1 { [DefaultProperty("Text")] [ToolboxData("<{0}:WebCustomControl1 runat=server> </{0}:WebCustomControl1>")] public class WebCustomControl1 : WebControl { public TextBox txtname = new TextBox(); public TextBox txtnum = new TextBox(); [Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Localizable(true)] public string Text { get { String s = (String)ViewState["Text"]; return ((s == null) ? String.Empty : s); } set { ViewState["Text"] = value; } } protected override void CreateChildControls() { Controls.Add(new LiteralControl("Name: ")); Controls.Add(txtname); txtname.Text = ""; txtname.ToolTip = "Enter a Username"; txtname.Attributes.Add("autocomplete", "off"); Controls.Add(new LiteralControl("</br>")); Controls.Add(new LiteralControl("EmpNo: ")); this.txtnum = new TextBox(); Controls.Add(txtnum); txtnum.Text = ""; txtnum.ToolTip = "Enter a Username"; txtnum.Attributes.Add("autocomplete", "off"); Controls.Add(new LiteralControl("</br>")); } protected override void RenderContents(HtmlTextWriter writer) { this.EnsureChildControls(); this.RenderChildren(writer); } } }

How can I stamp some text on an image?

The DrawingVisual can be used with a ‘BitmapImage’ instance and then rendered using ‘RenderBitmap’ class for creating custom rendered images. If text needs to be added, then use the ‘FomattedText’ instance. The following code snippet shows how to render an image with a text. [C#] BitmapImage bitImage = new BitmapImage() { UriSource = new Uri(@'C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg', UriKind.Relative), DecodePixelWidth = 200, DecodePixelHeight = 200 }; FormattedText text = new FormattedText('Winter', new CultureInfo('en-us'), FlowDirection.RightToLeft, new Typeface('Calibri', FontStyles.Normal, FontWeights.Normal, new FontStretch()), this.FontSize, Brushes.White); DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); drawingContext.DrawImage(bitImage, new Rect(0, 0, bitImagebi.Width, bitImagebi.Height)); drawingContext.DrawText(text, new Point(bitImage.Height / 2, 0)); drawingContext.Close(); RenderTargetBitmap renderBmap = new RenderTargetBitmap(bitImage.PixelWidth, bitImage.PixelHeight, 96, 96, PixelFormats.Pbgra32); renderBmap.Render(drawingVisual); // Encoding the RenderBitmapTarget as a PNG file. PngBitmapEncoder png = new PngBitmapEncoder(); png.Frames.Add(BitmapFrame.Create(rtb)); using (Stream stm = File.Create('new.png')) { png.Save(stm); }

How can I create and use a GridLengthConverter Object ?

The following example shows how to create and use an ‘instance’ of the GridLengthConverter object. The example defines a custom method called ‘changeCol()’, which passes the ListBoxItem to a GridLengthConverter that converts the Content of a ListBoxItem to an instance of GridLength. The converted value is then passed back as the value of the ‘Width’ property of the ColumnDefinition element. [C#] public void changeColVal(object sender, RoutedEventArgs e) { txt1.Text = 'Current Grid Column is ' + hs1.Value.ToString(); } public void changeCol(object sender, SelectionChangedEventArgs args) { ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem); GridLengthConverter myGridLengthConverter = new GridLengthConverter(); if (hs1.Value == 0) { GridLength gl1 = (GridLength)myGridLengthConverter.ConvertFromString(li.Content.ToString()); col1.Width = gl1; } else if (hs1.Value == 1) { GridLength gl2 = (GridLength)myGridLengthConverter.ConvertFromString(li.Content.ToString()); col2.Width = gl2; } else if (hs1.Value == 2) { GridLength gl3 = (GridLength)myGridLengthConverter.ConvertFromString(li.Content.ToString()); col3.Width = gl3; } }