Solved

Tank / fluid level display / control / graphic ?

Posted on 2014-04-10
8
646 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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…

733 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