Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Godra

Pages: 1 ... 91 92 [93] 94 95
1381
Support Questions / Re: Stylizing the basicTrendChart
« on: February 12, 2015, 10:03:23 PM »
Thanks for sharing.

I have tweaked it a bit more with original BackColor, DoubleBuffering and 3 new properties (DrawRightToLeft, GraphLineColor and GraphLineThickness) and here is the code:

Code: [Select]
Imports System
Imports System.ComponentModel

Public Class BasicTrendChartEx
    Inherits BasicTrendChart

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        '* Fill in the background color
        Me.DoubleBuffered = True  'Reduce or eliminate flicker
        e.Graphics.FillRectangle(New SolidBrush(BackColor), 0, 0, Me.Width, Me.Height)

        Dim x1, y1 As Integer
        Dim x2, y2 As Integer

        '* Draw the line connecting the points
        If Points.Count > 1 Then
            Dim index As Integer = 0
            While index < (Points.Count - 2)
                Try
                    '* calculate the x and y coordinates based on the Points collection

                    If DrawRightToLeft = True Then
                        x1 = Me.Width - Convert.ToInt32((Me.Width / MaxPoints) * index)
                        x2 = Me.Width - Convert.ToInt32((Me.Width / MaxPoints) * (index + 1))
                    Else
                        x1 = Convert.ToInt32((Me.Width / MaxPoints) * index)
                        x2 = Convert.ToInt32((Me.Width / MaxPoints) * (index + 1))
                        '*^ this was y1
                    End If
                    y1 = Me.Height - Convert.ToInt32((Me.Height / (YMaximum - YMinimum)) * (Points(index) - YMinimum))
                    y2 = Me.Height - Convert.ToInt32((Me.Height / (YMaximum - YMinimum)) * (Points(index + 1) - YMinimum))

                    e.Graphics.DrawLine(New Pen(GraphLineColor, GraphLineThickness), x1, y1, x2, y2)

                Catch ex As Exception
                    Dim dbg = 0
                End Try
                index += 1
            End While
            e.Graphics.DrawString(Now.ToString("dd-MMM-yy HH:mm:ss"), New Drawing.Font("Arial", 10), System.Drawing.Brushes.White, Me.Width - 116, Me.Height - 16)
            e.Graphics.DrawString(Points.Last.ToString, New Drawing.Font("Arial", 10), System.Drawing.Brushes.White, Me.Width - 40, 0)
        End If
        '* Draw the Axis
        e.Graphics.DrawLine(System.Drawing.Pens.White, 0, 0, 0, Me.Height)
        e.Graphics.DrawLine(System.Drawing.Pens.White, 0, Me.Height - 1, Me.Width, Me.Height - 1)
        e.Graphics.DrawString(YMaximum.ToString, New Drawing.Font("Arial", 10.0!), System.Drawing.Brushes.White, 0.0!, 0.0!)
        '*                    ^^^^^^^^^^^^^^^ this was MaxValue
        e.Graphics.DrawString(YMinimum.ToString, New Drawing.Font("Arial", 10), System.Drawing.Brushes.White, 0, Me.Height - 16)
    End Sub

    Public Property DrawRightToLeft As Boolean = False

    <DefaultValue(GetType(Color), "Black")> _
    Public Overridable Shadows Property BackColor() As Color
        Get
            Return MyBase.BackColor
        End Get
        Set(ByVal value As Color)
            MyBase.BackColor = value
            Refresh()
        End Set
    End Property

    Private _GraphLineColor As Drawing.Color = Drawing.Color.Blue
    Public Property GraphLineColor() As Drawing.Color
        Get
            Return _GraphLineColor
        End Get
        Set(ByVal value As Drawing.Color)
            _GraphLineColor = value
        End Set
    End Property

    Private _gLineThickness As Single = 1
    Public Property GraphLineThickness() As Single
        Get
            Return _gLineThickness
        End Get
        Set(ByVal value As Single)
            If Not IsNumeric(value) Then
                MsgBox("Valid values are numbers 1 to 3!")
                _gLineThickness = 1
                Exit Property
            Else
                If (value > 3) OrElse (value < 1) Then
                    MsgBox("Valid values are numbers 1 to 3!")
                    _gLineThickness = 1
                    Exit Property
                End If
            End If
            _gLineThickness = value
        End Set
    End Property

End Class


It also shows Date/Time and the last Value.

1382
Open Discussion / Re: OPCDACOM
« on: February 09, 2015, 01:09:38 PM »
MatrikonOPC Simulation Server is free and it includes MatrikonOPC Explorer, which lists proper names of available OPC servers.

Once you connect to any of the servers then you can click on "Add Tags" which should list all available tags and show their proper name usage (in the attached picture you can see an example tag that was selected as "Boolean" from "Random" folder but has name Random.Boolean which you would use in one of the PLCAddress properties).

1383
Additional Components / Re: LED Matrix Control
« on: February 08, 2015, 10:40:16 PM »
You are welcome.

The sooner all the bugs are reported to you, the sooner they will get fixed.

Considering what you've offered to the world for FREE and how fast you work and respond to all the issues, you are definitely allowed to make any mistake.

1384
Additional Components / Re: LED Matrix Control
« on: February 08, 2015, 09:41:32 PM »
Characters of this control could be improved for better visual appearance. Characters "g j p q , and ;" have additional line added (see the attached file).

It is also possible to insert small logos or pictures with a single character. Check the attached picture (a "^" character was used to show the picture, but any other character could be designated to do the same - and you would never see that character being displayed again // always consider using the least used character for something like this, maybe "~" or "`", since the same xml file will be used by other LEDMatrix controls that you might put on that same form).

For this you would need to modify LedMatrixSymbolFile.xml but still preserve proper formatting, just like it is already.

You could also use ASCII Art Generator, found here http://sourceforge.net/projects/ascgen2/ , and convert some simple pictures by using only 2 characters "#" and "_" since these are used in the mentioned xml file.

The control seems to be designed to handle any number of LED lines that you would include in the xml (the small picture has 22 lines).

Besides for scrolling feature, this control is just a fancy way of displaying something (labels and/or text and picture boxes could do that as well). Still, thank goodness that we have it.

1385
Additional Components / Re: LED Matrix Control
« on: February 07, 2015, 09:56:51 PM »
Very nice.

Just a minor correction would be to have either "Public Property value As String" with capital "V" in value or to have PLCAddressValue with lower case "v" (this PLCAddressValue appears to be looking specifically for upper case "V"). The same goes for the line "value = "abcdef".

And for those who might like this, keep ScrollEnable at False and add the following code to the end of the LEDMatrixControl.vb, just before "End Class" line:

Code: [Select]
    Private Sub LedMatrixControl_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseHover
        ScrollEnable = Not ScrollEnable
    End Sub

This way you can have the text start scrolling on MouseHover but will have to do another MouseHover to stop scrolling.
Try not to change the MouseHover to Click event since that might interfere with Keypad popup (unless you are not to use that feature).

Scrolling the text is generally useful for long lines of text that go beyond the size of LEDMatrix display and would kind of imply ScrollDirection = Left.

1386
Support Questions / Re: AnimatedPictureBox Transparences
« on: February 06, 2015, 11:00:54 PM »
Here is what I've tried:

1) Drop a panel on the form, set its size to 200x200 / BackgroundImage to RoundMeterBackground.png / BackgroundImageLayout to Stretch
2) Drop an AnimatingPictureBox on the form, set its size to 200x200, don't set BackgroundImage but set the Image to RoundMeterNeedle.png and other settings from this post http://advancedhmi.com/forum/index.php?topic=585.0
3) Either drop another AnimatingPictureBox on the form and set it as you wish or create a copy of the AnimatingPictureBox you just created in the previous step and possibly change its PLCAddressImageRotationValue address and the scale max values
4) Move the first AnimatingPictureBox to the panel and then do the same with the second AnimatingPictureBox
5) In the MainForm Load event put this line:
Code: [Select]
AnimatingPictureBox1.Controls.Add(AnimatingPictureBox2)

