Windows Forms Flicker Fix Using SendMessage

by bill 10/17/2006 10:16:00 PM

A simple way to stop forms/controls from flickering. The zip file contains the WindowLock class.

using (IWindowLock windowLock = WindowLock.CreateLock(control))
{
    
// do stuff....
}

External.Windows.zip (8.48 kb)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Implementing IPersistComponentSettings

by bill 10/14/2006 10:42:00 PM

IPersistComponentSettings is defined by MSDN as a standard functionality for controls or libraries that store and retrieve application settings. Yes, MSDN does define it and it shows you all the properties and methods on the interface, however it does not tell you how to use it at all.

In the simplest case you need a class which inherits from System.Configuration.ApplicationSettingsBase to store your settings. Your control (or UserControl) needs to implement the IPersistComponentSettings and have it’s SaveSettings property set to true. It is also a good idea to set the SettingsKey property to something specific. The name of control seems to work fine.

LoadComponentSettings(): retrieve your properties from the ApplicationSettingsBase class and set the values on the control.

SaveComponentSettings(): set the properties on the ApplicationSettingsBase class and then call the Save() method on that class.

ResetComponentSettings(): call Reset() on the ApplicationSettingsBase class.

I have not figured out how or if something else should be forcing a save by calling SaveComponentSettings automatically, so in my control I added an override to the Dispose method and call SaveComponentSettings myself.

IPersistComponentSettingsExample.zip (14.72 kb)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

A simple way to get the Desktop Width/Height across all monitors

by bill 10/14/2006 2:37:00 PM

You would think that System.Windows.Forms.Screen would have a property for the whole desktop, but it doesn't.  If you are looking to get the actual desktop width and height across all monitors you need to use.....

System.Windows.Forms.SystemInformation.VirtualScreen

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

VS.Net 2005 taking forever to close files

by bill 10/12/2006 7:57:00 AM
I have a large solution w/ 30+ projects and everytime I closed a file in the IDE it took almost 10 seconds to close.  I found that when I deleted the slutions .suo (solution user options) file this fixed my problem.  I have no idea what that thing was doing, but it seemed to fix it.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Visual Studio 2005 Image Library

by bill 10/10/2006 10:01:00 PM

Here is a funny msdn link on how to "install" them.

http://msdn2.microsoft.com/en-us/library/ms247035.aspx

The Visual Studio 2005 Image Library is a collection of application images that appear in Microsoft Windows, Microsoft Office, Microsoft Visual Studio, and other Microsoft software. You can use this set of over 1,000 images to create applications that look visually consistent with Microsoft software.

The image library includes three main categories of images: animations, bitmaps, and icons. A readme file, *readme.htm, is included for each major area. These readme files include information about the appropriate use of these images in your applications.

During Visual Studio setup, the image library is copied to your computer as the file VS2005ImageLibrary.zip. The default directory for this file is \...\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary\.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

IsolatedStorage SettingsProvider

by bill 10/8/2006 9:59:00 PM
I looked for a SettingsProvider that used IsolatedStorage and since I didn't find one I created one.

IsolatedStorageSettingsProvider .cs (8.78 kb)

How To Use: 

[SettingsProvider(typeof(IsolatedStorageSettingsProvider))]
public class ProviderOverrideSettings : global::System.Configuration.ApplicationSettingsBase
{
    
private static ProviderOverrideSettings instance = (ProviderOverrideSettings)
    global::System.Configuration.ApplicationSettingsBase.Synchronized(new ProviderOverrideSettings());

    
public static ProviderOverrideSettings Instance
    {
        
get
        {
            
return instance;
        }
    }

    [
UserScopedSetting]
    [
DefaultSettingValue("")]
    
public string MySetting
    {
        
get
        {
            
return (string)this["MySetting"];
        }
        
set
        {
            
this["MySetting"] = value;
        }
    }
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Show a DataGridViewRow ContextMenu using the Apps Key

by bill 10/6/2006 1:00:00 PM
private void grid_KeyDown(object sender, KeyEventArgs e)
{
   if (e.KeyCode == Keys.Apps)
   {
    if (grid.Rows.Count == 0 || grid.SelectedRows.Count == 0)
     return;

    DataGridViewRow row = grid.SelectedRows[0];

    Rectangle rectange = grid.GetCellDisplayRectangle(0, row.Index, false);
    contextMenu.Show(grid, rectange.Location);
  }
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

Name of author Bill Rodenbaugh
I bang on the keyboard and somehow the end result turns into some kind of thing that sometimes does something.

E-mail me Send mail
View Bill Rodenbaugh's profile on LinkedIn

Calendar

<<  August 2008  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

Recent comments

Authors

Categories

None


Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Sign in