コード例 #1
0
ファイル: GraphForm.cs プロジェクト: sonerkuzucu/VirtualPanel
        private void SetDrawPen(string PenColor)
        {
            Color col = VirtualPanelForm.String2Color(PenColor);

            if (!col.IsEmpty)
            {
                DrawColor = col;               //
            }
            if (PenColor == "$1PX")
            {
                DrawPenSize = 1;
            }
            if (PenColor == "$2PX")
            {
                DrawPenSize = 2;
            }
            if (PenColor == "$3PX")
            {
                DrawPenSize = 3;
            }
            if (PenColor == "$4PX")
            {
                DrawPenSize = 4;
            }
        }
コード例 #2
0
ファイル: GraphForm.cs プロジェクト: sonerkuzucu/VirtualPanel
        private void SetDrawPointPen(string PenColor)
        {
            Color col = VirtualPanelForm.String2Color(PenColor);

            if (!col.IsEmpty)
            {
                DrawPointColor = col;               //
            }
        }
コード例 #3
0
ファイル: GraphForm.cs プロジェクト: sonerkuzucu/VirtualPanel
        private void SetLabelAppearance(Label control, MessageEventArgs <object> mse)
        {
            PictureBox p = null;

            control.Visible = true;

            if (control == graphLabel1)
            {
                p = PenColor1;
            }
            if (control == graphLabel2)
            {
                p = PenColor2;
            }
            if (control == graphLabel3)
            {
                p = PenColor3;
            }
            if (control == graphLabel4)
            {
                p = PenColor4;
            }
            if (control == graphLabel5)
            {
                p = PenColor5;
            }

            if (mse.Type == vp_type.vp_boolean)
            {
                if (!(bool)mse.Data)
                {
                    control.Visible = false;
                }
            }
            else if (mse.Type == vp_type.vp_string)
            {
                Color col = VirtualPanelForm.String2Color((string)mse.Data);
                if (!col.IsEmpty)
                {
                    p.BackColor = col; p.Visible = true;
                }
                else if ((string)mse.Data == "$OFF")
                {
                    p.Visible = false;
                }
                else
                {
                    control.Text = (string)mse.Data;
                }
            }
            else
            {
                control.Text = mse.Data.ToString();
            }
        }
コード例 #4
0
ファイル: GraphForm.cs プロジェクト: sonerkuzucu/VirtualPanel
        private void Drawtext(string data)
        {
            Color col = VirtualPanelForm.String2Color(data);

            if (!col.IsEmpty)
            {
                DrawTextColor = col; //
            }
            else
            {
                if (DrawTextColor == Color.Black)
                {
                    PersistentDrawing.Delete(new Text(DrawtextPoint, data, DrawTextColor, 8));
                }
                else
                {
                    PersistentDrawing.Add(new Text(DrawtextPoint, data, DrawTextColor, 8));
                }
                GraphPictureBox1.Invalidate();
            }
        }
コード例 #5
0
ファイル: GraphForm.cs プロジェクト: sonerkuzucu/VirtualPanel
        private void SetGraphAttr(string data, Graph GraphPlot)
        {
            Color col = VirtualPanelForm.String2Color(data);

            if (!col.IsEmpty)
            {
                GraphPlot.Color = col; //
            }
            else
            {
                if (data == "$CLEAR")
                {
                    GraphPlot.ClearData();
                }
                if (data == "$ROLLING")
                {
                    GraphPlot.Type = GraphType.Rolling;
                }
                if (data == "$STATIC")
                {
                    GraphPlot.Type = GraphType.Static;
                }
                if (data == "$1PX")
                {
                    GraphPlot.PlotWidth = 1;
                }
                if (data == "$2PX")
                {
                    GraphPlot.PlotWidth = 2;
                }
                if (data == "$3PX")
                {
                    GraphPlot.PlotWidth = 3;
                }
                if (data == "$4PX")
                {
                    GraphPlot.PlotWidth = 4;
                }
            }
        }
