Posts Tagged ‘refresh’

Mono WinForms layout and invalidate issues

Issue 1: Layout of anchored, non-visible control

I had a custom subcontrol anchored left and right within a parent control. The subcontrol was not visible and would only appear when I called a function to make it visible. The parent control had a default width and height, of course, but would be resized as necessary when placed on a form. With Mono, after being placed on a form, the anchoring seems to take effect based on the default dimensions of the control, not the dimensions of it in the form. This, of course, results in the subcontrol being an incorrect size and position.

I haven’t found a solution to this issue as yet.

Issue 2: Repaint after SuspendLayout/ResumeLayout

When adding a number of custom subcontrols (Dock=Top) to a Panel, I called SuspendLayout() before adding them, and called ResumeLayout() after. The height of the controls are adjusted right after they are added to automatically fit a word-wrapped block of text. On Mono, the Panel is never repainted (meaning the custom controls are never repainted either, and its text is not shown).

Calling Refresh() or Invalidate() after ResumeLayout() solves this issue.


I was with the Windows 7 RC yesterday and noticed something really cool. I was watching a video on Hulu (using the web client) and as the mouse hovered over the Internet Explorer icon in the taskbar, I noticed the thumbnail view of the page was a live rendering, showing the video playing in real-time. It’s perhaps not terribly useful but it is pretty cool and a testament to what can be achieved on modern hardware.

Thinking along the lines of powerful hardware and immediate feedback and representation, I was, unfortunately, struck with this disappointing bit,

windows 7 folder refresh

The folder refresh option in the context menu. It’s somewhat sad that this still exists and updated data from the file system isn’t polled, updated, and displayed automatically by the OS. (There may very well be valid reasons for not doing this [e.g. cost due to hard disk seek + latency] but it’s disappointing none the less.)

I also bring this up because it was something that came to mind in the design of Fragment Sync. If you used an early version of FS, you might have noticed a refresh link in the Setup window; you would click it and it would updated the list of devices to show/update which ones were active or inactive. I reached the conclusion early on that this was horribly annoying and it would cost next to nothing to automatically detect and display such information, and at this juncture I conjured up a rule that there should be no “refresh” buttons, links, or whatever else in Fragment Sync, and all state changes should be detected and addressed automatically, without user intervention.