Archive

Archive for October, 2007

.NET WinForms splitter with normal/maximize/normal/shrink cycling action at double-click

The following code is from the application I authored for LeViS (see screenshot at that link). I had a vertical splitter (=splitting horizontally) and both left & right panes where split again with horizontal splitters (=splitting vertically) themselves and needed to double-click a splitter to make it cycle between normal/maximized/normal/shrunk state.

Java JFC/Swing’s JSplitter control can show two small button arrows (called accelerator buttons if I remember well) on the splitter that do the maximize/shrink/restore cycle actions, but didn’t find something similar for .NET WinForms, so I implemented the cycle via double-click (keeping at a local variable the current movement direction [a pendulum "cycle"])

So here’s the code I authored to make this work (the real worker is the "splitCycle" method near the end)

#Region "Splitter double-click"

    Protected splitHorizontally_DoubleClickToUp As Boolean = False
    Protected splitLeftVertically_DoubleClickToLeft As Boolean = False
    Protected splitRightVertically_DoubleClickToLeft As Boolean = False

    Private Sub splitHorizontal_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles splitHorizontally.MouseDoubleClick
        splitCycle(splitHorizontally, splitHorizontally.ClientSize.Width, splitHorizontally_DoubleClickToUp)
    End Sub

    Private Sub splitLeftVertical_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles splitLeftVertically.MouseDoubleClick
        splitCycle(splitLeftVertically, splitLeftVertically.ClientSize.Height, splitLeftVertically_DoubleClickToLeft)
    End Sub

    Private Sub splitRightVertically_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles splitRightVertically.MouseDoubleClick
        splitCycle(splitRightVertically, splitRightVertically.ClientSize.Height, splitRightVertically_DoubleClickToLeft)
    End Sub

    Protected Const SPLITTER_MARGIN As Integer = 10    ‘need an accuracy margin >0 since the user can never move with the mouse the splitter exactly to its bounds

    Private Sub splitCycle(ByVal splitter As SplitContainer, ByVal max As Integer, ByRef direction As Boolean)
        With splitter
            If .SplitterDistance <= .Panel1MinSize + SPLITTER_MARGIN Then
                .SplitterDistance = CInt(max / 2)
                direction = False
            ElseIf .SplitterDistance >= max – .Panel2MinSize – .SplitterWidth – SPLITTER_MARGIN Then
                .SplitterDistance = CInt(max / 2)
                direction = True
            ElseIf direction Then
                .SplitterDistance = .Panel1MinSize
                direction = False
            Else
                .SplitterDistance = max – .Panel2MinSize – .SplitterWidth
                direction = True
            End If
        End With
    End Sub

#End Region

Categories: Posts

Interprocess Communication (IPC) made easy

How about drag-dropping a control from a toolbox palette into your application or active document (say an Office PowerPoint presentation) and set it to hold some data (a string, a number, a date, an image, an array of data etc.) and give it a unique producer id (autogenerated UUID/GUIDs included which are statistically unique numbers), allowing it to propagate (produce/broadcast) or receive (consume/listen) changed data cross-application and cross-machine boundaries?

Checkout "Plugs" at:

http://plugs.onestop.net

Originated as Delphi VCL controls (StringPlug, IntegerPlug, ImagePlug etc.), some later on available as ActiveX controls too (e.g. StringPlugX – more datatypes easily supported upon request)

Categories: Posts

Insert MPEG-4 video, QuickTime movies and QTVR panoramas in PowerPoint presentations

To insert MPEG-4 video, QuickTime movies and QTVR panoramas in PowerPoint presentations, you can use QTVRControlX ActiveX control, see:

http://qt4all.onestop.net

Unregistered version is free to use for as long as you like (but you’re not allowed to redistribute it) if you don’t mind the "Unregistered version" popup dialog when it starts up.

Categories: Posts

Dr ASCII

my Java-based interactive game (Greek page, but the game itself is pretty much language-agnostic) to learn about bitmap fonts and the ASCII code table:

http://www.mech.upatras.gr/~robgroup/DrAscii

Categories: Posts

Updated my MVP Profile

you can see my updated Microsoft MVP profile (Visual Developer – J# for 2004-2007) at:

http://mvp.support.microsoft.com/profile/Birbilis

Categories: Posts

Converting a VB6 form to an ASP.net WebForm

See my opensource VB6toWebForm tool at http://tranXform.onestop.net

It converts a VB6 form’s design to XML (eXtended Markup Language) via my VB6FormDesignToXML tool that you can also find on that site, and then via XSL (eXtended Stylesheet Transformations) it converts that XML into ASP.net 1.x WebForm pages (using classic vertical flow layout based on the tab-order from the VB6 form and making sure labels that have been assigned to edit controls stay on the same line as those controls)

If you use ASP.net 2.x, VS.net has a nice import wizard (which won’t convert the coding style of those 1.x pages [e.g. the usage of a single codebehind file without using a partial class - a concept that .NET1.x didn't support], but will tweak them to work fine with ASP.net 2.x)

If you add to the XSL transformations files logic to handle more VB6 controls, please consider contributing your enhancements to the tranXform project

BTW, more free XML related utilities are on that website

Categories: Uncategorized Tags:

Mac OS X Leopard test period is over

Speaking of Apple, the new Mac OS X version is out. Checkout their developer center for more:

http://developer.apple.com/leopard/devcenter/

Did you know Microsoft Silverlight (a novel RIA [=Rich Internet Application] platform) is available for Mac OS X too? See for yourself at:

http://www.silverlight.net

Categories: Posts

at last: iTunes Developer Center from Apple

for all iTunes wanna-be web application authors out there:

http://developer.apple.com/iphone/devcenter/

it’s good that Apple finally decided to promote third-party development for iPhone

hope some time in the future they’ll even allow Java and why not Silverlight apps for iPhone (Microsoft has made Silverlight available for MacOS-X too [with .NET programming support at Silverlight 1.1 version!] and the "project mono" guys from Novell and their opensource community are making "MoonLight" for Linux with support from MS)

Categories: Posts

Cross-platform JavaScript for webpages

very useful reading:

http://developer.mozilla.org/en/docs/Migrate_apps_from_Internet_Explorer_to_Mozilla

btw, checkout:
 
 
for the web app I was writing (an artistic portfolio presentation engine)
Categories: Uncategorized Tags:

Creative Nomad Muvo TX “File System Error”

I recently had problem with Muvo TX saying "File System Error". Many people seem to have this issue. Use WinXP (not Vista) and IE7 or something to visit Creative’s homepage and use their online repair tool for such USB devices. It fixes the error fine (installs new firmware and formats the device). Make sure you allow the ActiveX control to run (with IE7 right click the yellow bar that shows up on the top of the repair tool page, with IE6 or earlier repsond positive to the dialog shown)
Categories: Uncategorized Tags:
Follow

Get every new post delivered to your Inbox.

Join 915 other followers

%d bloggers like this: