Exemple #1
0
        public _prop_SnapLtrans getAllData(double lat, double lon, double radius)
        {
            _prop_SnapLtrans     data_gis = null;
            PolylineDistanceInfo polylineDistanceInfo;
            PointD pt = new PointD();

            pt.X = lon;
            pt.Y = lat;
            if (!(sf.ShapeType == ShapeType.PolyLine || sf.ShapeType == ShapeType.PolyLineM))
            {
                return(null);
            }
            int index;

            EGIS.ShapeFileLib.ConversionFunctions.RefEllipse = 23;
            index = sf.GetClosestShape(pt, radius, out polylineDistanceInfo);
            if (index >= 0)
            {
                Console.Out.WriteLine("LineSegmentSide:" + polylineDistanceInfo.LineSegmentSide);
                if (sf.ShapeType == ShapeType.PolyLine)
                {
                    data_gis = new _prop_SnapLtrans();
                    double   total = 0;
                    PointD[] data  = sf.GetShapeDataD(index)[0];
                    for (int i = 0; i < data.Length - 1; i++)
                    {
                        total = total + ConversionFunctions.DistanceBetweenLatLongPoints(INDEX_WGS_84, data[i].Y, data[i].X, data[i + 1].Y, data[i + 1].X);
                    }

                    double distance_to_end = 0;
                    for (int i = polylineDistanceInfo.PointIndex; i < data.Length - 1; i++)
                    {
                        distance_to_end = distance_to_end + ConversionFunctions.DistanceBetweenLatLongPoints(INDEX_WGS_84, data[i].Y, data[i].X, data[i + 1].Y, data[i + 1].X);
                    }

                    double distance_snap     = ConversionFunctions.DistanceBetweenLatLongPoints(INDEX_WGS_84, lat, lon, polylineDistanceInfo.PolylinePoint.Y, polylineDistanceInfo.PolylinePoint.X);
                    string side_of_road      = GetLineSegmentSideDescription(polylineDistanceInfo.LineSegmentSide);
                    double distance_to_start = total - distance_to_end;
                    data_gis.lattitude_on_line = polylineDistanceInfo.PolylinePoint.Y;
                    data_gis.lontitude_on_line = polylineDistanceInfo.PolylinePoint.X;
                    data_gis.side_of_line      = side_of_road;
                    data_gis.snap_distance     = distance_snap;
                    data_gis.index_shape       = index;
                    data_gis.tVal = polylineDistanceInfo.TVal;
                    data_gis.calculate_length_line  = total;
                    data_gis.distance_snap_to_start = distance_to_start;
                    data_gis.distance_snap_to_end   = distance_to_end;
                    data_gis.data_db = this.dbr.GetFields(index);
                    data_gis.dt      = DbfToTable(dbr.GetFieldNames(), data_gis.data_db);
                    if (data.Length > 0)
                    {
                        data_gis.lat_start = data[0].Y;
                        data_gis.lon_start = data[0].X;
                        data_gis.lat_end   = data[data.Length - 1].Y;
                        data_gis.lon_end   = data[data.Length - 1].X;
                    }
                }
            }
            return(data_gis);
        }
Exemple #2
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Graphics G = e.Graphics;

            G.Clear(Color.FromArgb(246, 246, 246));

            G.DrawRectangle(ConversionFunctions.ToPen(150, 150, 150), new Rectangle(0, Convert.ToInt32(G.MeasureString(Text, Font).Height / 2), Width - 1, Height - 1 - Convert.ToInt32(G.MeasureString(Text, Font).Height / 2)));

            int TOff = 0;

            switch (TA)
            {
            case TAlign.Left:
                TOff = 6;
                break;

            case TAlign.Right:
                TOff = Width - 6 - (int)G.MeasureString(Text, Font).Width;
                break;

            case TAlign.Center:
                TOff = Convert.ToInt32((Width / 2) - (G.MeasureString(Text, Font).Width / 2));
                break;
            }

            G.FillRectangle(ConversionFunctions.ToBrush(246, 246, 246), new Rectangle(new Point(TOff, 0), G.MeasureString(Text, Font).ToSize()));

            G.DrawString(Text, Font, Brushes.Black, TOff, 0);
        }
    protected override void OnPaint(PaintEventArgs e)
    {
        Bitmap              image    = new Bitmap(base.Width, base.Height);
        Graphics            graphics = Graphics.FromImage(image);
        LinearGradientBrush brush    = new LinearGradientBrush(new Point(0, 0), new Point(0, base.Height), this.C3, this.C4);

        graphics.FillRectangle(brush, base.ClientRectangle);
        brush.Dispose();
        graphics.SmoothingMode = SmoothingMode.HighQuality;
        switch (this.State)
        {
        case MouseState.None:
            graphics.DrawEllipse(new Pen(this.C1, 2f), new Rectangle(2, 2, base.Width - 5, base.Height - 5));
            break;

        case MouseState.Over:
            graphics.DrawEllipse(new Pen(this.C2, 2f), new Rectangle(2, 2, base.Width - 5, base.Height - 5));
            break;

        case MouseState.Down:
            graphics.DrawEllipse(new Pen(this.CD, 2f), new Rectangle(2, 2, base.Width - 5, base.Height - 5));
            break;
        }
        graphics.FillEllipse(ConversionFunctions.ToBrush(this.C2), new Rectangle(5, 5, base.Width - 11, base.Height - 11));
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
Exemple #4
0
        void SkyBase_PaintHook(System.Windows.Forms.PaintEventArgs e)
        {
            SkyBase_T1 = new Rectangle(1, 1, Width - 3, 18);

            Bitmap SkyBase_B = new Bitmap(Width, Height);

            G = Graphics.FromImage(SkyBase_B);

            //Drawing
            G.Clear(SkyBase_C1);
            LinearGradientBrush SkyBase_G1 = new LinearGradientBrush(new Point(SkyBase_T1.X, SkyBase_T1.Y), new Point(SkyBase_T1.X, SkyBase_T1.Y + SkyBase_T1.Height), SkyBase_C3, SkyBase_C4);

            G.FillRectangle(SkyBase_G1, SkyBase_T1);
            G.DrawRectangle(ConversionFunctions.ToPen(SkyBase_C2), SkyBase_T1);
            G.DrawRectangle(ConversionFunctions.ToPen(SkyBase_C2), new Rectangle(SkyBase_T1.X, SkyBase_T1.Y + SkyBase_T1.Height + 2, SkyBase_T1.Width, Height - SkyBase_T1.Y - SkyBase_T1.Height - 4));

            SkyBase_G1.Dispose();

            G.DrawString(Text, Font, ConversionFunctions.ToBrush(113, 170, 186), new Rectangle(new Point(SkyBase_T1.X + 4, SkyBase_T1.Y), new Size(SkyBase_T1.Width - 40, SkyBase_T1.Height)), new StringFormat {
                LineAlignment = StringAlignment.Center
            });


            //Finish Up
            e.Graphics.DrawImage((Bitmap)SkyBase_B.Clone(), 0, 0);
            //G.Dispose();
            SkyBase_B.Dispose();
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            if (!(DropDownStyle == ComboBoxStyle.DropDownList))
            {
                DropDownStyle = ComboBoxStyle.DropDownList;
            }
            base.OnPaint(e);
            Graphics            G = e.Graphics;
            LinearGradientBrush T = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(0, Color.Black), Color.FromArgb(22, Color.Black), 90);
            SolidBrush          DrawCornersBrush = new SolidBrush(Color.FromArgb(20, 20, 20));

            DrawCornersBrush = (SolidBrush)ConversionFunctions.ToBrush(20, 20, 20);
            try
            {
                var _with1 = G;
                G.SmoothingMode = SmoothingMode.HighQuality;
                _with1.Clear(Color.FromArgb(20, 20, 20));
                _with1.FillRectangle(T, new Rectangle(0, 0, Width, Height));
                _with1.DrawLine(ConversionFunctions.ToPen(20, 20, 20), 0, 0, 0, 0);
                _with1.DrawRectangle(ConversionFunctions.ToPen(70, 70, 70), new Rectangle(1, 1, Width - 3, Height - 3));

                _with1.DrawLine(ConversionFunctions.ToPen(80, Color.White), new Point(Width - 22, 4), new Point(Width - 22, Height - 5));

                GraphicsPath K = new GraphicsPath();
                K.AddEllipse(-Width / 2, -Height, Width * 2, Convert.ToInt32(Height * 1.55));

                PathGradientBrush kK = new PathGradientBrush(K);
                kK.CenterColor    = Color.Transparent;
                kK.SurroundColors = new Color[] { Color.FromArgb(30, Color.DimGray) };
                _with1.FillPath(kK, K);

                try
                {
                    if (_with1.MeasureString(Text, Font).Width > Width - 29)
                    {
                        _with1.DrawString(Items[SelectedIndex].ToString(), Font, ConversionFunctions.ToBrush(71, 71, 71), new RectangleF(3, 3, Width - 35, Height - 7));
                        _with1.DrawString("...", Font, ConversionFunctions.ToBrush(230, 230, 230), new Point(Width - 38, 3));
                    }
                    else
                    {
                        _with1.DrawString(Items[SelectedIndex].ToString(), Font, ConversionFunctions.ToBrush(71, 71, 71), new RectangleF(3, 3, Width - 35, Height - 7));
                    }
                }
                catch
                {
                    _with1.DrawString("...", Font, ConversionFunctions.ToBrush(230, 230, 230), new Point(3, 3));
                }

                DrawTriangle(Color.FromArgb(230, 230, 230), new Point(Width - 15, Height - 10), new Point(Width - 12, Height - 7), new Point(Width - 9, Height - 10), G);
                DrawTriangle(Color.FromArgb(60, 60, 60), new Point(Width - 15, Height - 12), new Point(Width - 12, Height - 8), new Point(Width - 9, Height - 12), G);
                DrawTriangle(Color.FromArgb(230, 230, 230), new Point(Width - 15, 9), new Point(Width - 12, 6), new Point(Width - 9, 9), G);
                DrawTriangle(Color.FromArgb(60, 60, 60), new Point(Width - 15, 11), new Point(Width - 12, 7), new Point(Width - 9, 11), G);

                _with1.DrawPath(ConversionFunctions.ToPen(120, Color.Black), RRM.RoundRect(0, 0, Width - 1, Height - 1, 2));
            }
            catch
            {
            }
        }
    protected override void OnPaint(PaintEventArgs e)
    {
        Bitmap   image    = new Bitmap(base.Width - 5, base.Height - 5);
        Graphics graphics = Graphics.FromImage(image);

        graphics.Clear(base.Parent.BackColor);
        this.C3 = Color.FromArgb(70, 0x45, 0x44);
        this.C4 = Color.FromArgb(0x40, 60, 0x3b);
        switch (base.Enabled)
        {
        case false:
            this.C5 = Color.FromArgb(0x58, 0x58, 0x58);
            break;

        case true:
            switch (this.State)
            {
            case MouseState.None:
                this.C5 = Color.FromArgb(0x97, 0xb5, 190);
                break;

            case MouseState.Down:
                this.C5 = Color.FromArgb(0x79, 0x97, 160);
                this.C3 = Color.FromArgb(0x40, 60, 0x3b);
                this.C4 = Color.FromArgb(70, 0x45, 0x44);
                break;
            }
            break;
        }
        Rectangle           rect  = new Rectangle(0, 0, base.Height - 6, base.Height - 6);
        LinearGradientBrush brush = new LinearGradientBrush(new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height), this.C3, this.C4);

        graphics.FillRectangle(brush, rect);
        brush.Dispose();
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C1), rect);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2));
        Rectangle rectangle2 = new Rectangle(rect.X + (rect.Width / 4), rect.Y + (rect.Height / 4), rect.Width / 2, rect.Height / 2);

        Point[] pointArray = new Point[] { new Point(rectangle2.X, rectangle2.Y + (rectangle2.Height / 2)), new Point(rectangle2.X + (rectangle2.Width / 2), rectangle2.Y + rectangle2.Height), new Point(rectangle2.X + rectangle2.Width, rectangle2.Y) };
        if (this.Checked)
        {
            graphics.SmoothingMode = SmoothingMode.HighQuality;
            Pen pen = new Pen(ConversionFunctions.ToBrush(this.C5), 2f);
            for (int i = 0; i <= (pointArray.Length - 2); i++)
            {
                graphics.DrawLine(pen, pointArray[i], pointArray[i + 1]);
            }
        }
        StringFormat format = new StringFormat {
            LineAlignment = StringAlignment.Center,
            Alignment     = StringAlignment.Near
        };

        graphics.DrawString(base.Text, this.Font, ConversionFunctions.ToBrush(this.C5), new Rectangle((rect.X + rect.Width) + 5, 0, ((base.Width - rect.X) - rect.Width) - 5, base.Height), format);
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
Exemple #7
0
        /// <summary>
        /// Adobes the paint hook.
        /// </summary>
        void Adobe_PaintHook()
        {
            G.Clear(BackColor);

            //Top bar
            G.FillRectangle(new SolidBrush(Adobe_topBar) /*ConversionFunctions.ConvertToBrush(51, 51, 51)*/, 0, 0, Width, 37);
            G.DrawLine(new Pen(Adobe_Line1) /*ConversionFunctions.ConvertToPen(31, 31, 31)*/, 0, 37, Width, 37);
            G.DrawLine(new Pen(Adobe_Line2) /*ConversionFunctions.ConvertToPen(60, 60, 60)*/, 0, 38, Width, 38);

            //Middle
            G.FillRectangle(new SolidBrush(BackColor) /*ConversionFunctions.ConvertToBrush(68, 68, 68)*/, 1, 39, Width - 2, Height - 41);

            //Bottom bar
            G.FillRectangle(new SolidBrush(Adobe_bottomBar) /*ConversionFunctions.ConvertToBrush(51, 51, 51)*/, 1, Height - 37, Width, 37);
            G.DrawLine(new Pen(Adobe_Line1) /*ConversionFunctions.ConvertToPen(31, 31, 31)*/, 0, Height - 37, Width, Height - 37);
            G.DrawLine(new Pen(Adobe_Line2) /*ConversionFunctions.ConvertToPen(60, 60, 60)*/, 0, Height - 38, Width, Height - 38);

            //Title

            switch (textAlign)
            {
            case Alignment.Left:
                //Left
                DrawText(Brushes.Black, Text, HorizontalAlignment.Left, 10, 20);
                DrawText(ConversionFunctions.ConvertToBrush(ForeColor), Text, HorizontalAlignment.Left, 8, 18);
                break;

            case Alignment.Center:
                //Center
                DrawText(Brushes.Black, Text, HorizontalAlignment.Center, 2, 20);
                DrawText(ConversionFunctions.ConvertToBrush(ForeColor), Text, HorizontalAlignment.Center, 0, 18);
                break;

            case Alignment.Right:
                //Right
                DrawText(Brushes.Black, Text, HorizontalAlignment.Right, 10, 20);
                DrawText(ConversionFunctions.ConvertToBrush(ForeColor), Text, HorizontalAlignment.Right, 8, 18);
                break;
            }

            //Border
            DrawBorders(new Pen(Adobe_border1));
            DrawBorders(new Pen(Adobe_border2), 1);

            //Rounding
            switch (Parent.FindForm().FormBorderStyle)
            {
            case FormBorderStyle.None:
                DrawCorners(Color.Fuchsia);
                break;

            default:
                DrawCorners(Color.Black);
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="lat"></param>
        /// <param name="lon"></param>
        /// <param name="bearing">องศา</param>
        /// <param name="dis">เมตร</param>
        /// <returns>[0] = lat, [1] = lon</returns>
        public double[] AnotherPoint(double lat, double lon, double bearing, double dis)
        {
            UtmCoordinate utm     = ConversionFunctions.LLToUtm(23, lat, lon);
            UtmCoordinate utm_out = ConversionFunctions.LocationFromRangeBearing(utm, dis, bearing);

            LatLongCoordinate ll = ConversionFunctions.UtmToLL(23, utm_out);

            double[] output = new double[] { ll.Latitude, ll.Longitude };
            return(output);
        }
    protected override void OnPaint(PaintEventArgs e)
    {
        Bitmap   image    = new Bitmap(base.Width, base.Height);
        Graphics graphics = Graphics.FromImage(image);

        graphics.Clear(base.Parent.BackColor);
        switch (base.Enabled)
        {
        case false:
            this.C2 = Color.FromArgb(70, 70, 70);
            this.C3 = Color.FromArgb(0x36, 0x36, 0x33);
            this.C4 = Color.FromArgb(0x59, 0x58, 0x58);
            break;

        case true:
            switch (this.State)
            {
            case MouseState.None:
                this.C2 = Color.FromArgb(70, 70, 70);
                this.C3 = Color.FromArgb(0x36, 0x36, 0x33);
                this.C4 = Color.FromArgb(0x98, 0xb6, 0xc0);
                break;

            case MouseState.Down:
                this.C2 = Color.FromArgb(0x36, 0x36, 0x33);
                this.C3 = Color.FromArgb(70, 70, 70);
                this.C4 = Color.FromArgb(0x70, 0x8e, 0x98);
                break;
            }
            break;
        }
        Rectangle           rect  = new Rectangle(0, 0, base.Height - 1, base.Height - 1);
        LinearGradientBrush brush = new LinearGradientBrush(new Point(rect.X + (rect.Width / 2), rect.Y), new Point(rect.X + (rect.Width / 2), rect.Y + rect.Height), this.C2, this.C3);

        graphics.SmoothingMode = SmoothingMode.HighQuality;
        graphics.FillEllipse(brush, rect);
        graphics.DrawEllipse(new Pen(ConversionFunctions.ToBrush(this.C1)), rect);
        if (this.Checked)
        {
            graphics.FillEllipse(ConversionFunctions.ToBrush(this.C4), new Rectangle(rect.X + (rect.Width / 4), rect.Y + (rect.Height / 4), rect.Width / 2, rect.Height / 2));
        }
        StringFormat format = new StringFormat {
            LineAlignment = StringAlignment.Center,
            Alignment     = StringAlignment.Near
        };

        graphics.DrawString(base.Text, this.Font, ConversionFunctions.ToBrush(this.C4), new Rectangle((rect.X + rect.Width) + 5, 0, ((base.Width - rect.X) - rect.Width) - 5, base.Height), format);
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
 public void ReplaceItem(System.Object sender, System.Windows.Forms.DrawItemEventArgs e)
 {
     e.DrawBackground();
     try
     {
         if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
         {
             e.Graphics.FillRectangle(ConversionFunctions.ToBrush(200, 200, 200), e.Bounds);
         }
         e.Graphics.DrawString(base.GetItemText(base.Items[e.Index]), e.Font, ConversionFunctions.ToBrush(71, 71, 71), e.Bounds);
     }
     catch
     {
     }
 }
    protected override void OnPaint(PaintEventArgs e)
    {
        Bitmap    image    = new Bitmap(base.Width, base.Height);
        Graphics  graphics = Graphics.FromImage(image);
        Rectangle rect     = new Rectangle(3, 3, Convert.ToInt32((int)((base.Width - 7) * this.val / this.max)), base.Height - 7);

        graphics.Clear(this.C5);
        LinearGradientBrush brush = new LinearGradientBrush(new Point(0, 0), new Point(0, base.Height), this.C3, this.C4);

        graphics.FillRectangle(brush, rect);
        brush.Dispose();
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), rect);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C1), 0, 0, base.Width - 1, base.Height - 1);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), 1, 1, base.Width - 3, base.Height - 3);
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
        protected override void PaintHook()
        {
            Pen P1 = default(Pen);
            Pen P2 = default(Pen);

            P1 = new Pen(new SolidBrush(Color.FromArgb(31, 31, 31)));
            P2 = new Pen(new SolidBrush(Color.FromArgb(131, 131, 131)));

            G.Clear(BackColor);

            DrawBorders(P1, new Rectangle(0, 10, Width, Height - 10));
            DrawBorders(P2, new Rectangle(0, 10, Width, Height - 10), 1);
            DrawBorders(P1, new Rectangle(10, 0, Convert.ToInt32(G.MeasureString(Text, Font).Width + 10), 20));
            DrawBorders(P2, new Rectangle(10, 0, Convert.ToInt32(G.MeasureString(Text, Font).Width + 10), 20), 1);

            G.FillRectangle(new SolidBrush(BackColor), new Rectangle(12, 2, Convert.ToInt32(G.MeasureString(Text, Font).Width + 6), 20));
            G.DrawString(Text, Font, new SolidBrush(ForeColor), 14, 4);
            G.DrawString(Text, Font, ConversionFunctions.ConvertToBrush(Color.FromArgb(50, Color.Black)), 16, 6);
        }
    protected override void OnPaint(PaintEventArgs e)
    {
        Bitmap              image    = new Bitmap(base.Width, base.Height);
        Graphics            graphics = Graphics.FromImage(image);
        LinearGradientBrush brush    = new LinearGradientBrush(new Point(0, 0), new Point(0, base.Height), this.C3, this.C4);

        graphics.FillRectangle(brush, 0, 0, base.Width, base.Height);
        brush.Dispose();
        if (base.Enabled)
        {
            switch (this.State)
            {
            case MouseState.Over:
                graphics.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), new Rectangle(0, 0, base.Width, base.Height));
                break;

            case MouseState.Down:
                graphics.FillRectangle(new SolidBrush(Color.FromArgb(10, Color.Black)), new Rectangle(0, 0, base.Width, base.Height));
                break;
            }
        }
        StringFormat format = new StringFormat {
            LineAlignment = StringAlignment.Center,
            Alignment     = StringAlignment.Center
        };

        switch (base.Enabled)
        {
        case false:
            graphics.DrawString(this.Text, this.Font, Brushes.Gray, new Rectangle(0, 0, base.Width - 1, base.Height - 1), format);
            break;

        case true:
            graphics.DrawString(this.Text, this.Font, ConversionFunctions.ToBrush(0x71, 170, 0xba), new Rectangle(0, 0, base.Width - 1, base.Height - 1), format);
            break;
        }
        format.Dispose();
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C1), 0, 0, base.Width - 1, base.Height - 1);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), 1, 1, base.Width - 3, base.Height - 3);
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
    protected override void OnPaint(PaintEventArgs e)
    {
        Bitmap   image    = new Bitmap(base.Width, base.Height);
        Graphics graphics = Graphics.FromImage(image);

        switch (this.Align)
        {
        case Alignment.Vertical:
            graphics.DrawLine(ConversionFunctions.ToPen(this.C1), new Point(base.Width / 2, 0), new Point(base.Width / 2, base.Height));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point((base.Width / 2) + 1, 0), new Point((base.Width / 2) + 1, base.Height));
            break;

        case Alignment.Horizontal:
            graphics.DrawLine(ConversionFunctions.ToPen(this.C1), new Point(0, base.Height / 2), new Point(base.Width, base.Height / 2));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(0, (base.Height / 2) + 1), new Point(base.Width, (base.Height / 2) + 1));
            break;
        }
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
    protected override void OnPaint(PaintEventArgs e)
    {
        this.T1 = new Rectangle(1, 1, base.Width - 3, 0x12);
        Bitmap   image    = new Bitmap(base.Width, base.Height);
        Graphics graphics = Graphics.FromImage(image);

        graphics.Clear(this.C1);
        LinearGradientBrush brush = new LinearGradientBrush(new Point(this.T1.X, this.T1.Y), new Point(this.T1.X, this.T1.Y + this.T1.Height), this.C3, this.C4);

        graphics.FillRectangle(brush, this.T1);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), this.T1);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), new Rectangle(this.T1.X, (this.T1.Y + this.T1.Height) + 2, this.T1.Width, ((base.Height - this.T1.Y) - this.T1.Height) - 4));
        brush.Dispose();
        StringFormat format = new StringFormat {
            LineAlignment = StringAlignment.Center
        };

        graphics.DrawString(base.Text, this.Font, ConversionFunctions.ToBrush(0x71, 170, 0xba), new Rectangle(new Point(this.T1.X + 4, this.T1.Y), new Size(this.T1.Width - 40, this.T1.Height)), format);
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            switch (Align)
            {
            case Alignment.Vertical:
                G.DrawLine(ConversionFunctions.ToPen(C1), new Point(Width / 2, 0), new Point(Width / 2, Height));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(Width / 2 + 1, 0), new Point(Width / 2 + 1, Height));
                break;

            case Alignment.Horizontal:
                G.DrawLine(ConversionFunctions.ToPen(C1), new Point(0, Height / 2), new Point(Width, Height / 2));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(0, Height / 2 + 1), new Point(Width, Height / 2 + 1));
                break;
            }


            e.Graphics.DrawImage(B, 0, 0);
            G.Dispose();
            B.Dispose();
        }
