Results 1 to 9 of 9

Thread: Sticky Notes for XP

  1. #1
    .Net Member dday9's Avatar
    Join Date
    Mar 11
    Location
    South Louisiana
    Posts
    2,205

    Sticky Notes for XP

    I use windows vista at home and I use those little sticky notes all the time! At work I have xp and the sticky notes didn't come with xp. So I decided to make them for Window's XP. This was developed in Visual Basic Express 2010 targeting the .net framework 4.0

    Features:
    -Add multiple notes
    -Right Click Menu Includes:
    A. Clear Text
    B. Edit Text
    C. Save Text
    D. Pin to desktop

    Drawbacks:
    -The pin to desktop is a little funny. If you pin to desktop while it's ontop of another program then you have to minimize every program for the sticky to stay at the desktop.
    -If you add multiple stickys at once, I can see where it would take up some memory.

    Plans - As of right now, I don't have any plans to fix the pin to desktop. Simply because I wanted the program to be as basic as possible, without including any API's.


    Notes - I wanted to point out that this isn't just for window's xp, it would work fine with vista and I'm sure 7, however the reason I developed this was because I wanted something for xp. Also, the borders in vista makes the note look a little wierd.

    ScreenShot:
    Sticky Notes.zip

    Source:
    Code:
    Option Strict On
    Option Explicit On
    Public Class Form1
        Private pt As New Point
        Private saved As Boolean = False
    
    #Region "Moves a bordless Form"
        Private Sub Panel1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
            If saved = False Then
                Dim delta As New Size(e.X - pt.X, e.Y - pt.Y)
                If (e.Button = MouseButtons.Left) Then
                    Me.Location += delta : pt = e.Location - delta
                Else
                    pt = e.Location
                End If
            End If
        End Sub
    #End Region
    
    #Region "Control Events"
        Private Sub lblAdd_Click(sender As Object, e As System.EventArgs) Handles lblAdd.Click
            'Adds a new sticky
            Dim form As New Form1
            .form.Show()
            .form.Focus()
        End Sub
        Private Sub lblClose_Click(sender As System.Object, e As System.EventArgs) Handles lblClose.Click
            'Closes the Form
            .Me.Close()
        End Sub
    #End Region
    
    #Region "Context Menustrip"
        Private Sub ClearTextToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ClearTextToolStripMenuItem.Click
            'Clears Text
            .txtBox.Text = String.Empty
            If txtBox.ReadOnly = True Then
                .txtBox.ReadOnly = False
            End If
        End Sub
        Private Sub SaveTextToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveTextToolStripMenuItem.Click
            'Makes the textbox readonly
            .txtBox.ReadOnly = True : EditTextToolStripMenuItem.Enabled = True : SaveTextToolStripMenuItem.Enabled = False
        End Sub
        Private Sub EditTextToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles EditTextToolStripMenuItem.Click
            'Makes the textbox editable
            .txtBox.ReadOnly = False : EditTextToolStripMenuItem.Enabled = False : SaveTextToolStripMenuItem.Enabled = True
        End Sub
        Private Sub PinToDesktopToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles PinToDesktopToolStripMenuItem.Click
            'Pins the program
            If saved = False Then
                .saved = True : PinToDesktopToolStripMenuItem.Checked = True : lblClose.Visible = False : Me.ShowInTaskbar = False
                .SetParent(Me.Handle, FindWindow("ProgMan", Nothing))
                .Me.SendToBack()
            Else
                .saved = False : PinToDesktopToolStripMenuItem.Checked = False : lblClose.Visible = True : Me.ShowInTaskbar = True
            End If
        End Sub
    #End Region
    
    End Class

  2. #2
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 05
    Location
    Lansing, MI; USA
    Posts
    3,788

    Re: Sticky Notes for XP

    I ran into a similar problem when I started writing my own Sticky Notes app (I call mine Reminder Notes).
    I wanted a way to have the Note windows be part of the desktop (to avoid being minimized when the 'Minimize to Desktop' command was issued) as well as having the note's be able to be semi-transparent (like the Win7 gadgets can be). I never did find a good solution.

    Your note's app here looks to be like it's off to a good start, if you're wanting any pointers feel free to ask. For your "borders" problem, just draw the note in the form's paint event on a borderless form. For the moving and resizing, you'll need to handle the MouseDown event, figure out where the mouse is to know if it's a resize or a move or neither, set a flag variable and in the MouseMove event move the form. In the MouseUp event you'll want to clear those variables.

    I created mine to mimic the Windows 7 Sticky Notes app, but mine works on XP and newer and runs from the system tray (the win7 one has an icon on the taskbar instead and the Vista one is, well, really crappy).
    Last edited by JuggaloBrotha; Jun 14th, 2012 at 10:34 AM.
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.



    CodeBank: All Threads • Colors ComboBox • Fading & Gradient Form • MoveItemListBox/MoveItemListView • MultilineListBox • MenuButton • ToolStripCheckBox • Start with Windows

  3. #3
    .Net Member dday9's Avatar
    Join Date
    Mar 11
    Location
    South Louisiana
    Posts
    2,205

    Re: Sticky Notes for XP

    Yeah sure, I'm all ways up for pointers. If y'all find something that can help the program out lemme know :]

  4. #4
    vb Coda .paul.'s Avatar
    Join Date
    May 07
    Location
    Chelmsford UK
    Posts
    16,514

    Re: Sticky Notes for XP

    interesting post. i wrote an XP sticky notes app a couple of years ago.
    i made some improvements to your code:

    vb Code:
    1. Option Strict On
    2. Option Explicit On
    3. Public Class Form1
    4.     ''' <summary>
    5.     ''' This program was created by David Day to be very simple to use for Window's XP users
    6.     ''' </summary>
    7.     ''' <remarks>
    8.     ''' As of right now the pin to desktop is a little funky
    9.     ''' That could be fixed by using some API's.
    10.     ''' </remarks>
    11.     Private pt As New Point
    12.     Private saved As Boolean = False
    13.  
    14.     Declare Function SetParent Lib "user32.dll" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
    15.     Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    16.  
    17. #Region "Moves a bordless Form"
    18.  
    19.     Public Const HT_CAPTION As Integer = &H2
    20.     Public Const WM_NCLBUTTONDOWN As Integer = &HA1
    21.  
    22.     Private Sub Panel1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
    23.         'If saved = False Then
    24.         '    Dim delta As New Size(e.X - pt.X, e.Y - pt.Y)
    25.         '    If (e.Button = MouseButtons.Left) Then
    26.         '        Me.Location += delta : pt = e.Location - delta
    27.         '    Else
    28.         '        pt = e.Location
    29.         '    End If
    30.         'End If
    31.         If e.Button = Windows.Forms.MouseButtons.Left Then
    32.             DirectCast(sender, Control).Capture = False
    33.             Me.WndProc(Message.Create(Me.Handle, WM_NCLBUTTONDOWN, CType(HT_CAPTION, IntPtr), IntPtr.Zero))
    34.         End If
    35.     End Sub
    36. #End Region
    37.  
    38. #Region "Control Events"
    39.     Private Sub lblAdd_Click(sender As Object, e As System.EventArgs) Handles lblAdd.Click
    40.         'Adds a new sticky
    41.         Dim form As New Form1
    42.         form.Show()
    43.         form.Focus()
    44.     End Sub
    45.     Private Sub lblClose_Click(sender As System.Object, e As System.EventArgs) Handles lblClose.Click
    46.         'Closes the Form
    47.         Me.Close()
    48.     End Sub
    49. #End Region
    50.  
    51. #Region "Context Menustrip"
    52.     Private Sub ClearTextToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ClearTextToolStripMenuItem.Click
    53.         'Clears Text
    54.         txtBox.Text = String.Empty
    55.         If txtBox.ReadOnly = True Then
    56.             txtBox.ReadOnly = False
    57.         End If
    58.     End Sub
    59.     Private Sub SaveTextToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveTextToolStripMenuItem.Click
    60.         'Makes the textbox readonly
    61.         txtBox.ReadOnly = True : EditTextToolStripMenuItem.Enabled = True : SaveTextToolStripMenuItem.Enabled = False
    62.     End Sub
    63.     Private Sub EditTextToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles EditTextToolStripMenuItem.Click
    64.         'Makes the textbox editable
    65.         txtBox.ReadOnly = False : EditTextToolStripMenuItem.Enabled = False : SaveTextToolStripMenuItem.Enabled = True
    66.     End Sub
    67.     Private Sub PinToDesktopToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles PinToDesktopToolStripMenuItem.Click
    68.         'Pins the program
    69.         If saved = False Then
    70.             saved = True : PinToDesktopToolStripMenuItem.Checked = True : lblClose.Visible = False : Me.ShowInTaskbar = False
    71.             SetParent(Me.Handle, FindWindow("ProgMan", Nothing))
    72.             Me.SendToBack()
    73.         Else
    74.             saved = False : PinToDesktopToolStripMenuItem.Checked = False : lblClose.Visible = True : Me.ShowInTaskbar = True
    75.         End If
    76.     End Sub
    77. #End Region
    78.  
    79. End Class

  5. #5
    .Net Member dday9's Avatar
    Join Date
    Mar 11
    Location
    South Louisiana
    Posts
    2,205

    Re: Sticky Notes for XP

    I glad to see your response. I've never done any work with api's so this is something that I wanna test. Thank you :]

  6. #6
    .Net Member dday9's Avatar
    Join Date
    Mar 11
    Location
    South Louisiana
    Posts
    2,205

    Re: Sticky Notes for XP

    Update

    I fixed the 'pin to desktop' feature as well as added multiple colors! Here is a screen shot of in Windows 7.
    Attachment 91573

    Here is the updated file:

  7. #7
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 05
    Location
    Lansing, MI; USA
    Posts
    3,788

    Re: Sticky Notes for XP

    You should consider making the note windows borderless. It would give them a cleaner look.
    Name:  RN.png
Views: 1158
Size:  222.2 KB
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.



    CodeBank: All Threads • Colors ComboBox • Fading & Gradient Form • MoveItemListBox/MoveItemListView • MultilineListBox • MenuButton • ToolStripCheckBox • Start with Windows

  8. #8
    Lively Member
    Join Date
    Aug 11
    Posts
    78

    Re: Sticky Notes for XP

    i downloaded above link ,how to install in xp
    You see in this world there's two kinds of people, my friend. Those with loaded guns, and those who dig. You dig.

  9. #9
    .Net Member dday9's Avatar
    Join Date
    Mar 11
    Location
    South Louisiana
    Posts
    2,205

    Re: Sticky Notes for XP

    To debug the sticky notes:
    1. Click on Sticky Notes.Zip in post #6
    2. Save to your desktop(or any folder will do)
    3. Open Visual Studios
    4. Click File - Open - Open Project
    5. Open sticky notes
    6. Debug(Press F5) the program

    To publish the sticky notes, follow the publishing instructions you would do for any other project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •