Monday, January 31, 2005
Mondays on Monday!
Tune in to A&E’s Caesar’s 24/7 on Monday night 10PM (check your local time) to see the cast from Mondays, (Carl Franklins, Rory Blyth, Nick Landry, and Geoff Maciolek) as Nick tries to pick up a woman in the bar at Caesars Palace.
Friday, January 21, 2005
Nice one, Messenger!
Somebody may want to think about some fricken custom errors! Guess I can forget about those live message alerts working...
You know you're coding too much when...
... when you try and "BUILD" a fricken Word document. I was like "What happened to my Build menu?" Whoops. I'm in Word. Just click the save button you idiot.
Friday, January 14, 2005
Live message alerts
Roy just added live message alerts to his blog and I wanted to be cool like him so I did it too. You can now sign up for alerts when this blog updates (see right-hand sidebar for the link or click here). This is handy if you're really really interested in what I have to say the minute I say it and you don't live in an RSS news reader all day. Not really sure who would subscribe... maybe I'll tell my mom.
Tuesday, January 11, 2005
Hung my diploma today...
I mentioned a few posts ago that I moved and as you know, if you've ever moved, it takes forever to get the little things unpacked and put in their correct place. I just hung my diploma on my office wall and I had a semi-proud moment. "Bachelor of Science in Computer Science and Minor in Mathematics" it reads. I'm pretty good at the computer dealio, but the math... can't say I remember calculus. I can't even balance my checkbook anymore :-/. OTOH, why would I need to? That's what online banking is for.
It's funny how I ended up in the business side of software. I remember (vaugely) all those baloney C++ assignments about calculating how many slices in a 14" pizza or writing a craps game my sophomore year. It didn't get interesting until my junior year when I transfered to a real university and started programming with cool graphics packages on sparc station 10's... which were totally expensive back then. Of course I had all the math down and when I graduated I applied at Lawrence Livermore National Laboratory for some geek-y C++ programming job.
Of course I didn't get the job because there were like 1000 applicants. So I took the summer off... practically. One August morning as I was heading out to the jacuzzi my mother found a job in the classifieds that read "Computer programmer. BS in CS required. No experience necessary." So I called, faxed my resume in (litteraly a half of a page) and got a call back for an interview. The company was a small healthcare software company nearby. I nailed the interview and was practiacally hired on the spot.
The first month was basically me learning Clipper (summer 87 -- the cool version). I was too afraid to tell them that I wasn't a CIS graduate and I had no idea what an IDX was so I took the Nantucket book home and learned all about relational database programming. I couldn't believe I spent all that time in college and none of it prepared me for writing business software products. However, within four months I had rewritten their internal office management system and they promoted me from junior programmer and gave me a $10K raise (which let me tell you was a shitload because I was still living at home and driving an 81 LeBaron). I realized that college taught me how to think about programming. Even though they didn't specifically teach me about databases, I gained the skill to be able to make sense out of any computer gobbely-gook. (Granted, later going from Clipper to FoxPro 2.0 was maybe like 5 syntactical differences, but still). But of course I still can't figure out what Math ever gave me.....
Friday, January 07, 2005
Disable Tabs on a TabControl
Here's a complete subclass of the TabControl that has disabled tab page functionality built in. When you set one of the contained tab pages' Enabled property to False, the tab will render in a disabled font color and will not allow the user to open the tab. This version of the tab control handles the EnabledChanged event of any of its contained tab pages and redraws the tab appropriately. Add this class to your toolbox, drop it on a form, add a few tabs like normal. If you want to disable a tab simply set the Enabled property to false in your code:
MyTabControl.TabPage2.Enabled = FalseHere's the class:
Imports System.ComponentModel Imports System.Drawing Imports System.Windows.Forms <ToolboxBitmap(GetType(TabControl))> _ Public Class BaseTabControl Inherits System.Windows.Forms.TabControl #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call Me.DrawMode = TabDrawMode.OwnerDrawFixed End Sub 'BaseTabControl overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' End Sub #End Region #Region "--- Disabled Pages Functionality ---" Private Const WM_LBUTTONDOWN As Integer = &H201 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) If m.Msg = WM_LBUTTONDOWN Then Dim pt As New Point(m.LParam.ToInt32) For i As Integer = 0 To Me.TabPages.Count - 1 If Me.GetTabRect(i).Contains(pt) Then If Me.TabPages(i).Enabled Then MyBase.WndProc(m) End If Exit For End If Next Else MyBase.WndProc(m) End If End Sub Protected Overrides Sub OnKeyDown(ByVal ke As System.Windows.Forms.KeyEventArgs) If Me.Focused Then Dim selIndex As Integer = Me.SelectedIndex If ke.KeyCode = Keys.Left AndAlso Not ke.Control AndAlso Not ke.Alt Then For i As Integer = selIndex - 1 To 0 Step -1 If Me.TabPages(i).Enabled Then Me.SelectedIndex = i Exit For End If Next ke.Handled = True ElseIf ke.KeyCode = Keys.Right AndAlso Not ke.Control AndAlso Not ke.Alt Then For i As Integer = selIndex + 1 To TabPages.Count - 1 If Me.TabPages(i).Enabled Then Me.SelectedIndex = i Exit For End If Next ke.Handled = True End If End If MyBase.OnKeyDown(ke) End Sub Protected Overrides Sub OnDrawItem(ByVal e As System.Windows.Forms.DrawItemEventArgs) Dim leftImgOffset, topImgOffset As Integer Dim rBack As Rectangle Dim rText As RectangleF Dim img As Bitmap Dim format As New StringFormat Dim foreBrush As Brush Dim backBrush As New SolidBrush(Me.TabPages(e.Index).BackColor) If Me.TabPages(e.Index).Enabled Then foreBrush = New SolidBrush(Me.TabPages(e.Index).ForeColor) Else foreBrush = New SolidBrush(SystemColors.ControlDark) End If If Me.TabPages(e.Index).ImageIndex <> -1 Then img = CType(Me.ImageList.Images(Me.TabPages(e.Index).ImageIndex), Bitmap) rText = New RectangleF(e.Bounds.X + (img.Width \ 2), e.Bounds.Y, _ e.Bounds.Width, e.Bounds.Height) Else rText = New RectangleF(e.Bounds.X, e.Bounds.Y, _ e.Bounds.Width, e.Bounds.Height) End If If e.State = DrawItemState.Selected Then If e.Index = 0 Then rBack = New Rectangle(e.Bounds.X + 4, e.Bounds.Y, _ e.Bounds.Width - 4, e.Bounds.Height) Else rBack = e.Bounds End If e.Graphics.FillRectangle(backBrush, rBack) leftImgOffset = 6 topImgOffset = 5 Else leftImgOffset = 2 topImgOffset = 2 End If format.Alignment = StringAlignment.Center format.LineAlignment = StringAlignment.Center e.Graphics.DrawString(Me.TabPages(e.Index).Text, e.Font, foreBrush, rText, format) If Me.TabPages(e.Index).ImageIndex <> -1 Then Me.ImageList.Draw(e.Graphics, e.Bounds.X + leftImgOffset, _ e.Bounds.Top + topImgOffset, Me.TabPages(e.Index).ImageIndex) End If MyBase.OnDrawItem(e) End Sub Private Sub Tab_EnabledChanged(ByVal sender As Object, ByVal e As EventArgs) If TypeOf sender Is TabPage Then Me.Invalidate(Me.GetTabRect(DirectCast(sender, TabPage).TabIndex)) End If End Sub Protected Overrides Sub OnControlAdded(ByVal e As System.Windows.Forms.ControlEventArgs) If TypeOf e.Control Is TabPage Then AddHandler e.Control.EnabledChanged, AddressOf Tab_EnabledChanged End If MyBase.OnControlAdded(e) End Sub Protected Overrides Sub OnControlRemoved(ByVal e As System.Windows.Forms.ControlEventArgs) If TypeOf e.Control Is TabPage Then RemoveHandler e.Control.EnabledChanged, AddressOf Tab_EnabledChanged End If MyBase.OnControlRemoved(e) End Sub #End Region End Class
Thursday, January 06, 2005
The Future of TV
I was talikng to Alan the other day about how it would be cool to have multiple signals per TV channel so that you could select your own camera angles durring a football game. Guess what? It's coming!
Tuesday, January 04, 2005
Happy New Year! Now get to work!
Well I'm back after an *awesome* winter break! (Even though I was back to work yesterday, I was overloaded with catch-up work and I just couldn't spare anytime to get a post out.) Okay what's new? Well, we bought a house and we moved in right before Christmas! This was good and bad timing. I had last week off so it was nice to not have to take regular vacation to get moved. On the other hand dealing with the banks, getting new carpet installed and scheduling a move in the rain is not my idea of fun and would have probably been easier to do in the spring or at least away from the holidays. I was a total stress case. Now I'm back to work and felling more relaxed believe it or not. I'm still dealing with a bunch of boxes and my whiteboard in my office is still on the floor, but at least the cable modem is working.
Subscribe to:
Posts (Atom)