ToString() public method

Converts the and of this to a human-readable string.
public ToString ( ) : string
return string
Esempio n. 1
0
		/// <summary>
		/// Methods directly produces DXF string for text of the Flowchart object
		/// </summary>
		/// <param name="TextID">Id of the text tag</param>
		/// <param name="rect">Text's rectangle</param>
		/// <param name="sText">Text string</param>
		/// <param name="crText">Text color</param>
		/// <param name="fnText">Text font</param>
		/// <param name="sft">Text format</param>
		/// <param name="Multiline">true if text is multi-lined</param>
		/// <param name="RA">Rotation angle of the text</param>
		/// <param name="IsArrowText">true if text is on arrow ( not used )</param>
		/// <returns>true if succesfull otherwise false</returns>
		public bool AddText(long TextID, RectangleF rect, string sText, Color crText, Font fnText, StringFormat sft, bool Multiline, float RA, bool IsArrowText)
		{
			string sResult = "";
		
			if ( sText == "" )
				return false;

			if ( sText == null )
				return false;


			if ( fnText == null )
				fnText = m_FlowChart.Font;

			try
			{
				if (IsArrowText)
					sft.FormatFlags = StringFormatFlags.FitBlackBox;

				if ( Multiline ) // If the is 'Multylined' producing MTEXT DXF output
				{
					sText = sText.Replace("\n"," ");
					sText = sText.Replace("\r"," ");

					/* USE IF YOU WANT TO SEE TEXT AREA AS RED FRAME
					AddRect(rect, TextID, Color.Red, Color.Transparent, Color.Transparent,DashStyle.Solid,
						"", null, null);
						*/
					sResult = String.Format(provider, "0\nMTEXT\n  100\nAcDbEntity\n{0:HAN} 8\n{15}\n  62\n{0:ACI}\n  100\nAcDbMText\n  10\n{1:U}\n  20\n{2:U}\n  40\n{10:U}\n  41\n{3:U}\n  71\n{4:SAL}\n  72\n{5}\n  1\n{6}{7:ATEXT}{8}{9}\n  7\n{14}\n  42\n{11:U}\n  43\n{12:U}\n  50\n{13}\n",
						crText, rect.Left + ((sft.Alignment==StringAlignment.Center) ? rect.Width/2 : 0f) , m_FlowChart.DocExtents.Height - ( rect.Top + rect.Height/2) , rect.Width , sft, "1" , "" ,  fnText , sText, "" , fnText.Size*0.6, rect.Width/2 , rect.Height/2, (-1)*RA , "Standard", TEXT_LAYER);
				}
				else // If the is not 'Multylined' producing TEXT DXF output
					sResult = String.Format(provider, "0\nTEXT\n  100\nAcDbEntity\n{0:HAN} 8\n{15}\n  62\n{0:ACI}\n  100\nAcDbText\n  10\n{1:U}\n  20\n{2:U}\n  40\n{10:U}\n  71\n{4}\n  1\n{6}{7:ATEXT}{8}{9}\n  41\n0.6\n 7\n{14}\n  50\n{13}\n  72\n{5}\n  11\n{1:U}\n  21\n{2:U}\n  100\nAcDbText\n  73\n{18}\n",
						crText, 
						(RA!=0) ? (rect.Left + rect.Width/4) : (rect.Left),
						m_FlowChart.DocExtents.Height - rect.Top, 
						rect.Width, 
						"0", 
						(RA!=0) ? "1" : "0",
						"" ,  
						fnText , 
						sText, 
						"" , fnText.Size, rect.Width, rect.Height, RA , "Standard", TEXT_LAYER, rect.Left + rect.Width,
						m_FlowChart.DocExtents.Height - ( rect.Top + rect.Height),
						(RA!=0) ? "1" : "2");
				
				Trace.WriteLine(String.Format("{0}:{1}", sText, rect.ToString()));
				AddEntity(String.Format("TEXT{0:X5}", TextID),sResult);
			}
			catch ( Exception ex)
			{

				Trace.WriteLine(String.Format("{0} error {1}\n","AddText",ex.Message));
				return false;

			}

			return true;
			
		}