Check the attached pictures for the start and the end result.

I just did a quick test and it appears to be working fine. Tried the same scale for both with max value of 30000, 1st needle responding to N7:0 and the 2nd needle responding to N7:1 which was just (N7:0 value + 5000). Also tried different scales with max of 30000 for N7:0 and 1200 for T4:0.ACC and the needles were independently moving from each other.

Not sure if this is 100% what you were looking for.

1387
Tips & Tricks / Re: Glass Buttons
« on: February 06, 2015, 05:41:33 PM »
You are welcome.

I just tried the steps in fresh clean v397e project (Ctrl+Shift+B and add a driver to the form prior to doing any of the steps).

It created a GlassButton control without issues, besides for the XML comment, and also creating AHMI GlassButton control was without any issues (I used the code from the posted file).

I did edit a few things in the previous post so read them and hopefully it will work for you as well.

1388
Tips & Tricks / Re: Glass Buttons
« on: February 05, 2015, 08:22:00 PM »
I am not sure about this, since I am not a professional programmer, but here is what you can try:

1) Remove the GlassButton.vb class from the "Purchased Controls" folder
2) Right click the folder and click "Add" --> "Existing Item" and then browse to GlassButton folder, wherever you extracted it from downloaded zip file, go to GlassButtonVB folder and select GlassButton.designer.vb
3) Ignore all the errors and just the do same steps and add GlassButton.vb (I answered "No" to a prompt about overwriting the existing designer vb file)
4) The only warning that I got was referencing the XML comment for a tag with 'cref' attribute, which it would ignore anyway (it will go away if you remove "<" and "/>" from that line)
5) Close all open forms and rebuild the project

If you still have errors then you might need to add or check references, right click the project and go to Properties window, select References and in the Imported Namespaces try to check all those that appear on top of the GlassButton.vb as "Imports".

I just tried these 5 steps listed above in version 3.8.4 and it worked.

Depending on the AHMI version that you are using, you might get some other errors once you try to create AHMI GlassButton control (this since every new version might implement code changes in certain classes). Try to use common sense and just copy and paste, or remove, one property at the time to see how it reflects on the control. In the file that was posted previously you might notice that there is no PLCAddressValue property, this since there is no "Value" property either so I didn't think that it would do anything useful and removed it (which I might be wrong about).

From what I've seen so far, some output types might not work correctly (Momentary Set, Momentary Reset, Set True, Set False appear to work fine but I couldn't get Toggle and Write Value to work with OPC Simulator). <-- Tried this with MicroLogix PLC and Toggle works fine, only WriteValue I am still not sure how to use properly (if Archie could provide a hint that would help)

1389
Additional Components / LED Matrix Control
« on: February 03, 2015, 09:09:50 PM »
If anyone might find it useful, here is a link to C# version of LED Matrix Control:

http://www.codeproject.com/Articles/62576/A-C-LED-matrix-display

The code provided can be converted into a VB Net code (I used SharpDevelop 4.4), and a few small changes need to be made so the code could work and control created in Visual Studio. Then it can be converted into an AHMI control to get and show values from a PLC.

It is possible to add bunch of new properties and a few subs to make this control interactive in the Design mode.
I can not post a code but could provide directions to those who might be interested.

1390
Additional Components / Re: Quick Chart
« on: February 03, 2015, 12:24:47 AM »
Here is a slightly improved this latest version for 1 log file.

If you are to try the program there are 2 fake log files attached, one with 3 and the other with 5 logged values, just for performance comparison. Try them one at the time and do note the file size difference.

And if you ever try to graph all series and all logged values at once, that might take some time and show a mess of a graph.
So, stick with the simple way.

1391
Additional Components / Re: Quick Chart
« on: February 01, 2015, 08:06:59 PM »
New version of BasicDataLogger can log multiple values at once so here is a quick chart that can show up to 5 logged values.