コード例 #6
0
ファイル: GraphForm.cs プロジェクト: sonerkuzucu/VirtualPanel
        private void Arduinoport_MessageReceived(object sender, MessageEventArgs <object> mse)
        {
            ChannelId id = (ChannelId)mse.ChannelID;

            Tuple <ChannelId, Control> control = pannelControlList.Find(t => t.Item1 == id);

            if (!Hold)
            {
                if (control != null)
                {
                    if (control.Item2 is Button)
                    {
                        VirtualPanelForm.SetButtonAppearance((Button)control.Item2, mse);
                    }
                    if (control.Item2 is Label)
                    {
                        SetLabelAppearance((Label)control.Item2, mse);
                    }
                }

                if ((ChannelId)mse.ChannelID == ChannelId.Graph && mse.Type == vp_type.vp_string)
                {
                    if ((string)mse.Data == "$CLEAR")
                    {
                        PersistentDrawing.Clear(); LinePointValid = false;
                    }
                }
                //               if ((ChannelId)mse.ChannelID == ChannelId.GraphPen && mse.Type == vp_type.vp_string) SetDrawPointPen((string)mse.Data);
                if ((ChannelId)mse.ChannelID == ChannelId.GraphDrawLine && mse.Type == vp_type.vp_ulong)
                {
                    DrawPersitentLine((Int64)mse.Data);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphDrawLine && mse.Type == vp_type.vp_string)
                {
                    SetDrawPen((string)mse.Data);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphDrawLine && mse.Type == vp_type.vp_uint)
                {
                    DrawLinePoint((ushort)(int)mse.Data);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphDrawLine && mse.Type == vp_type.vp_void)
                {
                    LinePointValid = false;
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphDrawPixel && mse.Type == vp_type.vp_uint)
                {
                    DrawPixel((ushort)(int)mse.Data);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphDrawPixel && mse.Type == vp_type.vp_string)
                {
                    SetDrawPointPen((string)mse.Data);
                }
                ;
                if ((ChannelId)mse.ChannelID == ChannelId.GraphText && mse.Type == vp_type.vp_uint)
                {
                    DrawTextPos((Int32)mse.Data);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphText && mse.Type == vp_type.vp_string)
                {
                    Drawtext((string)mse.Data);
                }

                if ((ChannelId)mse.ChannelID == ChannelId.GraphGrid && mse.Type == vp_type.vp_boolean)
                {
                    Grid = (bool)mse.Data;
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphGrid && mse.Type == vp_type.vp_int)
                {
                    Grid = true; GridCount = (int)mse.Data;
                }

                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_1 && mse.Type == vp_type.vp_string)
                {
                    SetGraphAttr((string)mse.Data, GraphPlot_1);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_2 && mse.Type == vp_type.vp_string)
                {
                    SetGraphAttr((string)mse.Data, GraphPlot_2);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_3 && mse.Type == vp_type.vp_string)
                {
                    SetGraphAttr((string)mse.Data, GraphPlot_3);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_4 && mse.Type == vp_type.vp_string)
                {
                    SetGraphAttr((string)mse.Data, GraphPlot_4);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_5 && mse.Type == vp_type.vp_string)
                {
                    SetGraphAttr((string)mse.Data, GraphPlot_5);
                }

                if ((ChannelId)mse.ChannelID == ChannelId.GraphValueCount_1 && mse.Type == vp_type.vp_int)
                {
                    GraphPlot_1.SampleCount = (int)mse.Data;
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValueCount_2 && mse.Type == vp_type.vp_int)
                {
                    GraphPlot_2.SampleCount = (int)mse.Data;
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValueCount_3 && mse.Type == vp_type.vp_int)
                {
                    GraphPlot_3.SampleCount = (int)mse.Data;
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValueCount_4 && mse.Type == vp_type.vp_int)
                {
                    GraphPlot_4.SampleCount = (int)mse.Data;
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValueCount_5 && mse.Type == vp_type.vp_int)
                {
                    GraphPlot_5.SampleCount = (int)mse.Data;
                }

                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_1 && mse.Type == vp_type.vp_byte)
                {
                    GraphValueAdd((int)mse.Data, GraphPlot_1);
                }                                                                                                                                     //Grid = true; removed
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_2 && mse.Type == vp_type.vp_byte)
                {
                    GraphValueAdd((int)mse.Data, GraphPlot_2);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_3 && mse.Type == vp_type.vp_byte)
                {
                    GraphValueAdd((int)mse.Data, GraphPlot_3);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_4 && mse.Type == vp_type.vp_byte)
                {
                    GraphValueAdd((int)mse.Data, GraphPlot_4);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphValue_5 && mse.Type == vp_type.vp_byte)
                {
                    GraphValueAdd((int)mse.Data, GraphPlot_5);
                }

                if ((ChannelId)mse.ChannelID == ChannelId.GraphCaption_1 && mse.Type == vp_type.vp_string)
                {
                    DrawCaption((string)mse.Data, 1);
                }
                if ((ChannelId)mse.ChannelID == ChannelId.GraphCaption_2 && mse.Type == vp_type.vp_string)
                {
                    DrawCaption((string)mse.Data, 2);
                }

                GraphPictureBox1.Invalidate();
            }
        }