iPhone UIWebView width does not fit after zooming operation + UIInterfaceOrientation change

I found something that worked for me. The problem is that when uiwebview changes its orientation web contents are zoommed to fit with viewport. But zoomscale parameter of scrollview subview is not updated correctly (nor are updated minimumZoomScale nor maximumZoomScale Then we need to do it manually at willRotateToInterfaceOrientation: – (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { CGFloat ratioAspect … Read more

Winforms DotNet ListBox items to word wrap if content string width is bigger than ListBox width?

lst.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable; lst.MeasureItem += lst_MeasureItem; lst.DrawItem += lst_DrawItem; private void lst_MeasureItem(object sender, MeasureItemEventArgs e) { e.ItemHeight = (int)e.Graphics.MeasureString(lst.Items[e.Index].ToString(), lst.Font, lst.Width).Height; } private void lst_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); e.DrawFocusRectangle(); e.Graphics.DrawString(lst.Items[e.Index].ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds); }

Convert css width string to regular number

If it always returns in px format, “100px”, “50px” etc (i.e. not “em” or percent), you could just… var width = parseInt($(“#myelem”).css(“width”),10); // always use a radix or var width = parseInt(element.style.width,10); // always use a radix It ignores the “px” suffix so you should be good to go. Although deep down I’m thinking that … Read more

Android dialog width

I had the same problem. I used following code to make dialog fill_parent and it worked fine. public class SharePost extends Dialog { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.adaptor_contentsharepost); LayoutParams params = getWindow().getAttributes(); params.height = LayoutParams.FILL_PARENT; getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); } } layout <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:id=”@+id/dialogWidth” android:layout_width=”match_parent” android:layout_height=”match_parent”> contents here </LinearLayout>

Word wrap a link so it doesn’t overflow its parent div width [duplicate]

The following is a cross browser compatible solution: #permalink_section { white-space: pre-wrap; /* CSS3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } From How do I wrap text with no whitespace inside a <td>? Check … Read more

CSS width 100% OR max-width in pixels

That’s in fact the intended use of max-width. If the computed (actual) width of an element exceeds max-width, it will be constrained to the max value instead of going beyond it. Percentage versus pixels isn’t relevant. Declare both in the same rule like this (no need for the calc() function): #somediv { width: 100%; max-width: … Read more