Not really intended for any large log files.

Solution is also attached so modify it if you need any different.

The more points you'd want to see the slower the performance. Fake sample log file is also attached (approx 175kB with 5 logged values).

I removed the ALARM feature just to make this program simpler and a bit faster.

1392
Tips & Tricks / Re: Glass Buttons
« on: January 22, 2015, 01:11:39 AM »
Since I am not familiar with using breakpoint and stepping through the code, which I tried for a little while, here is what I tried:

- Use a copy of SquareIlluminatedButton.vb to convert GlassButton to AHMI control
-- Add OutputType property to it since it was missing and error was showing (which I then copied from BasicButton)
-- Add PLCAddressEnabled property to it as well

I will have a guess and say that SquareIlluminatedButton control was inheriting OutputType property from MfgControl.AdvancedHMI.Controls.SquareIlluminatedButton and that's why I was getting error.

And now it works and responds to a PLC address and changes Enabled property.
I am still not sure why BasicButton wouldn't do the same.

>>>  For those who decide to try to create this control, just follow the steps from the 1st post. <<<

This will give you an option to Enable/Disable button with a PLC address bit.

1393
Tips & Tricks / Re: Glass Buttons
« on: January 21, 2015, 10:53:01 PM »
Either I am doing it wrong or it just doesn't work.

This "Enabled" property appears to be inherited from Windows Button control, since I have:

Class GlassButton --> Inherits Button
Class GlassButtonHMI --> Inherits GlassButton

Here is the property I created:

Code: [Select]
    '*****************************************
    '* Property - Address in PLC to Link to
    '*****************************************
    Private _PLCAddressEnabled As String = ""
    <System.ComponentModel.Category("PLC Properties")> _
    Public Property PLCAddressEnabled() As String
        Get
            Return _PLCAddressEnabled
        End Get
        Set(ByVal value As String)
            If _PLCAddressEnabled <> value Then
                _PLCAddressEnabled = value

                '* When address is changed, re-subscribe to new address
                SubscribeToCommDriver()
            End If
        End Set
    End Property

This new property shows and I can enter a PLC address but it just doesn't do anything to Enabled property.

I did try to create a new Enabled property in the GlassButton class, which overloads the Enabled property of the Windows Button control, but that didn't work either.

It's not a big deal to have this property, but if there is a way it would be nice to have (at least in my opinion).

1394
Tips & Tricks / Re: Glass Buttons
« on: January 21, 2015, 09:23:19 PM »
Separate thread should work better.

This button could be used as just image holder, without functioning as button, that way animated GIF could have a good purpose (but could serve as a button as well).

I do have a question for you if there is possibility to create PLCAddressEnabled property to control the current Enabled property through a PLC address instead of creating a code (or list of steps for doing it)?

1395
Tips & Tricks / Glass Buttons
« on: January 21, 2015, 08:32:36 PM »
And here you can find a nice looking Glass Button which can easily be converted to AHMI control:

http://lukesw.net/articles/GlassButton.aspx

The link above doesn't seem to be valid any longer, so try either of these:

https://www.codeproject.com/Articles/17695/Creating-a-Glass-Button-using-GDI
https://www.codeproject.com/Articles/18000/Enhanced-GlassButton-using-GDI


Download demo file that contains the library, add this library as reference to both AdvancedHMI and AdvancedHMIControls projects and then download and add the attached GlassButtonHMI.vb file to the PurchasedControls folder as ExistingItem.

It supports an image showing in the button (check the attached picture with icon file used as image).
Animated GIFs are also supported and you can find some here:

https://www.animatedimages.org

The only way to control animation is to have the button disabled, but still visible, and once enabled by some event the animation will be running (maybe there is another way but I still need to discover it).

* Edit: There is a simpler and safer way of adding this control to AHMI. Read bachphi's post on the 2nd page.

Pages: 1 ... 91 92 [93] 94 95