Onteora Software

Ken Tucker's Blog
posts - 145, comments - 628, trackbacks - 0

Vista

Compact Framework DataGrid Alternating Color

One of the things I miss from the Windows Forms DataGrid is the ability to have the rows alternating in color.  For this example I created a custom DataGridTextBox column which will display each other row in an different color. Basically I override the paint method to call the existing paint method with a different back color brush for every other column.   Public Class AltColorColumn     Inherits DataGridTextBoxColumn     Private m_AltColor As Color     Public Property AltColor() As Color         Get             Return m_AltColor         End Get         Set(ByVal value As Color)             m_AltColor = value         End Set     End Property     Protected Overrides Sub...

posted @ Friday, October 19, 2007 1:44 PM | Feedback (1) | Filed Under [ Compact Framework Vista ]

Vista Task Dialog

Vista Task Dialog Windows Vista has some cool looking new Dialog's. This example will show how to use the TaskDialog an improved message box with Visual Studio 2005.   Public Class Form1     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         Dim x As Integer         TaskDialogHelper.TaskDialog(Me.Handle, IntPtr.Zero, "Title", "Are you sure?", "This is a test", TaskDialogHelper.TaskDialogButtons.Ok, TaskDialogHelper.TaskDialogIcon.Question, x)     End Sub End Class Public Class TaskDialogHelper     Public Enum TaskDialogButtons         Ok = &H1         Cancel = &H8         Yes = &H2         No = &H4         Retry = &H10         Close = &H20     End Enum     Public Enum TaskDialogIcon         Information = UInt16.MaxValue - 2         Warning =...

posted @ Sunday, September 16, 2007 6:17 PM | Feedback (1) | Filed Under [ Vista ]

Vista: Get WinSat Info

Vista: Get WinSat Info Windows Vista has a performance index for your hardware.  The scores range from 1(worst) to 5.9(best).  If your application uses a lot of graphics you might get poor performance on a computer with a graphics score of 1.  You can use this number to scale back on the graphics to improve your apps performance.  This example gets displays the scores in the forms paint event.  For this example add a reference to the WinSat 1.0 type library in the com tab. Imports WINSATLib Imports System.Text Public Class Form1     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load    ...

posted @ Sunday, September 16, 2007 3:41 PM | Feedback (1) | Filed Under [ VB Vista ]

Vista Updates and Tools

Vista Updates and Tools First the Visual Studio 2005 SP1 update for Vista has been released. Service Pack 2 for SQL Server 2005 is out. This is the only version of SQL Server 2005 that is supported on Vista. Finally the free Virtual PC 2007 is available

posted @ Sunday, September 16, 2007 3:30 PM | Feedback (1) | Filed Under [ Vista ]

List Vista RSS feeds

List Vista RSS feeds To list the RSS feeds added to IE7 in windows Vista add a reference to Microsoft.Feeds 1.0. You will find it in the com tab.  Imports Microsoft.Feeds.Interop Public Class Form1     Dim mgr As New FeedsManager     Dim fldr As IFeedFolder     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         fldr = mgr.RootFolder         ListFeeds(fldr)     End Sub     Private Sub ListFeeds(ByVal fldr As IFeedFolder)         For Each feed As IFeed In fldr.Feeds             Trace.WriteLine(feed.Name)             ListItems(feed)         Next         For Each f As IFeedFolder In fldr.Subfolders             Trace.WriteLine(f.Name)             ListItems(f)         Next     End Sub     Private Sub ListItems(ByVal feed As IFeed)         Trace.Indent()         For Each...

posted @ Sunday, September 16, 2007 3:27 PM | Feedback (1) | Filed Under [ VB Vista ]

Vista: File System Transactions

Vista: File System Transactions Windows Vista has several new functions for using transactions when working with files.  Here is an example on how to create a transaction, work with some files, and commit it. Imports System.Runtime.InteropServices Imports Microsoft.Win32.SafeHandles Imports System.IO Module Module1     Public Declare Auto Function CreateTransaction Lib "Ktmw32.dll" (ByVal Attributes As IntPtr, _         ByVal guid As IntPtr, ByVal options As Integer, ByVal isolationlevel As Integer, _         ByVal isolationflags As Integer, ByVal milliseconds As Integer, ByVal description As String) As IntPtr     Public Declare Auto Function RollbackTransaction Lib "Ktmw32.dll" (ByVal handle As IntPtr) As Boolean     Public Declare Auto Function CommitTransaction Lib "Ktmw32.dll" (ByVal handle As IntPtr) As Boolean     Public Declare...

posted @ Sunday, September 16, 2007 3:25 PM | Feedback (1) | Filed Under [ VB Vista ]

Vista Application Recovery

Vista Application Recovery Ever want to add the ability to recover the user data if your application has crashed. Windows Vista has some nice apis to make this easy. The RegisterApplicationRestart api tells Vista we would like the app to restart if it crashes or hangs. This api takes two arguments a string which will be the command line argument when the application restarts and RestartFlags. For this example we will tell the app to always restart. Note the app must run 60 seconds before it will restart.     Enum RestartFlags         Always = 0         Cyclical = 1         NotifySolution = 2         NotifyFault...

posted @ Sunday, September 16, 2007 3:22 PM | Feedback (1) | Filed Under [ VB Vista ]

Powered by: