.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Setting Width & Height on a WriteableBitmap

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :WPF
I am using a WriteableBitmap to convert System.Drawing.Bitmap - it seems to work nicely when I set the rect to 1024x768 like this: wbm.AddDirtyRect(new Int32Rect(0,0,1024,768); What if I want it to be dependent on screen resolution - if I do that, then it does not draw the Image fully - Any ideas on how to get it working for any resolution?

View Complete Post

More Related Resource Links

Setting the canvas height and width to Grid size


I have a canvas and I have it set to the following attributes


 Grid.Row="1" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="2"


However I want the canvas height and width to fill those locations. Also upon window resize i want the canvas height and width to adjust accordingly.

Any ideas? Thanks all

WPF control size is larger than explicitly set width and height values.

I created a Canvas with fixed Width and Height (256x256). Next to it I put an Image control displaying a 256x256 texture without stretching. How is it possible that actual sizes of both controls on the screen differ so much? Here - is the screenshot illustrating size mismatch. And here - the TestLines256.png in case someone liked to check it (and maybe point out that I'm stupid and this texture is 180x180 and not 256x256 as I claimed). XAML with creation of the controls:   <Window x:Class="OversizedQuad.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" SizeToContent="WidthAndHeight"> <StackPanel Orientation="Horizontal"> <Canvas Width="256" Height="256" Background="Red" /> <Image Stretch="None" Source="TestLines256.png" /> </StackPanel>

How to Control each cells width and height of a Table ?

Hi, I want to fix the size of each cells of a table . for that i used Style like this: <td style="width:10px;height:10px"> contents </td> But it seems that there is no any effect of applying these settings.How can  i set its width and height. It seems that it purely depends on the contents of cells. Now, if suppose there are two rows, <tr id='r1'> <td id='d1'> content of size 10px </td> <td id='d2'> content of size 10px </td> </tr> <tr id='r2'> <td id='d3'> Content of size 400px </td> <td id='d4'> content of size 20px </td> </tr>   Then cell of id 'd1' will get a size of 400px ,since its just below cell is of size 400px. I want to fix its size. Is that possible ?  

TabContainer Auto Height and Width


Hi all,

How i can set auto Width and Height? it can be resize according to the data populate inside TabPanel.

Thank You

Setting .net windows control location based on Screen width

I am developing an windows application in 20 inch moniter. I am positioning the controls in WPF like this

scrollViewer1.Height = Screen.PrimaryScreen.Bounds.Height / 5;

If I run this application in 15 inch monitor whether it will change the position of the control or it will give the look and feel what i expected.

Please clarify?

If it will chnage the positioning,please suggest how to poistion the control to support all screens widths.

Detect Width and Height of .jpg image



I have an image on this path that I first check if it exists. If it exists I wonder what the method is to get width and height of this image ?

            if (File.Exists(Server.MapPath("Images\\Pic1.JPG")))
		    //How to get the Width and Height of this JPG Image ?


New window with width and height identitical to the page content


hi all forum

I have my NewsDetails.aspx page which displays a certain news  in a gridview according to the NewsId query string field. i wish to make the user able to print the page or mail it to a friend  so I used the following code

protected void ArticleGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        if (e.CommandName == "print")
            int NewsId = int.Parse(e.CommandArgument.ToString());
            string url = "ForPrint.aspx?NewsId=" + NewsId;
            string js = "<script language='JavaScript'>window.open('" + url + "','" + ArticleLbl.Text + "',";
            js += "'top=0,left=0,status=no,width=710,height=700,resizable=no,scrollbars= yes');";
            js += "</script>";
            ClientScript.RegisterClientScriptBlock(this.GetType(), &

How to set the Monitor's Height and width to the Popup?.


I need the requirement in WPF like to set the Monitor's Height and width to the Popup. Just i want to open the Popup in the Full screen. Could you please anyone assist me on this?.

David C

How can I set web parts to always be a specified fixed width and height?

Is that possible? I don't want their size to be changed.

How to determine designer width and height



I'm trying to find the width and height of a given designer, given a model item.  I have code like this:

        if (modelItem.ItemType == typeof(FlowStep))
          action = modelItem.Properties["Action"].Value;
          view = action.View as WorkflowViewElement;
          view = modelItem.View as WorkflowViewElement;
        if (view != null)
          double width = view.ActualWidth;

          double height = view.ActualHeight;


The problem is that the height and width I get this way doesn't match the actual size of the designers, if the zoom is set to something other than 100%.  How do I get the actual width and height of a designer, regardless of the zoom setting?



How to set default Height/Width property value of Composite control?

This is my code:

class Regi : CompositeControl
private TextBox nameTextBox;    

[DefaultValue(typeof(Unit), "400px")]
public override Unit Width
return base.Width;

WPF: what does d:LayoutOverrides="Width, Height"mean?

When we use Expression Blend in TextBlock, sometime it automatically add

d:LayoutOverrides="Width, Height".

SP.UI.ModalDialog.showModalDialog options: how to set height or width in percentage or auto?


In the code below I set the options for the showModalDialog. the height and width are set to fixed 400 pixels, what other options have we here?

  • is it possible to remove the height and width? will the value be the default? what is the value of the default?
  • is it possible to set to a percentage? height: 50% ?
  • is it possible to set to auto or * ?

var options = { url: '/_layouts/COTW.Intranet/FinalizeCMR.aspx?items=' + myItems + '&source=' + SP.ListOperation.Selection.getSelectedList(), tite: 'Move Documents', allowMaximize: false, showClose: false, width: 400, height: 400, dialogReturnValueCallback: demoCallback }; SP.UI.ModalDialog.showModalDialog(options);


Web Part Error: "The Height and Width properties do not ..."


I,ve made a asp webpart based on two datagridviews, a textbox and a button. It works fine under asp.net, but when deployed under MOSS2007 it shows the textbox and button.

When the button is pushed (with a search argument) the following error apears.

Web Part Error: The Height and Width properties do not support proportional metrics (for example, 20%).

Can anyone tell me what this means?




how to set iframe height and width dynamically


how to set height and width of this iframe using jquery

"<iframe id=frame1 width='480' height='405' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'></iframe> <div id='loading'> Loading . . .    </div>  ";

Screen Height and Width


Hi all

I am displaying image on page load event.  I have difrent sizes image i want to get screen.width and screen.height values by javascript on page load event and then using to get particular size's image on page load event in asp.net with c#.

If browser not support javascript then default size will display.

Plz help to resolve this


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend