Click here to Skip to main content
15,898,953 members
Home / Discussions / C#
   

C#

 
GeneralRe: Static to Instance Pin
Heath Stewart28-Apr-04 4:09
protectorHeath Stewart28-Apr-04 4:09 
GeneralRe: Static to Instance Pin
Jeff Varszegi28-Apr-04 4:37
professionalJeff Varszegi28-Apr-04 4:37 
GeneralRe: Static to Instance Pin
Dave Kreskowiak28-Apr-04 4:17
mveDave Kreskowiak28-Apr-04 4:17 
GeneralRe: Static to Instance Pin
Jeff Varszegi28-Apr-04 4:35
professionalJeff Varszegi28-Apr-04 4:35 
Generallist as parameter (C++/C# interoperability) Pin
sharonz28-Apr-04 2:25
sharonz28-Apr-04 2:25 
GeneralRe: list as parameter (C++/C# interoperability) Pin
Heath Stewart28-Apr-04 3:56
protectorHeath Stewart28-Apr-04 3:56 
GeneralRe: list as parameter (C++/C# interoperability) Pin
sharonz28-Apr-04 4:22
sharonz28-Apr-04 4:22 
GeneralRe: list as parameter (C++/C# interoperability) Pin
Roman Rodov28-Apr-04 15:37
Roman Rodov28-Apr-04 15:37 
GeneralRe: list as parameter (C++/C# interoperability) Pin
sharonz28-Apr-04 20:57
sharonz28-Apr-04 20:57 
QuestionUnique integer from string? Pin
Nathan Ridley28-Apr-04 2:20
Nathan Ridley28-Apr-04 2:20 
AnswerRe: Unique integer from string? Pin
amatyasik28-Apr-04 3:46
amatyasik28-Apr-04 3:46 
AnswerRe: Unique integer from string? Pin
Heath Stewart28-Apr-04 3:53
protectorHeath Stewart28-Apr-04 3:53 
AnswerRe: Unique integer from string? Pin
Jeff Varszegi28-Apr-04 4:49
professionalJeff Varszegi28-Apr-04 4:49 
GeneralRe: Unique integer from string? Pin
Nathan Ridley28-Apr-04 17:57
Nathan Ridley28-Apr-04 17:57 
GeneralRe: Unique integer from string? Pin
Jeff Varszegi29-Apr-04 2:55
professionalJeff Varszegi29-Apr-04 2:55 
GeneralDataview Pin
Appelz28-Apr-04 1:28
Appelz28-Apr-04 1:28 
GeneralRe: Dataview Pin
Mazdak28-Apr-04 1:43
Mazdak28-Apr-04 1:43 
GeneralRe: Dataview Pin
Appelz28-Apr-04 20:27
Appelz28-Apr-04 20:27 
GeneralRe: Dataview Pin
Heath Stewart28-Apr-04 3:40
protectorHeath Stewart28-Apr-04 3:40 
GeneralRe: Dataview Pin
Appelz28-Apr-04 20:35
Appelz28-Apr-04 20:35 
GeneralRe: Dataview Pin
Heath Stewart29-Apr-04 3:07
protectorHeath Stewart29-Apr-04 3:07 
Generalminimization effect Pin
ecolner28-Apr-04 0:07
ecolner28-Apr-04 0:07 
GeneralRe: minimization effect Pin
Mike Dimmick28-Apr-04 2:29
Mike Dimmick28-Apr-04 2:29 
For the first part of the question, DrawAnimatedRects. See also http://www.codeproject.com/gdi/drawanimated.asp[^]. Obviously you'll have to use a P/Invoke declaration. Here's some code I cooked up:
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
   int left;
   int top;
   int right;
   int bottom;
 
   public static RECT FromLTRB( int l, int t, int r, int b )
   {
      RECT rc = new RECT();
 
      rc.left   = l;
      rc.top    = t;
      rc.right  = r;
      rc.bottom = b;
 
      return rc;
   }
 
   public static RECT FromRectangle( Rectangle r )
   {
      return FromLTRB( r.Left, r.Top, r.Right, r.Bottom );
   }
}
 
private const int IDANI_CAPTION = 3;
 
// Thanks to www.pinvoke.net
[DllImport("user32.dll")]
private static extern bool DrawAnimatedRects( HandleRef hwnd, int idAni,
   [In] ref RECT lprcFrom, [In] ref RECT lprcTo);
 
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
   if ( exiting )
      return;
 
   e.Cancel = true;
 
   // Do the animation
   // Aim for a 16x16 box in the corner - we can't easily work out exactly where we'll be
   Rectangle boundsRect = Screen.PrimaryScreen.Bounds;
   RECT rcFrom = RECT.FromRectangle( Bounds );
    
   RECT rcTo = 
      RECT.FromLTRB( 
         boundsRect.Right - 16,
         boundsRect.Bottom - 16,
         boundsRect.Right,
         boundsRect.Bottom );
 
   DrawAnimatedRects( new HandleRef( this, Handle ), IDANI_CAPTION, ref rcFrom, ref rcTo );
 
   // Hide the form
   Visible = false;
}

private void OnNotifyIconClick(object sender, System.EventArgs e)
{
   if ( Visible )
      return;
 
   // Animate back to our normal position
   // Aim for a 16x16 box in the corner - we can't easily work out exactly where we'll be
   Rectangle boundsRect = Screen.PrimaryScreen.Bounds;
   RECT rcTo = RECT.FromRectangle( Bounds );
   RECT rcFrom = 
      RECT.FromLTRB( 
         boundsRect.Right - 16,
         boundsRect.Bottom - 16,
         boundsRect.Right,
         boundsRect.Bottom );
 
   DrawAnimatedRects( new HandleRef( this, Handle ), IDANI_CAPTION, ref rcFrom, ref rcTo );
 
   // and show
   Visible = true;
}
 
private void exit_Click(object sender, System.EventArgs e)
{
   exiting = true;
   Close();
}
 
private bool exiting;
If you wanted to be really keen, you could try to find out where the task bar actually is, rather than just assuming the bottom of the primary screen as I've done here. See http://vbnet.mvps.org/index.html?code/screen/shappbarmessage.htm[^].

Stability. What an interesting concept. -- Chris Maunder
GeneralLogging/Debug Output/Verbose Mode Pin
MrEyes27-Apr-04 23:20
MrEyes27-Apr-04 23:20 
GeneralRe: Logging/Debug Output/Verbose Mode Pin
Dave Kreskowiak28-Apr-04 1:48
mveDave Kreskowiak28-Apr-04 1:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.