KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I found a fun program that allows you to overlay snowflakes over your desktop and windows . As a programming challenge I am interested in trying to figure out how to do this myself. Not to mention that this program is a bit of a memory hog (if it doesn't have a memory leak). Below is the start I have. I am trying to get the basics down with one image and then will expand. What I would really like help on is making the image move more smoothly and naturally. Edit: I posted a solution down below in the answers section but it is more CPU intensive than I would like, any thoughts? WPF XAML code: <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" AllowsTransparency="True" WindowStyle="None" Title="MainWindow" Height="350" Width="525" Background="Transparent" Topmost="True" WindowState="Maximized" ResizeMode="NoResize"> <Grid Name="grid1"> <Image Height="26" HorizontalAlignment="Left" Margin="{Binding flakeMargin}" Name="Image1" Stretch="Fill" VerticalAlignment="Top" Width="28" Source="/snowTest;component/Images/blue-pin-md.png" /> </Grid> </Window> VB Code: Imports System.ComponentModel Class MainWindow Dim bw As BackgroundWorker = New BackgroundWorker Dim flake0 As New flake Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded grid1.DataContext = flake0 AddHandler bw.DoWork, AddressOf backgroundMover bw.RunWorkerAsync() End Sub Private Sub backgroundMover(ByVal sender As Object, ByVal e As System.
Tags (comma-separated)
Save Edits
Cancel