Esempio n. 2
0
        public Bitmap Clone(RectangleF rect, PixelFormat format) {

            //validate the rect
            if (rect.Width == 0 || rect.Height == 0) {
                throw new ArgumentException(SR.GetString(SR.GdiplusInvalidRectangle, rect.ToString()));
            }
            
            IntPtr dstHandle = IntPtr.Zero;

            int status = SafeNativeMethods.Gdip.GdipCloneBitmapArea(
                                                    rect.X,
                                                    rect.Y,
                                                    rect.Width,
                                                    rect.Height,
                                                    unchecked((int) format),
                                                    new HandleRef(this, nativeImage),
                                                    out dstHandle);

            if (status != SafeNativeMethods.Gdip.Ok || dstHandle == IntPtr.Zero)
                throw SafeNativeMethods.Gdip.StatusException(status);

            return Bitmap.FromGDIplus(dstHandle);
        }
        public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
                                   LinearGradientMode linearGradientMode)
        {   
            //validate the LinearGradientMode enum
            //valid values are 0x0 to 0x3
            if (!ClientUtils.IsEnumValid(linearGradientMode, unchecked((int)linearGradientMode), (int)LinearGradientMode.Horizontal, (int)LinearGradientMode.BackwardDiagonal)){
                throw new InvalidEnumArgumentException("linearGradientMode", unchecked((int)linearGradientMode), typeof(LinearGradientMode));
            }

            //validate the rect
            if (rect.Width == 0.0 || rect.Height == 0.0) {
                throw new ArgumentException(SR.GetString(SR.GdiplusInvalidRectangle, rect.ToString()));
            }

            IntPtr brush = IntPtr.Zero;

            GPRECTF gprectf = new GPRECTF(rect);
            int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRect(ref gprectf,
                                                             color1.ToArgb(),
                                                             color2.ToArgb(),
                                                             unchecked((int) linearGradientMode),
                                                             (int)WrapMode.Tile,
                                                             out brush);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeBrushInternal(brush);
        }
        public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
                                 float angle, bool isAngleScaleable)
        {
            IntPtr brush = IntPtr.Zero;

            //validate the rect
            if (rect.Width == 0.0 || rect.Height == 0.0) {
                throw new ArgumentException(SR.GetString(SR.GdiplusInvalidRectangle, rect.ToString()));
            }

            GPRECTF gprectf = new GPRECTF(rect);
            int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRectWithAngle(ref gprectf,
                                                                      color1.ToArgb(),
                                                                      color2.ToArgb(),
                                                                      angle,
                                                                      isAngleScaleable,
                                                                      (int)WrapMode.Tile,
                                                                      out brush);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeBrushInternal(brush);
        }
Esempio n. 5
0
        void DrawMandelBrot()
        {
            Console.WriteLine("■ 描画開始");
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();

            // Set the clear color to blue
            GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            GL.Clear(ClearBufferMask.ColorBufferBit);

            // まんでるぶろ集合の計算
            GL.Begin(PrimitiveType.Points);
            {
                var rect = GlobalArea;

                int Iter = this.IterationNum;

                int gridx = this.Width;
                int gridy = this.Height;

                double dx = (double)rect.Width / gridx;
                double dy = (double)rect.Height / gridy;

                double lx = dx * gridx;
                double ly = dy * gridy;

                double Zr = 0;
                double Zi = 0;

                for (int ix = 0; ix < gridx; ix++)
                {
                    double Cr = (dx * ix) + rect.Left;

                    for (int iy = 0; iy < gridy; iy++)
                    {
                        double Ci = (dy * iy) + rect.Top;

                        // 収束計算
                        Zr = 0;
                        Zi = 0;
                        double AbsZ = 0;
                        int    i    = 0;
                        for (i = 0; i < Iter; i++)
                        {
                            double new_Zr = (Zr * Zr - Zi * Zi) + Cr;
                            double new_Zi = (2 * Zr * Zi + Ci);
                            Zr = new_Zr;
                            Zi = new_Zi;

                            AbsZ = (new_Zr * new_Zr + new_Zi * new_Zi);

                            if (AbsZ > 4)
                            {
                                AbsZ = 4.0;
                                break;
                            }
                        }

                        double iter = (double)i / Iter;

                        GL.Color3(1 - (AbsZ / 4.0), 1.0, iter);
                        GL.Vertex2(Cr, Ci);
                    }
                }
            }
            GL.End();

            GL.Begin(PrimitiveType.Lines);
            {
                GL.Color3(0.5, 0.5, 0.5);

                var g = this.GlobalArea;
                GL.Vertex2(g.Left, gZoomCenter.Y);
                GL.Vertex2(g.Right, gZoomCenter.Y);

                GL.Vertex2(gZoomCenter.X, g.Top);
                GL.Vertex2(gZoomCenter.X, g.Bottom);
            }
            GL.End();



            // 結果表示
            sw.Stop();
            TimeSpan ts = sw.Elapsed;

            Console.WriteLine($"■ 処理Aにかかった時間: {ts}");

            Console.WriteLine($"{GlobalArea.ToString()}");
        }
 public Bitmap Clone(RectangleF rect, PixelFormat format)
 {
     if ((rect.Width == 0f) || (rect.Height == 0f))
     {
         throw new ArgumentException(System.Drawing.SR.GetString("GdiplusInvalidRectangle", new object[] { rect.ToString() }));
     }
     IntPtr zero = IntPtr.Zero;
     int status = SafeNativeMethods.Gdip.GdipCloneBitmapArea(rect.X, rect.Y, rect.Width, rect.Height, (int) format, new HandleRef(this, base.nativeImage), out zero);
     if ((status != 0) || (zero == IntPtr.Zero))
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     return FromGDIplus(zero);
 }