Exemple #17
0
        protected override void PaintHook()
        {
            G.Clear(BackColor);
            Pen P1 = ConversionFunctions.ConvertToPen(Color.FromArgb(40, Color.White));
            Pen P2 = ConversionFunctions.ConvertToPen(Color.FromArgb(170, Color.Black));

            switch (vert)
            {
            case true:
                G.DrawLine(P1, Convert.ToInt32(this.Width / 2) - 1, 0, Convert.ToInt32(this.Width / 2) - 1, Height);
                G.DrawLine(P2, Convert.ToInt32(this.Width / 2), 0, Convert.ToInt32(this.Width / 2), Height);
                G.DrawLine(P1, Convert.ToInt32(this.Width / 2) + 1, 0, Convert.ToInt32(this.Width / 2) + 1, Height);
                break;

            case false:
                G.DrawLine(P1, 0, Convert.ToInt32(this.Height / 2) - 1, Width, Convert.ToInt32(this.Height / 2) - 1);
                G.DrawLine(P2, 0, Convert.ToInt32(this.Height / 2), Width, Convert.ToInt32(this.Height / 2));
                G.DrawLine(P1, 0, Convert.ToInt32(this.Height / 2) + 1, Width, Convert.ToInt32(this.Height / 2) + 1);
                break;

            default:
                break;
            }
        }
    protected override void OnPaint(PaintEventArgs e)
    {
        Bitmap   image    = new Bitmap(base.Width, base.Height);
        Graphics graphics = Graphics.FromImage(image);

        try
        {
            base.SelectedTab.BackColor = this.C1;
        }
        catch
        {
        }
        graphics.Clear(base.Parent.BackColor);
        for (int i = 0; i <= (base.TabCount - 1); i++)
        {
            if (i == base.SelectedIndex)
            {
                continue;
            }
            Rectangle           rect  = new Rectangle(base.GetTabRect(i).X, base.GetTabRect(i).Y + 3, base.GetTabRect(i).Width + 2, base.GetTabRect(i).Height);
            LinearGradientBrush brush = new LinearGradientBrush(new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height), Color.FromArgb(60, 0x3b, 0x3a), Color.FromArgb(0x45, 0x45, 70));
            graphics.FillRectangle(brush, rect);
            brush.Dispose();
            graphics.DrawRectangle(ConversionFunctions.ToPen(this.C3), rect);
            graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height));
            string s = string.Empty;
            switch (i)
            {
            case 0:
                s = "Main";
                break;

            case 1:
                s = "Extra";
                break;

            case 2:
                s = "Scan";
                break;

            case 3:
                s = "Info";
                break;
            }
            StringFormat format = new StringFormat {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Center
            };
            graphics.DrawString(s, this.Font, ConversionFunctions.ToBrush(130, 0xb0, 190), rect, format);
        }
        graphics.FillRectangle(ConversionFunctions.ToBrush(this.C1), 0, base.ItemSize.Height, base.Width, base.Height);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C2), 0, base.ItemSize.Height, base.Width - 1, (base.Height - base.ItemSize.Height) - 1);
        graphics.DrawRectangle(ConversionFunctions.ToPen(this.C3), 1, base.ItemSize.Height + 1, base.Width - 3, (base.Height - base.ItemSize.Height) - 3);
        if (base.SelectedIndex != -1)
        {
            string str2 = string.Empty;
            if (base.SelectedIndex == 0)
            {
                str2 = "Main";
            }
            else if (base.SelectedIndex == 1)
            {
                str2 = "Extra";
            }
            else if (base.SelectedIndex == 2)
            {
                str2 = "Scan";
            }
            else if (base.SelectedIndex == 3)
            {
                str2 = "Info";
            }
            Rectangle layoutRectangle = new Rectangle(base.GetTabRect(base.SelectedIndex).X - 2, base.GetTabRect(base.SelectedIndex).Y, base.GetTabRect(base.SelectedIndex).Width + 3, base.GetTabRect(base.SelectedIndex).Height);
            graphics.FillRectangle(ConversionFunctions.ToBrush(this.C1), new Rectangle(layoutRectangle.X + 2, layoutRectangle.Y + 2, layoutRectangle.Width - 2, layoutRectangle.Height));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(layoutRectangle.X, (layoutRectangle.Y + layoutRectangle.Height) - 2), new Point(layoutRectangle.X, layoutRectangle.Y));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(layoutRectangle.X, layoutRectangle.Y), new Point(layoutRectangle.X + layoutRectangle.Width, layoutRectangle.Y));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C2), new Point(layoutRectangle.X + layoutRectangle.Width, layoutRectangle.Y), new Point(layoutRectangle.X + layoutRectangle.Width, (layoutRectangle.Y + layoutRectangle.Height) - 2));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C3), new Point(layoutRectangle.X + 1, (layoutRectangle.Y + layoutRectangle.Height) - 1), new Point(layoutRectangle.X + 1, layoutRectangle.Y + 1));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C3), new Point(layoutRectangle.X + 1, layoutRectangle.Y + 1), new Point((layoutRectangle.X + layoutRectangle.Width) - 1, layoutRectangle.Y + 1));
            graphics.DrawLine(ConversionFunctions.ToPen(this.C3), new Point((layoutRectangle.X + layoutRectangle.Width) - 1, layoutRectangle.Y + 1), new Point((layoutRectangle.X + layoutRectangle.Width) - 1, (layoutRectangle.Y + layoutRectangle.Height) - 1));
            StringFormat format2 = new StringFormat {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Center
            };
            graphics.DrawString(str2, this.Font, ConversionFunctions.ToBrush(130, 0xb0, 190), layoutRectangle, format2);
        }
        e.Graphics.DrawImage(image, 0, 0);
        graphics.Dispose();
        image.Dispose();
    }
