Solved

Tank / fluid level display / control / graphic ?

Posted on 2014-04-10
8
663 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

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 28

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
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.

688 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