当前位置: 首页>>代码示例>>C#>>正文


C# Point.SetValue方法代码示例

本文整理汇总了C#中Point.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Point.SetValue方法的具体用法?C# Point.SetValue怎么用?C# Point.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


在下文中一共展示了Point.SetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: gridView1_CustomDrawCell


//.........这里部分代码省略.........
                            e.Graphics.FillRectangle(sb, e.Bounds);
                        }
                        if (m_viewtype == SuiteViewType.Easy )
                        {
                            float dispvalue = 0;
                            dispvalue = (float)cellvalue;
                            if (correction_offset != 0 || correction_factor != 1)
                            {
                                dispvalue = (float)((float)cellvalue * (float)correction_factor) + (float)correction_offset;
                                if (m_viewtype != SuiteViewType.Hexadecimal)
                                //if (!m_isHexMode)
                                {
                                    if (m_map_name.StartsWith("Ign_map_0!") || m_map_name.StartsWith("Ign_map_4!"))
                                    {
                                        e.DisplayText = dispvalue.ToString("F1") + "\u00b0";
                                        /*if (dispvalue < 0)
                                        {
                                            logger.Debug("Negative value:  " + cellvalue.ToString());

                                        }*/
                                    }
                                    else if (m_map_name.StartsWith("Reg_kon_mat"))
                                    {
                                        e.DisplayText = dispvalue.ToString("F0") + @"%";
                                    }
                                    else
                                    {
                                        e.DisplayText = dispvalue.ToString("F2");
                                    }
                                }
                                else
                                {
                                    //e.DisplayText = dispvalue.ToString();
                                }
                            }
                            else if (m_map_name.StartsWith("Reg_kon_mat"))
                            {
                                e.DisplayText = dispvalue.ToString("F0") + @"%";
                            }
                        }
                        //if (m_map_name == "BFuelCal.Map" || m_map_name == "IgnNormCal.Map" || m_map_name == "TargetAFR" || m_map_name == "FeedbackAFR" || m_map_name == "FeedbackvsTargetAFR")
                        if (X_axis_name.ToLower() == "mg/c" && Y_axis_name.ToLower() == "rpm")
                        {
                            
                            try
                            {
                                if (open_loop != null)
                                {
                                    int airmassvalue = GetXaxisValue(e.Column.AbsoluteIndex);
                                    int rpmvalue = GetYaxisValue(e.RowHandle);
                                    if (open_loop.Length > 0)
                                    {
                                        int mapopenloop = GetOpenLoopValue(e.RowHandle);
                                        if (mapopenloop > airmassvalue)
                                        {
                                            if (m_StandardFill == 0)
                                            {

                                            }
                                            else if (m_StandardFill == 1)
                                            {
                                                Pen p = new Pen(Brushes.Black, 2);
                                                e.Graphics.DrawRectangle(p, e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2);
                                                p.Dispose();
                                            }
                                            else
                                            {
                                                Point[] pnts = new Point[4];
                                                pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 0);
                                                pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width - (e.Bounds.Height / 2), e.Bounds.Y), 1);
                                                pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y + (e.Bounds.Height / 2)), 2);
                                                pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 3);
                                                e.Graphics.FillPolygon(Brushes.SeaGreen, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                                            }             
                                        }
                                    }
                                }
                            }
                            catch (Exception E)
                            {
                                logger.Debug(E.Message);
                            }

                        }
                    }
                }
                if (m_selectedrowhandle >= 0 && m_selectedcolumnindex >= 0)
                {
                    if (e.RowHandle == m_selectedrowhandle && e.Column.AbsoluteIndex == m_selectedcolumnindex)
                    {
                        SolidBrush sbsb = new SolidBrush(Color.Yellow);
                        e.Graphics.FillRectangle(sbsb, e.Bounds);
                    }
                }
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
        }
开发者ID:ChrisPea,项目名称:TuningSuites,代码行数:101,代码来源:MapViewerEx.cs