Exemple #19
0
 static public double DistanceBetweenLatLongPoints(double lat1, double lon1, double lat2, double lon2)
 {
     return(ConversionFunctions.DistanceBetweenLatLongPoints(INDEX_WGS_84, lat1, lon1, lat2, lon2));
 }
Exemple #20
0
        protected override void PaintHook()
        {
            G.Clear(Color.FromArgb(102, 102, 102));

            Rectangle R1 = new Rectangle(0, 0, Width, Height);                                          //
                                                                                                        //
            PointF ipt = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize);                   //
                                                                                                        //


            int   gC    = 15;
            Color _text = Color.White;
            Color C1    = default(Color);
            Color C2    = default(Color);
            Color C3    = default(Color);
            Color C4    = default(Color);

            switch (Alternate)
            {
            case true:
                C1 = Color.FromArgb(255, 209, 51);
                C2 = Color.FromArgb(255, 165, 13);
                C3 = Color.FromArgb(255, 195, 13);
                C4 = Color.FromArgb(255, 163, 0);
                break;

            case false:
                C1 = Color.FromArgb(105, 105, 105);
                C2 = Color.FromArgb(56, 56, 56);
                C3 = Color.FromArgb(73, 73, 73);
                C4 = Color.FromArgb(48, 48, 48);
                break;
            }

            DrawGradient(C1, C2, 0, 0, Width, Height, 90);
            DrawGradient(C3, C4, 1, 1, Width - 2, Height - 2, 90);

            switch (State)
            {
            case MouseState.None:
                break;

            //NULL
            case MouseState.Over:
                switch (Alternate)
                {
                case true:
                    _text = Color.Black;
                    break;
                }
                gC = 5;
                break;

            case MouseState.Down:
                switch (Alternate)
                {
                case true:
                    _text = Color.White;
                    break;
                }
                gC = 10;
                break;
            }

            for (int i = 1; i <= 5; i++)
            {
                G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(Convert.ToInt32(255 / (i * gC)), Color.White))), new Rectangle(i, i, Width - 2 - (i * 2), Height - 2 - (i * 2)));
            }

            DrawBorders(Pens.Black);
            DrawText(ConversionFunctions.ConvertToBrush(Color.FromArgb(180, Color.Black)), HorizontalAlignment.Center, 0, 2);
            DrawText(ConversionFunctions.ConvertToBrush(_text), HorizontalAlignment.Center, -1, 1);

            if ((Image == null))                                                                    //
            {                                                                                       //
                //G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat           //
                //{                                                                               //
                //    Alignment = _TextAlignment,                                                 //
                //    LineAlignment = StringAlignment.Center                                      //
                //});                                                                             //
            }                                                                                      //
            else                                                                                   //
            {                                                                                      //
                G.DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height);              //
                //G.DrawString(Text, Font, new SolidBrush(ForeColor), R1, new StringFormat          //
                //{                                                                               //
                //    Alignment = _TextAlignment,                                                 //
                //    LineAlignment = StringAlignment.Center                                      //
                //});                                                                             //
            }
        }