Solved

Tank / fluid level display / control / graphic ?

Posted on 2014-04-10
8
604 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 74

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 74

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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 74

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

758 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

18 Experts available now in Live!

Get 1:1 Help Now