示例2: gridView1_CustomDrawCell

        private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            try
            {
                if (e.CellValue != null)
                {
                    if (e.CellValue != DBNull.Value)
                    {
                        int b = 0;
                        int cellvalue = 0;
                        //if (m_isHexMode)
                        b = Convert.ToInt32(e.CellValue.ToString());
                        cellvalue = b;
                        b *= 255;
                        if (m_MaxValueInTable != 0)
                        {
                            b /= m_MaxValueInTable;
                        }
                        int red = 128;
                        int green = 128;
                        int blue = 128;
                        Color c = Color.White;
                        red = b;
                        if (red < 0) red = 0;
                        if (red > 255) red = 255;
                        if (b > 255) b = 255;
                        blue = 0;
                        green = 255 - red;
                        c = Color.FromArgb(red, green, blue);
                        SolidBrush sb = new SolidBrush(c);
                        e.Graphics.FillRectangle(sb, e.Bounds);

                        // check limiter type
                        //limitermap
                        int row = rows - (e.RowHandle + 1);
                        limitType curLimit = (limitType)limitermap.GetValue((row * columns) + e.Column.AbsoluteIndex);
                        Point[] pnts = new Point[4];
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 0);
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width - (e.Bounds.Height / 2), e.Bounds.Y), 1);
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y + (e.Bounds.Height / 2)), 2);
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 3);
                        if (curLimit == limitType.AirmassLimiter)
                        {
                            e.Graphics.FillPolygon(Brushes.Blue, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TorqueLimiterEngineE85)
                        {
                            e.Graphics.FillPolygon(Brushes.Purple, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TorqueLimiterEngine)
                        {
                            e.Graphics.FillPolygon(Brushes.Yellow, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TurboSpeedLimiter)
                        {
                            e.Graphics.FillPolygon(Brushes.Black, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TorqueLimiterGear)
                        {
                            e.Graphics.FillPolygon(Brushes.SaddleBrown, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.FuelCutLimiter)
                        {
                            e.Graphics.FillPolygon(Brushes.DarkGray, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.OverBoostLimiter)
                        {
                            e.Graphics.FillPolygon(Brushes.CornflowerBlue, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TorqueLimiterEngineE85Auto)
                        {
                            e.Graphics.FillPolygon(Brushes.White, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        if (comboBoxEdit2.SelectedIndex == 1)
                        {
                            // convert airmass to torque
                            int rpm = Convert.ToInt32(x_axisvalues.GetValue(e.Column.AbsoluteIndex));
                            int torque;
                            if (displayTorqueInLBFT.Checked)
                            {
                                torque = AirmassToTorqueLbft(Convert.ToInt32(e.CellValue), rpm, useTrionicCalculationForTorque.Checked);
                                e.DisplayText = torque.ToString();
                            }
                            else
                            {
                                torque = AirmassToTorque(Convert.ToInt32(e.CellValue), rpm, useTrionicCalculationForTorque.Checked);
                            }
                            e.DisplayText = torque.ToString();
                        }
                        else if (comboBoxEdit2.SelectedIndex == 2)
                        {
                            //convert airmass to horsepower
                            int rpm = Convert.ToInt32(x_axisvalues.GetValue(e.Column.AbsoluteIndex));
                            int torque = AirmassToTorque(Convert.ToInt32(e.CellValue), rpm, useTrionicCalculationForTorque.Checked);
                            int horsepower = TorqueToPower(torque, rpm);
                            if (displayPowerInkW.Checked)
                            {
                                horsepower = TorqueToPowerkW(torque, rpm);
                            }
                            e.DisplayText = horsepower.ToString();
//.........这里部分代码省略.........
开发者ID:Meindert66,项目名称:T7Suite,代码行数:101,代码来源:ctrlAirmassResult.cs

示例3: DrawDropLine

        void DrawDropLine(Graphics g, int index, bool drawLine, HitTestType hit)
        {
            Brush brush = null;
            Pen pen = null;
            try
            {
                if (drawLine)
                {
                    droppedPosition = index;
                    lastDrawnLineIndex = index;
                    brush = SystemBrushes.ControlText;
                    pen = SystemPens.ControlText;
                }
                else
                {
                    // If there is nothing painted, no need to erase
                    if (lastDrawnLineIndex == -1)
                        return;

                    index = lastDrawnLineIndex;
                    brush = new SolidBrush(bands[currentBandIndex].Background);
                    pen = new Pen(bands[currentBandIndex].Background);
                    lastDrawnLineIndex = -1;
                }

                int itemsCount = bands[currentBandIndex].Items.Count;
                Rectangle itemRect = GetItemRect(g, bands[currentBandIndex], index, Rectangle.Empty);

                Rectangle viewPortRect = GetViewPortRect();
                int y;
                if (bands[currentBandIndex].IconView == IconView.Small)
                    y = itemRect.Top - Y_SMALLICON_SPACING / 2;
                else
                    y = itemRect.Top - Y_LARGEICON_SPACING;

                if (hit == HitTestType.DropLineLastItem)
                {
                    // use the bottom of the label if dealing with the last item
                    Rectangle labelRect = GetLabelRect(itemsCount - 1);
                    y = labelRect.Bottom + Y_LARGEICON_SPACING;
                    paintedDropLineLastItem = true;
                    // the none existing item index
                    droppedPosition = itemsCount;
                }
                else if (paintedDropLineLastItem)
                {
                    Rectangle labelRect = GetLabelRect(itemsCount - 1);
                    y = labelRect.Bottom + Y_LARGEICON_SPACING;
                    paintedDropLineLastItem = false;
                }

                // If we are using a bitmap background, erase
                // by painting the portion of the bitmap background
                if (backgroundBitmap != null && lastDrawnLineIndex == -1)
                {
                    Rectangle rcStrip = new Rectangle(viewPortRect.Left, y - 6, viewPortRect.Width, 12);
                    g.DrawImage(backgroundBitmap, rcStrip, rcStrip, GraphicsUnit.Pixel);
                    return;
                }

                // Draw horizontal line
                Point p1 = new Point(viewPortRect.Left + 11, y);
                Point p2 = new Point(viewPortRect.Right - 11, y);
                g.DrawLine(pen, p1, p2);

                // Draw left triangle
                Point top;
                Point bottom;
                if (index == firstItem)
                    top = new Point(viewPortRect.Left + 5, y);
                else
                    top = new Point(viewPortRect.Left + 5, y - 6);

                if (hit == HitTestType.DropLineLastItem)
                    bottom = new Point(viewPortRect.Left + 5, y + 1);
                else
                    bottom = new Point(viewPortRect.Left + 5, y + 6);

                Point middle = new Point(viewPortRect.Left + 11, y);
                Point[] points = new Point[3];
                points.SetValue(top, 0);
                points.SetValue(middle, 1);
                points.SetValue(bottom, 2);
                g.FillPolygon(brush, points);

                // Draw right triangle
                if (index == firstItem)
                    top = new Point(viewPortRect.Right - 5, y);
                else
                    top = new Point(viewPortRect.Right - 5, y - 6);

                if (hit == HitTestType.DropLineLastItem)
                    bottom = new Point(viewPortRect.Right - 5, y + 1);
                else
                    bottom = new Point(viewPortRect.Right - 5, y + 6);

                middle = new Point(viewPortRect.Right - 11, y);
                points.SetValue(top, 0);
                points.SetValue(middle, 1);
                points.SetValue(bottom, 2);
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:CarlaLegacy,代码行数:101,代码来源:OutlookBar.cs

示例4: neck_extract

 //extract neck button
 private void neck_extract(object sender, RoutedEventArgs e)
 {
     VirtualSurgeonPoint[] points = m_vs_wrapper.FindNeck();
     Point[] newp = new Point[points.Length];
     int i = 0;
     foreach (VirtualSurgeonPoint p in points)
     {
         newp.SetValue(new Point(p.x, p.y), i++);
     }
     image1.points = newp;
     image1.UnderlayImage = myBitmapImage;
     image1.Init();
     image1.InvalidateVisual();
 }
开发者ID:gp1313,项目名称:morethantechnical,代码行数:15,代码来源:Window1.xaml.cs

示例5: gridView1_CustomDrawCell

        private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            //  if mapname is Insp_mat or Fuel_knock_map indicate open/closed loop operation
            // the map indicating where the ecu switches to open loop should be loaded into... 
            // for Fuel_knock_map this is Open_loop_knock!
            // for Insp_mat this is Open_loop!
            try
            {
                if (e.CellValue != null)
                {
                    if (e.CellValue != DBNull.Value)
                    {
                        int b = 0;
                        int cellvalue = 0;
                        //if (m_isHexMode)
                        if (m_viewtype == Trionic5Tools.ViewType.Hexadecimal)
                        {
                            b = Convert.ToInt32(e.CellValue.ToString(), 16);
                            cellvalue = b;
                        }
                        else
                        {
                            b = Convert.ToInt32(e.CellValue.ToString());
                            cellvalue = b;
                        }
                        b *= 255;
                        if (m_MaxValueInTable != 0)
                        {
                            b /= m_MaxValueInTable;
                        }
                        int red = 128;
                        int green = 128;
                        int blue = 128;
                        Color c = Color.White;
                        if (m_map_name == "TargetAFR" || m_map_name == "FeedbackAFR" || m_map_name == "FeedbackvsTargetAFR" || m_map_name == "IdleTargetAFR" || m_map_name == "IdleFeedbackAFR" || m_map_name == "IdleFeedbackvsTargetAFR" || m_OnlineMode)
                        {
                            b /= 2;
                            red = b;
                            if (red < 0) red = 0;
                            if (red > 255) red = 255;
                            if (b > 255) b = 255;
                            green = 255-red;
                            blue = 255 - red;
                            c = Color.FromArgb(red, green, blue);
                           // if (b == 0) c = Color.Transparent;

                        }
                        else if (!m_isRedWhite)
                        {
                            red = b;
                            if (red < 0) red = 0;
                            if (red > 255) red = 255;
                            if (b > 255) b = 255;
                            blue = 0;
                            green = 255 - red;
                            c = Color.FromArgb(red, green, blue);
                        }
                        else
                        {
                            if (b < 0) b = -b;
                            if (b > 255) b = 255;
                            c = Color.FromArgb(b, Color.Red);
                        }
                        if (!m_disablecolors)
                        {
                            SolidBrush sb = new SolidBrush(c);
                            e.Graphics.FillRectangle(sb, e.Bounds);
                        }
                        // draw indicator for changed by user
                        try
                        {
                            if (m_values_changed_highlight_user != null)
                            {
                                byte bchangeduser = Convert.ToByte(m_values_changed_highlight_user.GetValue((e.RowHandle * m_TableWidth) + e.Column.AbsoluteIndex));
                                if (bchangeduser > 0)
                                {
                                    // draw triangle
                                    Point[] pnts = new Point[4];
                                    pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 0);
                                    pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width - (e.Bounds.Height / 2), e.Bounds.Y), 1);
                                    pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y + (e.Bounds.Height / 2)), 2);
                                    pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 3);
                                    e.Graphics.FillPolygon(Brushes.Yellow, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                                }
                                
                            }
                            if(m_values_changed_highlight_ecu != null)
                            {
                                byte bchangedecu = Convert.ToByte(m_values_changed_highlight_ecu.GetValue((e.RowHandle * m_TableWidth) + e.Column.AbsoluteIndex));
                                if (bchangedecu > 0)
                                {
                                    // draw triangle
                                    Point[] pnts = new Point[4];
                                    pnts.SetValue(new Point(e.Bounds.X, e.Bounds.Y), 0);
                                    pnts.SetValue(new Point(e.Bounds.X + (e.Bounds.Height / 2), e.Bounds.Y), 1);
                                    pnts.SetValue(new Point(e.Bounds.X, e.Bounds.Y + (e.Bounds.Height / 2)), 2);
                                    pnts.SetValue(new Point(e.Bounds.X, e.Bounds.Y), 3);
                                    e.Graphics.FillPolygon(Brushes.Orange, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                                }
                            }
//.........这里部分代码省略.........
开发者ID:ChrisPea,项目名称:TuningSuites,代码行数:101,代码来源:MapViewer.cs

示例6: gridView1_CustomDrawCell

        private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            try
            {
                if (e.CellValue != null)
                {
                    if (e.CellValue != DBNull.Value)
                    {
                        int b = 0;
                        int cellvalue = 0;
                        //if (m_isHexMode)
                        b = Convert.ToInt32(e.CellValue.ToString());
                        cellvalue = b;
                        b *= 255;
                        if (m_MaxValueInTable != 0)
                        {
                            b /= m_MaxValueInTable;
                        }
                        int red = 128;
                        int green = 128;
                        int blue = 128;
                        Color c = Color.White;
                        red = b;
                        if (red < 0) red = 0;
                        if (red > 255) red = 255;
                        if (b > 255) b = 255;
                        blue = 0;
                        green = 255 - red;
                        c = Color.FromArgb(red, green, blue);
                        SolidBrush sb = new SolidBrush(c);
                        e.Graphics.FillRectangle(sb, e.Bounds);

                        // check limiter type
                        //limitermap
                        int row = rows - (e.RowHandle + 1);
                        limitType curLimit = (limitType)limitermap.GetValue((row * columns) + e.Column.AbsoluteIndex);
                        Point[] pnts = new Point[4];
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 0);
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width - (e.Bounds.Height / 2), e.Bounds.Y), 1);
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y + (e.Bounds.Height / 2)), 2);
                        pnts.SetValue(new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y), 3);
                        if (curLimit == limitType.AirmassLimiter)
                        {
                            e.Graphics.FillPolygon(Brushes.Blue, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TorqueLimiterEngine)
                        {
                            e.Graphics.FillPolygon(Brushes.Yellow, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TurboSpeedLimiter)
                        {
                            e.Graphics.FillPolygon(Brushes.Black, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.TorqueLimiterGear)
                        {
                            e.Graphics.FillPolygon(Brushes.SaddleBrown, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        else if (curLimit == limitType.FuelCutLimiter)
                        {
                            e.Graphics.FillPolygon(Brushes.DarkGray, pnts, System.Drawing.Drawing2D.FillMode.Winding);
                        }
                        if (comboBoxEdit2.SelectedIndex == 1)
                        {
                            // convert airmass to torque
                            if (_ECUType.Contains("EDC16"))
                            {
                                int rpm = Convert.ToInt32(y_axisvalues.GetValue(e.Column.AbsoluteIndex));
                                int torque = Convert.ToInt32(e.CellValue);
                                torque /= 10;
                                e.DisplayText = torque.ToString();
                            }
                            else
                            {
                                int rpm = Convert.ToInt32(y_axisvalues.GetValue(e.Column.AbsoluteIndex));
                                int torque = Tools.Instance.IQToTorque(Convert.ToInt32(e.CellValue), rpm, m_numberCylinders);
                                if (checkEdit6.Checked)
                                {
                                    torque = Tools.Instance.IQToTorque(Convert.ToInt32(e.CellValue), rpm, m_numberCylinders);// AirmassToTorqueLbft(Convert.ToInt32(e.CellValue), rpm);
                                }
                                torque /= 100;
                                e.DisplayText = torque.ToString();
                            }
                        }
                        else if (comboBoxEdit2.SelectedIndex == 2)
                        {
                            if (_ECUType.Contains("EDC16"))
                            {
                                int rpm = Convert.ToInt32(y_axisvalues.GetValue(e.Column.AbsoluteIndex));
                                int torque = Convert.ToInt32(e.CellValue);
                                torque /= 10;
                                double temptorque = torque * Tools.Instance.GetCorrectionFactorForRpm(rpm, m_numberCylinders);
                                torque = Convert.ToInt32(temptorque);
                                int horsepower = Tools.Instance.TorqueToPower(torque, rpm);
                                if (checkEdit5.Checked)
                                {
                                    horsepower = Tools.Instance.TorqueToPowerkW(torque, rpm);
                                }
                                e.DisplayText = horsepower.ToString();
                            }
                            else
//.........这里部分代码省略.........
开发者ID:Blackfrosch,项目名称:VAGEDCSuite,代码行数:101,代码来源:ctrlAirmassResult.cs


注:本文中的Point.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。