Solved

Tank / fluid level display / control / graphic ?

Posted on 2014-04-10
8
620 Views
Last Modified: 2014-04-14
Hey guys.  Can someone recommend a control/product that will allow me to display, graphically, the current level of a tank?  I have the data, I just need to hand it off to a control that will represent it as a pretty wizbang graphic.  Basically, picture a standing 55 gallon drum of water.  I want this graphic to show a transparent representation of the drum, with 3d/solid water inside set at the level I tell it.  Any suggestions?
0
Comment
Question by:JasonWilliam
  • 3
  • 3
  • 2
8 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39993135
In what kind of application? Win Forms? ASP.NET? WPF?
0
 

Author Comment

by:JasonWilliam
ID: 39993149
Sorry, it's WinForms
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39993878
I don't know much about 3rd-party controls, so please wait for someone else to pop in with those suggestions, but you might consider using something like the code snippet I located on the MSDN forums. Basically, it takes a regular ProgressBar control and turns it vertical instead of horizontal. Now, one side effect of this is that you get animation of the progress part by default. There are a couple of hacks that I've seen which could disable this.
CropperCapture.Gif
0
 

Author Comment

by:JasonWilliam
ID: 39995411
Thats a thought, thanks.  Still would love to find a dedicated control though.  Anyone have any suggestions?
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 27

Expert Comment

by:Ark
ID: 39995631
You can use standard progressbar:
Public Class Form1
    Private Class MyTank
        Inherits ProgressBar
        Private Const PBS_VERTICAL As Integer = &H4

        Public Declare Unicode Function SetWindowTheme Lib "uxtheme.dll" (ByVal hWnd As IntPtr, ByVal pszSubAppName As String, ByVal pszSubIdList As String) As Integer
        Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
            SetWindowTheme(Me.Handle, "", "")
            MyBase.OnHandleCreated(e)
        End Sub

        Protected Overrides ReadOnly Property CreateParams() As CreateParams
            Get
                Dim cp As CreateParams = MyBase.CreateParams
                cp.Style = cp.Style Or PBS_VERTICAL
                Return cp
            End Get
        End Property
    End Class

    Private tank As MyTank, nudAmount As NumericUpDown

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        tank = New MyTank With {.Style = ProgressBarStyle.Continuous,
                                .ForeColor = Color.Blue,
                                .Location = New Point(0, 0),
                                .Size = New Size(100, 200),
                                .Maximum = 35,
                                .Value = 10,
                                .Visible = True}
        nudAmount = New NumericUpDown With {.Maximum = 35, .Value = 10, .Location = New Point(150, 10)}
        Me.Controls.Add(tank)
        Me.Controls.Add(nudAmount)
        AddHandler nudAmount.ValueChanged, AddressOf amountChanged
    End Sub

    Private Sub amountChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        tank.Value = nudAmount.Value
    End Sub

Open in new window

If you need more control on painting you can set UserPaint style and override OnPaint ( see http://emoacht.wordpress.com/2011/10/16/color-customizable-progressbar-for-visual-style/ for example)
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39995647
@Ark

I take it you didn't read my comment?
0
 
LVL 27

Expert Comment

by:Ark
ID: 39995652
Sorry I didn't. My apologize.
But I've shown how disable Visual styles as well :) - consider this as a comment, not as proposed answer.
0
 

Author Closing Comment

by:JasonWilliam
ID: 40000580
kaufmed, I'll go ahead and accept your answer.  It gets me close enough.  Thanks!
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Open form in the top right hand corner of screen 5 36
Help with distributing .NET Framework with Clickonce technology 2 30
Advice in Xamarin 21 56
Exit the loop 4 35
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now