Beispiel #1
0
	public MainForm ()
	{
		components = new Container ();
		//SuspendLayout ();
		// 
		// _timer
		// 
		_timer = new Timer (components);
		_timer.Tick += new EventHandler (Timer_Tick);
		// 
		// _label
		// 
		_label = new Label ();
		_label.Dock = DockStyle.Fill;
		_label.TextAlign = ContentAlignment.MiddleCenter;
		Controls.Add (_label);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 65);
		Font = new Font ("Microsoft Sans Serif", 12F, FontStyle.Bold);
		Location = new Point (250, 100);
		Opacity = 0.5;
		StartPosition = FormStartPosition.Manual;
		Text = "Opacity = " + Opacity.ToString (CultureInfo.InvariantCulture);
		TopMost = true;
		Activated += new EventHandler (MainForm_Activated);
		Deactivate += new EventHandler (MainForm_Deactivate);
		Load += new EventHandler (MainForm_Load);
		Resize += new EventHandler (MainForm_Resize);
		ResumeLayout (false);
	}
Beispiel #2
0
		public static void ApplyFont(this TextElement self, Font font)
		{
			self.FontSize = font.UseNamedSize ? font.NamedSize.GetFontSize() : font.FontSize;
			self.FontFamily = !string.IsNullOrEmpty(font.FontFamily) ? new FontFamily(font.FontFamily) : (FontFamily)WApplication.Current.Resources["ContentControlThemeFontFamily"];
			self.FontStyle = font.FontAttributes.HasFlag(FontAttributes.Italic) ? FontStyle.Italic : FontStyle.Normal;
			self.FontWeight = font.FontAttributes.HasFlag(FontAttributes.Bold) ? FontWeights.Bold : FontWeights.Normal;
		}
 public PlotManager(IPlottable plot)
 {
     // Initialize
     this.plot = plot;
     plotData = new List<PlotData>();
     plotFont = new Font(Font.Default, plot.PlotColor, HorizontalAlignment.Left, VerticalAlignment.Top);
 }
Beispiel #4
0
 public static GameObject exitButton(Material m,Font ft , int Size)
 {
     GameObject b = MakeBase(m,ft,"Exit",Size);
     b.AddComponent<ExitGame>();
     b.name = "Exit";
     return b;
 }
Beispiel #5
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the string from a text, font and size
 /// </summary>
 /// <param name="text">Text to display</param>
 /// <param name="font">Font to use</param>
 /// <param name="size">Base characters size</param>
 ////////////////////////////////////////////////////////////
 public String2D(string text, Font font, uint size)
     : base(sfString_Create())
 {
     Text = text;
     Font = font;
     Size = size;
 }
    public TTFTextOutline GetGlyph(Font f, char c)
    {
        AndroidJNI.PushLocalFrame(0);
        AndroidJavaObject path=AndroidISysFont.Call<AndroidJavaObject>("GetGlyph",
                    f.typeface,
                    ""+c
                );
        AndroidJavaObject pm=
            AndroidISysFont.Call<AndroidJavaObject>("GetPathMeasure",
                path
            );

        TTFTextOutline tto=new TTFTextOutline();
        bool cont=true ;
        while (cont) {
            List<Vector3> tb=new List<Vector3>();

            float [] res=AndroidISysFont.Call<float []>("GetBoundary",pm,0);
            int rl2=res.Length/2;
            for (int ci=0;ci<rl2;ci++) {
                tb.Add(new Vector3(res[ci*2],res[ci*2+1],0));
            }
            tto.AddBoundary(tb);
            cont=AndroidISysFont.Call<bool>("NextBoundary",pm);
        }

        path.Dispose();
        pm.Dispose();
        AndroidJNI.PopLocalFrame(System.IntPtr.Zero);
        return tto;
    }
Beispiel #7
0
    /// <summary>
    /// ����ͼƬ
    /// </summary>
    /// <param name="checkCode">�����</param>
    private void CreateImage(string checkCode)
    {
        int iwidth = (int)(checkCode.Length * 11.5);//����������趨ͼƬ���
        Bitmap image = new Bitmap(iwidth, 20);//����һ������
        Graphics g = Graphics.FromImage(image);//�ڻ����϶����ͼ��ʵ��
        Font f = new Font("Arial",10,FontStyle.Bold);//���壬��С����ʽ
        Brush b = new SolidBrush(Color.Black);//������ɫ
        //g.FillRectangle(new System.Drawing.SolidBrush(Color.Blue),0,0,image.Width, image.Height);
        g.Clear(Color.White);//������ɫ
        g.DrawString(checkCode, f, b, 3, 3);

        Pen blackPen = new Pen(Color.Black, 0);
        Random rand = new Random();
        /*�����
        for (int i = 0; i < 5; i++)
        {
            int y = rand.Next(image.Height);
            g.DrawLine(blackPen, 0, y, image.Width, y);
        }
        */
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
        Response.ClearContent();
        Response.ContentType = "image/Jpeg";
        Response.BinaryWrite(ms.ToArray());
        g.Dispose();
        image.Dispose();
    }
	static void Load ()
	{
		mLoaded			= true;
		mPartial		= EditorPrefs.GetString("NGUI Partial");
		mFontName		= EditorPrefs.GetString("NGUI Font Name");
		mAtlasName		= EditorPrefs.GetString("NGUI Atlas Name");
		mFontData		= GetObject("NGUI Font Asset") as TextAsset;
		mFontTexture	= GetObject("NGUI Font Texture") as Texture2D;
		mFont			= GetObject("NGUI Font") as UIFont;
		mAtlas			= GetObject("NGUI Atlas") as UIAtlas;
		mAtlasPadding	= EditorPrefs.GetInt("NGUI Atlas Padding", 1);
		mAtlasTrimming	= EditorPrefs.GetBool("NGUI Atlas Trimming", true);
		mAtlasPMA		= EditorPrefs.GetBool("NGUI Atlas PMA", true);
		mUnityPacking	= EditorPrefs.GetBool("NGUI Unity Packing", true);
		mForceSquare	= EditorPrefs.GetBool("NGUI Force Square Atlas", true);
		mPivot			= (UIWidget.Pivot)EditorPrefs.GetInt("NGUI Pivot", (int)mPivot);
		mLayer			= EditorPrefs.GetInt("NGUI Layer", -1);
		mDynFont		= GetObject("NGUI DynFont") as Font;
		mDynFontSize	= EditorPrefs.GetInt("NGUI DynFontSize", 16);
		mDynFontStyle	= (FontStyle)EditorPrefs.GetInt("NGUI DynFontStyle", (int)FontStyle.Normal);

		if (mLayer < 0 || string.IsNullOrEmpty(LayerMask.LayerToName(mLayer))) mLayer = -1;

		if (mLayer == -1) mLayer = LayerMask.NameToLayer("UI");
		if (mLayer == -1) mLayer = LayerMask.NameToLayer("GUI");
		if (mLayer == -1) mLayer = 5;

		EditorPrefs.SetInt("UI Layer", mLayer);

		LoadColor();
	}
Beispiel #9
0
 public static double MeasureText(string text, Font font)
 {
     return MeasureText(text, new FontFamily(font.getFamily()),
         font.isItalic() ? FontStyles.Italic : FontStyles.Normal,
         font.isBold() ? FontWeights.Bold : FontWeights.Normal,
         FontStretches.Normal, font.getSize()).Width;
 }
Beispiel #10
0
	static private void PrintPageEvent (object sender, PrintPageEventArgs e)
	{
		float left = e.MarginBounds.Left;
		float top = e.MarginBounds.Top;

		Font font = new Font ("Arial", 10);
		e.Graphics.DrawString("This a sample with font " + font.Name + " size:" + font.Size,
			font, new SolidBrush (Color.Red), left, top);

		font = new Font ("Verdana", 16);
		e.Graphics.DrawString ("This a sample with font " + font.Name + " size:" + font.Size,
			font, new SolidBrush (Color.Blue), left, top + 50);

		font = new Font ("Verdana", 22);
		e.Graphics.DrawString ("This a sample with font " + font.Name + " size:" + font.Size,
			font, new SolidBrush (Color.Black), left, top + 150);

		font  = new Font (FontFamily.GenericMonospace, 14);
		e.Graphics.DrawString ("This a sample with font " + font.Name + " size:" + font.Size,
			font, new SolidBrush (Color.Black), left, top + 250);

		font  = new Font ("Arial", 48);
		e.Graphics.DrawString ("Font " + font.Name + " size:" + font.Size,
			font, new SolidBrush (Color.Red), left, top + 300);

		font  = new Font ("Times New Roman", 32);
		e.Graphics.DrawString ("Another sample font " + font.Name + " size:" + font.Size,
			font, new SolidBrush (Color.Black), left, top + 500);

		font  = new Font (FontFamily.GenericSansSerif, 8);
		e.Graphics.DrawString ("Another sample font " + font.Name + " size:" + font.Size,
			font, new SolidBrush (Color.Blue), left, top + 900);

		e.HasMorePages = false;
	}
Beispiel #11
0
                public static GameObject loadLevelButton(Material m, Font ft, int Size, string text, string url)
                {
                    GameObject b = MakeBase(m, ft, text, Size);
                    b.AddComponent<LoadLevel>().init(url);

                    return b;
                }
Beispiel #12
0
        public bool Initialize(Device device, DeviceContext deviceContext, IntPtr windowHandle, int screanWidth, int screenHeight, Matrix baseViewMatrix)
        {
            // Store the screen width and height.
            ScreenWidth = screanWidth;
            ScreenHeight = screenHeight;

            // Store the base view matrix.
            BaseViewMatrix = baseViewMatrix;

            // Create the font object.
            Font = new Font();

            // Initialize the font object.
            if (!Font.Initialize(device, "fontdata.txt", "font.dds"))
                return false;

            // Create the font shader object.
            FontShader = new FontShader();

            // Initialize the font shader object.
            if (!FontShader.Initialize(device, windowHandle))
                return false;

            // Initialize the first sentence.
            if (!InitializeSentence(out sentences[0], 32, device))
                return false;

            // Now update the sentence vertex buffer with the new string information.
            if (!UpdateSentece(ref sentences[0], "Render Count:", 20, 20, 1, 1, 1, deviceContext))
                return false;

            return true;
        }
Beispiel #13
0
    public Bitmap GenerateBarcodeImage(string text, FontFamily fontFamily, int fontSizeInPoints)
    {
        StringBuilder sb = new StringBuilder();
        sb.Append("*");
        sb.Append(text);
        sb.Append("*");

        Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppArgb);

        Font font = new Font(fontFamily, fontSizeInPoints, FontStyle.Regular, GraphicsUnit.Point);

        Graphics graphics = Graphics.FromImage(bmp);

        SizeF textSize = graphics.MeasureString(sb.ToString(), font);

        bmp = new Bitmap(bmp, textSize.ToSize());

        graphics = Graphics.FromImage(bmp);
        graphics.Clear(Color.White);
        graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
        graphics.DrawString(sb.ToString(), font, new SolidBrush(Color.Black), 0, 0);
        graphics.Flush();

        font.Dispose();
        graphics.Dispose();

        return bmp;
    }
 public ClassiCubeServersScreen( LauncherWindow game )
     : base(game, true)
 {
     tableFont = new Font( game.FontName, 11, FontStyle.Regular );
     enterIndex = 3;
     widgets = new LauncherWidget[7];
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        int x, y;
        string strValidation = null;
        rnd = new Random();
        Response.ContentType = "image/jpeg";
        Response.Clear();
        Response.BufferOutput = true;
        strValidation = GenerateString();
        Session["strValidation"] = strValidation;
        Font font = new Font("Arial", (float)rnd.Next(17, 20));

        Bitmap bitmap = new Bitmap(200, 50);
        Graphics gr = Graphics.FromImage(bitmap);
        gr.FillRectangle(Brushes.LightGreen, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
        gr.DrawString(strValidation, font, Brushes.Black, (float)rnd.Next(70), (float)rnd.Next(20));
           // gr.DrawLine(new Pen(Color.White), new Point(0, rnd.Next(50)), new Point(200, rnd.Next(50)));
           // gr.DrawLine(new Pen(Color.White), new Point(0, rnd.Next(50)), new Point(200, rnd.Next(50)));
           // gr.DrawLine(new Pen(Color.White), new Point(0, rnd.Next(50)), new Point(200, rnd.Next(50)));
        for (x = 0; x < bitmap.Width; x++)
            for (y = 0; y < bitmap.Height; y++)
                if (rnd.Next(4) == 1)
                    bitmap.SetPixel(x, y, Color.LightGreen);
        font.Dispose();
        gr.Dispose();
        bitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
        bitmap.Dispose();
    }
Beispiel #16
0
        public static void Init(ZApplication app)
        {
            defaultMaterial = new Material(null);
            GUIMaterial = new Material(null);
            GUIMaterial.Lighting = false;            
            defaultTexture = new Texture(null);
            defaultFont = new Font(null);

            GL.MatrixMode(All.MODELVIEW);
          
            GL.Enable(All.DEPTH_TEST);           

            //Enable Light
            //Use default position
            GL.Enable(All.LIGHTING);
            GL.Enable(All.LIGHT0);

            //Use glColor to color materials. 
            //This eliminates the need to set ambient and diffuse separately.
            GL.Enable(All.COLOR_MATERIAL);
            GL.ColorMaterial(All.FRONT_AND_BACK, All.AMBIENT_AND_DIFFUSE);

            //glMaterialfv(GL_FRONT, GL_SPECULAR, Specular);
            //glMaterialf(GL_FRONT, GL_SHININESS, LowShininess);         

            // IMPORTANT: Otherwise light will arise with scaled vectors, e.g. with Scale=0.1 then it will be too bright
            // This is because gl scales the normals with glScale
            //GL.Enable(All.NORMALIZE);

            var shape = new UnitQuad();
            unitQuad = new Mesh(null) { Name = "UnitQuad" };            
            unitQuad.CreateVBO(shape);

            defaultMaterial.Apply(null);            
        }
                public static GameObject resetHighScoreButton(Material m, Font ft, int Size, TextAnchor txmach = TextAnchor.UpperLeft)
                {
                    GameObject b = MakeBase(m, ft, "Reset HighScore", Size, txmach);
                    b.AddComponent<ResetHighScore>();

                    return b;
                }
Beispiel #18
0
	//Method containing the basereferences for the enemies
	public void baseReferences() {
		isCreated = false;
		ArialFont = (Font)Resources.Load("SDS_8x8");
		player = GameObject.Find("Player").transform; //Reference and find the playerobject
		attackTime = Time.time; //Attacktime is set to actual time
		CharacterHealth ch = GameObject.Find ("Player").GetComponent<CharacterHealth> (); //Reference to the players health
		chaseRange = 30.0f; //Sets the chaserange
		speed = Random.Range(10,20); //Randomizes the enemy's speed of a value between 10-20
		Follower = transform; //References the Enemy
		PrevSpeed = speed; //Stores the speed if we need to resume that speed later.
		rigidbody2D.fixedAngle = true;
		_posX = transform.position.x;
		

		PlayerSpottedSounds =  new AudioClip[]{(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterSpotPlayer/1"),
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterSpotPlayer/2"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterSpotPlayer/3"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterSpotPlayer/4")};


		
		MonsterHitSounds =  new AudioClip[]{(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m1"),
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m2"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m3"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m4"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m5"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m6"),
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m7"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m8"), 
			(AudioClip)Resources.Load("Sounds/MonsterSounds/MonsterHits/m9")};

		}
 public LoadingMapScreen( Game game, string name, string motd )
     : base(game)
 {
     serverName = name;
     serverMotd = motd;
     font = new Font( "Arial", 14 );
 }
 public LauncherBooleanWidget( LauncherWindow window, Font font, int width, int height )
     : base(window)
 {
     BoxWidth = width; BoxHeight = height;
     Width = width; Height = height;
     this.font = font;
 }
Beispiel #21
0
    public  Bitmap generateTicket(string ticketType, string start, string destination, string price)
    {
        
       //Orte der verschiedenen Textboxen auf dem Ticket:
        Point StartLine1 = new Point(0,100);
        Point EndLine1 = new Point(960, 100);
        Point StartLine2 = new Point(0, 700);
        Point EndLine2 = new Point(960, 700);
        PointF logoLocation = new PointF(150,20);
        PointF fromLocation = new PointF(40,300);
        PointF toLocation = new PointF(40,500);
        PointF totalLocation = new PointF(40,750);
        PointF ticketTypeLocation = new PointF(40, 150);
        PointF startLocation = new PointF(40, 400);
        PointF destinationLocation = new PointF(40, 600);
        PointF priceLocation = new PointF(500, 750);

        //string imageFilePath = "C:\\Users\\kuehnle\\Documents\\TestWebsite\\NewTestTicket.bmp";

        
        Bitmap tempBmp = new Bitmap(960,900);

        //auf das neu erstellte Bitmap draufzeichnen:
        using (Graphics g = Graphics.FromImage(tempBmp))
        {

            g.Clear(Color.White);
            g.DrawLine(new Pen(Brushes.Black,10), StartLine1, EndLine1);
            g.DrawLine(new Pen(Brushes.Black,10), StartLine2, EndLine2);
            
            using (Font arialFont = new Font("Arial", 40,FontStyle.Bold))
            {

                g.DrawString("Jakarta Commuter Train", arialFont, Brushes.Black, logoLocation);
               
                g.DrawString(ticketType, arialFont, Brushes.Black, ticketTypeLocation);
                

            }
            using (Font arialFont = new Font("Arial", 40, FontStyle.Underline))
            {
                g.DrawString("From:", arialFont, Brushes.Black, fromLocation);
                g.DrawString("To:", arialFont, Brushes.Black, toLocation);
            }
            using (Font arialFont = new Font("Arial", 40, FontStyle.Regular))
            {
                g.DrawString("Total:", arialFont, Brushes.Black, totalLocation);
                g.DrawString(start, arialFont, Brushes.Black, startLocation);
                g.DrawString(destination, arialFont, Brushes.Black, destinationLocation);
                g.DrawString(price, arialFont, Brushes.Black, priceLocation);
            }
        }
        //Farbtiefe auf 1 reduzieren:
        Bitmap ticket = tempBmp.Clone(new Rectangle(0, 0, tempBmp.Width, tempBmp.Height),PixelFormat.Format1bppIndexed);
        
        //ticket.Save(imageFilePath,System.Drawing.Imaging.ImageFormat.Bmp);
        //ticket.Dispose();
        return ticket;

    }
        private static IT.Font GetFormattedFont(Font font)
        {
            IT.Font iTextFont = new IT.Font();

            //Return default font if font style is not available.
            if (font == null)
            {
                return new IT.Font();
            }

            foreach (var format in font.Formats)
            {
                switch (format)
                {
                    case FontFormats.Bold:
                        iTextFont.SetStyle(IT.Font.BOLD);
                        break;
                    case FontFormats.Italic:
                        iTextFont.SetStyle(IT.Font.ITALIC);
                        break;
                    case FontFormats.Underlined:
                        iTextFont.SetStyle(IT.Font.UNDERLINE);
                        break;
                    default:
                        break;
                }
            }
            return iTextFont;
        }
Beispiel #23
0
    internal Action syncBitmap; //this.SyncBitmap() call

    public Bitmap(string filename)
    {
        syncBitmap = this.SyncBitmap;

        font = Font.default_font;
        LoadTexture(filename);
    }
 //生成图像
 private void getImageValidate(string strValue)
 {
     //string str = "OO00"; //前两个为字母O,后两个为数字0
     int width = Convert.ToInt32(strValue.Length * 12);    //计算图像宽度
     Bitmap img = new Bitmap(width, 23);
     Graphics gfc = Graphics.FromImage(img);           //产生Graphics对象,进行画图
     gfc.Clear(Color.White);
     drawLine(gfc, img);
     //写验证码,需要定义Font
     Font font = new Font("arial", 12, FontStyle.Bold);
     System.Drawing.Drawing2D.LinearGradientBrush brush =
         new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, img.Width, img.Height), Color.DarkOrchid, Color.Blue, 1.5f, true);
     gfc.DrawString(strValue, font, brush, 3, 2);
     drawPoint(img);
     gfc.DrawRectangle(new Pen(Color.DarkBlue), 0, 0, img.Width - 1, img.Height - 1);
     //将图像添加到页面
     MemoryStream ms = new MemoryStream();
     img.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
     //更改Http头
     Response.ClearContent();
     Response.ContentType = "image/gif";
     Response.BinaryWrite(ms.ToArray());
     //Dispose
     gfc.Dispose();
     img.Dispose();
     Response.End();
 }
        public void DrawString(int x, int y, string s, int color, Font font)
        {
            var currentX = x;
            foreach (var c in s)
            {
                var character = font.GetFontData(c);

                if (c == '\n') //line feed
                {
                    y += character.Height;
                }
                else if (c == '\r') //carriage return
                {
                    currentX = x;
                }
                else
                {
                    if (currentX + character.Width > Width)
                    {
                        currentX = x; //start over at the left and go to a new line.
                        y += character.Height;
                    }

                    DrawChar(currentX, y, color, character);
                    currentX += character.Width + character.Space;
                }
            }
        }
        protected Bitmap GetFileBasedFSBitmap(string ext, IconSize size)
        {
            string lookup = tempPath;
            Bitmap folderBitmap = KeyToBitmap(lookup, size);
            if (ext != "")
            {
                ext = ext.Substring(0, 1).ToUpper() + ext.Substring(1).ToLower();

                using (Graphics g = Graphics.FromImage(folderBitmap))
                {
                    g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

                    Font font = new Font("Comic Sans MS", folderBitmap.Width / 5, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic);
                    float height = g.MeasureString(ext, font).Height;
                    float rightOffset = folderBitmap.Width / 5;

                    if (size == IconSize.small)
                    {
                        font = new Font("Arial", 5, System.Drawing.FontStyle.Bold);
                        height = g.MeasureString(ext, font).Height;
                        rightOffset = 0;
                    }


                    g.DrawString(ext, font,
                                System.Drawing.Brushes.Black,
                                new RectangleF(0, folderBitmap.Height - height, folderBitmap.Width - rightOffset, height),
                                new StringFormat(StringFormatFlags.DirectionRightToLeft));

                }
            }

            return folderBitmap;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();
        int num = 4;

        Bitmap generatedImage = new Bitmap(200, 200);
		using (generatedImage)
		{
			Graphics gr = Graphics.FromImage(generatedImage);
			using (gr)
			{
                var fonttt = new Font("Arial", 14, FontStyle.Bold);
				gr.FillRectangle(Brushes.MediumSeaGreen, 0, 0, 200, 200);
				gr.FillPie(Brushes.Yellow, 25, 25, 150, 150, 0, 45);
				gr.FillPie(Brushes.Green, 25, 25, 150, 150, 45, 315);
                gr.DrawString(num.ToString(), fonttt, SystemBrushes.WindowText, new PointF(10, 40));

				// Set response header and write the image into response stream
				Response.ContentType = "image/gif";

				//Response.AppendHeader("Content-Disposition",
				//    "attachment; filename=\"Financial-Report-April-2013.gif\"");

				generatedImage.Save(Response.OutputStream, ImageFormat.Gif);
			}
		}
    }
Beispiel #28
0
    public Bitmap(int w, int h)
    {
        syncBitmap = this.SyncBitmap;

        font = Font.default_font;
        CreateTexture(w, h);
    }
Beispiel #29
0
    public void CreateWord(string targetWord, int fontSize, Font typeFont)
    {
        typeTarget = new GameObject ("textWords");
        typeTarget.AddComponent<TextMesh>();
        MeshRenderer meshRender = typeTarget.GetComponent<MeshRenderer>();
        meshRender.material = Resources.Load<Material>("Fonts/unispace");
        TextMesh mesh = typeTarget.GetComponent<TextMesh>();
        mesh.text = targetWord;
        mesh.font = typeFont;
        mesh.fontSize = fontSize;
        mesh.color = Color.green;
        typeTarget.transform.parent = this.transform;
        mesh.anchor = TextAnchor.MiddleCenter;
        if (meshRender.bounds.size.y > wordHeight)
            this.transform.localScale *= wordHeight/meshRender.bounds.size.y;
        meshRender.material.color = new Color (meshRender.material.color.r, meshRender.material.color.g, meshRender.material.color.b, 0.0f);
        //Add sound source on typeTarget

        //Make background fit word
        typeBackground = new GameObject ("background");
        typeBackground.AddComponent<SpriteRenderer> ();
        SpriteRenderer spriteRender = typeBackground.GetComponent<SpriteRenderer> ();
        spriteRender.sprite = (Sprite)Resources.Load<Sprite> ("Sprites/TypeBackground");
        spriteRender.color = new Color (spriteRender.color.r, spriteRender.color.g, spriteRender.color.b, 0.0f);
        typeBackground.transform.parent = this.transform;
        typeBackground.transform.localPosition = Vector3.forward;

        typeBackground.transform.localScale = new Vector3 ((meshRender.bounds.size.x + (padding * 2.0f)) /
        typeBackground.GetComponent<SpriteRenderer> ().bounds.size.x * typeBackground.transform.localScale.x,
        typeBackground.transform.localScale.y * verticalSizeReduction, typeBackground.transform.localScale.z);

        originalWordScale = typeBackground.transform.localScale;
    }
Beispiel #30
0
        public override void Init()
        {
            titleFont = new Font( "Arial", 16, FontStyle.Bold );
            buttons = new ButtonWidget[] {
                // Column 1
                Make( -140, -100, "Options", Anchor.Centre,
                     (g, w) => g.SetNewScreen( new OptionsScreen( g ) ) ),
                Make( -140, -50, "Environment settings", Anchor.Centre,
                     (g, w) => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),

                Make( -140, 0, "Hotkeys", Anchor.Centre,
                     (g, w) => g.SetNewScreen( new HotkeyScreen( g ) ) ),
                Make( -140, 50, "Key bindings", Anchor.Centre,
                     (g, w) => g.SetNewScreen( new KeyBindingsScreen( g ) ) ),
                // Column 2
                Make( 140, -100, "Save level", Anchor.Centre,
                     (g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
                !game.Network.IsSinglePlayer ? null :
                    Make( 140, -50, "Load level", Anchor.Centre,
                         (g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
                // TODO: singleplayer Generate level screen
                Make( 140, 50, "Select texture pack", Anchor.Centre,
                     (g, w) => g.SetNewScreen( new TexturePackScreen( g ) ) ),
                // Other
                Make( 0, 55, "Back to game", Anchor.BottomOrRight,
                     (g, w) => g.SetNewScreen( new NormalScreen( g ) ) ),
                Make( 0, 5, "Quit game", Anchor.BottomOrRight, (g, w) => g.Exit() ),
            };
        }
        private void DrawAttackGraph(Graphics g, List <DateTime> datelist)
        {
            Brush[] brush =
            {
                Brushes.CornflowerBlue,
                Brushes.Aquamarine,
                Brushes.ForestGreen,
                Brushes.Gold,
                Brushes.OrangeRed,
                Brushes.Red,
            };
            Color[] colors =
            {
                Color.CornflowerBlue,
                Color.Aquamarine,
                Color.ForestGreen,
                Color.Gold,
                Color.OrangeRed,
                Color.Red,
            };

            var  ox        = 32;
            var  y         = 48;
            var  start     = datelist[0];
            var  prevtime  = new DateTime(start.Year, start.Month, start.Day, 5, 0, 0);
            var  limittime = prevtime.AddDays(1);
            var  starttime = prevtime;
            Font fnt       = new Font("MS UI Gothic", 12);

            const int attackheight = 3;

            var dispday = start;

            for (int i = 0; i < 5; i++)
            {
                g.FillRectangle(brush[i], i * 48 + 32, 8, 48, 16);
                g.DrawString($"{dispday.Month}/{dispday.Day}", fnt, Brushes.Black, i * 48 + 40, 8);
                dispday = dispday.AddDays(1);
            }


            for (int i = 0; i < 25; i++)
            {
                int x = ox + i * 30;
                g.DrawLine(Pens.White, x, 32, x, 32 + 300);

                g.DrawString(((i + 5) % 24).ToString(), fnt, Brushes.Black, x, 32);
            }

            for (int i = 0; i < 10; i++)
            {
                int ly = y + i * attackheight * 10 + 16;
                g.DrawLine(Pens.White, 0, ly, 25 * 30 + 32, ly);

                g.DrawString(((9 - i) * 10).ToString(), fnt, Brushes.Black, 4, ly - 16);
            }

            var day = 0;

            foreach (var pointrawlist in DayData(datelist))
            {
                using (var pen = new Pen(colors[day], 2))
                {
                    var drawline = pointrawlist.Select(n => new Point(ox + n.X, y + 16 + (90 - n.Y) * attackheight)).ToArray();
                    g.DrawLines(pen, drawline);

//                    var liney = y + (90 - attacknum) * attackheight + 16;
//                    g.DrawLine(pen[day], ox + Px(prevtime, starttime), liney, ox + Px(dt, starttime), liney - attackheight);
                }

                day++;
            }
        }
Beispiel #32
0
 public FixedListViewItem(String[] items, String imageKey, Color foreColor, Color backColor, Font font, ListViewGroup @group)
     : base(items, imageKey, foreColor, backColor, font, @group)
 {
 }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Closed += ShaderTest_Closed;

            //GLStatics.EnableDebug(DebugProc);

            gl3dcontroller = new Controller3D();
            gl3dcontroller.PaintObjects = ControllerDraw;
            gl3dcontroller.MatrixCalc.PerspectiveNearZDistance = 0.1f;
            gl3dcontroller.ZoomDistance = 80F;
            gl3dcontroller.MouseRotateAmountPerPixel = 0.1f;

            gl3dcontroller.Start(glwfc, new Vector3(0, 0, 0), new Vector3(135, 0, 0), 1F);


            items.Add(new GLColorShaderWorld(), "COSW");
            GLRenderState rl1 = GLRenderState.Lines(1);

            {
                rObjects.Add(items.Shader("COSW"), "L1",   // horizontal
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, rl1,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 0, -100), new Vector3(-100, 0, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.Gray })
                             );


                rObjects.Add(items.Shader("COSW"),    // vertical
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, rl1,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 0, -100), new Vector3(100, 0, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Gray })
                             );
            }

            // Number markers using instancing and 2d arrays, each with its own transform
            {
                Bitmap[]  numbers   = new Bitmap[20];
                Matrix4[] numberpos = new Matrix4[20];

                Font fnt = new Font("Arial", 44);

                for (int i = 0; i < numbers.Length; i++)
                {
                    int v = -100 + i * 10;
                    numbers[i] = new Bitmap(100, 100);
                    GLOFC.Utils.BitMapHelpers.DrawTextCentreIntoBitmap(ref numbers[i], v.ToString(), fnt, System.Drawing.Text.TextRenderingHint.ClearTypeGridFit, Color.Red, Color.AliceBlue);
                    numberpos[i]  = Matrix4.CreateScale(1);
                    numberpos[i] *= Matrix4.CreateRotationX(-80f.Radians());
                    numberpos[i] *= Matrix4.CreateTranslation(new Vector3(20, 0, v));
                }

                GLTexture2DArray array = new GLTexture2DArray(numbers, SizedInternalFormat.Rgba8, ownbmp: true);
                items.Add(array, "Nums");
                items.Add(new GLShaderPipeline(new GLPLVertexShaderModelMatrixTexture(), new GLPLFragmentShaderTexture2DIndexed(0)), "IC-2");

                GLRenderState       rq = GLRenderState.Quads(cullface: false);
                GLRenderDataTexture rt = new GLRenderDataTexture(items.Tex("Nums"));

                rObjects.Add(items.Shader("IC-2"), "1-b",
                             GLRenderableItem.CreateVector4Vector2Matrix4(items, PrimitiveType.Quads, rq,
                                                                          GLShapeObjectFactory.CreateQuad(1.0f), GLShapeObjectFactory.TexQuadCW, numberpos, rt,
                                                                          numberpos.Length));
            }


            {
                int       left = -40, right = 40, bottom = -20, top = +20, front = -40, back = 40;
                Vector4[] lines2 = new Vector4[]
                {
                    new Vector4(left, bottom, front, 1), new Vector4(left, top, front, 1),
                    new Vector4(left, top, front, 1), new Vector4(right, top, front, 1),
                    new Vector4(right, top, front, 1), new Vector4(right, bottom, front, 1),
                    new Vector4(right, bottom, front, 1), new Vector4(left, bottom, front, 1),

                    new Vector4(left, bottom, back, 1), new Vector4(left, top, back, 1),
                    new Vector4(left, top, back, 1), new Vector4(right, top, back, 1),
                    new Vector4(right, top, back, 1), new Vector4(right, bottom, back, 1),
                    new Vector4(right, bottom, back, 1), new Vector4(left, bottom, back, 1),

                    new Vector4(left, bottom, front, 1), new Vector4(left, bottom, back, 1),
                    new Vector4(left, top, front, 1), new Vector4(left, top, back, 1),
                    new Vector4(right, bottom, front, 1), new Vector4(right, bottom, back, 1),
                    new Vector4(right, top, front, 1), new Vector4(right, top, back, 1),
                };

                items.Add(new GLFixedShader(System.Drawing.Color.Yellow), "LINEYELLOW");
                rObjects.Add(items.Shader("LINEYELLOW"),
                             GLRenderableItem.CreateVector4(items, PrimitiveType.Lines, rl1, lines2));
            }


            items.Add(new ShaderV2(), "V2");

            GLRenderState rltot = GLRenderState.Tri();

            rObjects.Add(items.Shader("V2"), GLRenderableItem.CreateNullVertex(PrimitiveType.Points, rltot, instancecount: slices));



            dataoutbuffer = items.NewStorageBlock(5);
            dataoutbuffer.AllocateBytes(sizeof(float) * 4 * 32, OpenTK.Graphics.OpenGL4.BufferUsageHint.DynamicRead);    // 32 vec4 back

            atomicbuffer = items.NewAtomicBlock(6);
            atomicbuffer.AllocateBytes(sizeof(float) * 32, OpenTK.Graphics.OpenGL4.BufferUsageHint.DynamicCopy);

            pointblock = items.NewUniformBlock(1);
            pointblock.AllocateBytes(sizeof(float) * 4 * 8 + sizeof(float) * 30);        // plenty of space

            int hsize = 40, vsize = 20, zsize = 40;

            boundingbox = new Vector4[]
            {
                new Vector4(-hsize, -vsize, -zsize, 1),
                new Vector4(-hsize, vsize, -zsize, 1),
                new Vector4(hsize, vsize, -zsize, 1),
                new Vector4(hsize, -vsize, -zsize, 1),

                new Vector4(-hsize, -vsize, zsize, 1),
                new Vector4(-hsize, vsize, zsize, 1),
                new Vector4(hsize, vsize, zsize, 1),
                new Vector4(hsize, -vsize, zsize, 1),
            };

            items.Add(new GLMatrixCalcUniformBlock(), "MCUB");      // create a matrix uniform block
        }
            protected override void OnPaint(PaintEventArgs e)
            {
                Color backColor, foreColor;

                MetroThemeStyle _Theme = Theme;
                MetroColorStyle _Style = Style;

                if (Parent != null)
                {
                    if (Parent is IMetroForm)
                    {
                        _Theme    = ((IMetroForm)Parent).Theme;
                        _Style    = ((IMetroForm)Parent).Style;
                        foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                        backColor = MetroPaint.GetStyleColor(_Style);
                    }
                    else if (Parent is IMetroControl)
                    {
                        _Theme    = ((IMetroControl)Parent).Theme;
                        _Style    = ((IMetroControl)Parent).Style;
                        foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                        backColor = MetroPaint.GetStyleColor(_Style);
                    }
                    else
                    {
                        foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                        backColor = MetroPaint.GetStyleColor(_Style);
                    }
                }
                else
                {
                    foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                    backColor = MetroPaint.BackColor.Form(_Theme);
                }

                if (isHovered && !isPressed && Enabled)
                {
                    int _r = backColor.R;
                    int _g = backColor.G;
                    int _b = backColor.B;

                    backColor = ControlPaint.Light(backColor, 0.25f);
                }
                else if (isHovered && isPressed && Enabled)
                {
                    foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                    backColor = MetroPaint.GetStyleColor(_Style);
                }
                else if (!Enabled)
                {
                    foreColor = MetroPaint.ForeColor.Button.Disabled(_Theme);
                    backColor = MetroPaint.BackColor.Button.Disabled(_Theme);
                }
                else
                {
                    foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                }

                e.Graphics.Clear(backColor);
                Font buttonFont = MetroFonts.Button(MetroButtonSize.Small, MetroButtonWeight.Bold);

                TextRenderer.DrawText(e.Graphics, Text, buttonFont, ClientRectangle, foreColor, backColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis);

                DrawIcon(e.Graphics);
            }
Beispiel #35
0
        public Mode4Game(ChooseImageMode4 form, Image picture)
        {
            InitializeComponent();

            this.mode4 = form;
            image      = picture;
            ResizeImage(600, 600);
            PrivateFontCollection privateFont = new PrivateFontCollection();

            privateFont.AddFontFile("./Resources/BMHANNA_11yrs_ttf.ttf");
            Font font = new Font(privateFont.Families[0], 18F);

            timeScoreLabel.Font     = font;
            timeHighScoreLabel.Font = font;
            buttonArray             = new Button[4, 4] {
                { button1, button2, button3, button4 },
                { button5, button6, button7, button8 },
                { button9, button10, button11, button12 },
                { button13, button14, button15, button16 }
            };

            for (int i = 0; i < 4; i++)
            {
                int startX = 0;
                for (int j = 0; j < 4; j++)
                {
                    if (i == 0)
                    {
                        buttonArray[i, j].Image = Crop(image, 150, 150, startX, 0);
                        startX += 150;
                    }
                    else if (i == 1)
                    {
                        buttonArray[i, j].Image = Crop(image, 150, 150, startX, 150);
                        startX += 150;
                    }
                    else if (i == 2)
                    {
                        buttonArray[i, j].Image = Crop(image, 150, 150, startX, 300);
                        startX += 150;
                    }
                    else if (i == 3)
                    {
                        buttonArray[i, j].Image = Crop(image, 150, 150, startX, 450);
                        startX += 150;
                    }
                }
            }
            buttonArray[3, 3].Image     = null;
            buttonArray[3, 3].BackColor = Color.Black;
            ResizeImage(300, 300);
            pictureBox.Image = image;
            string path = Application.StartupPath + @"\Rank4.txt";

            if (!File.Exists((path)))
            {
                timeHighScoreLabel.Text = "--.--.--------";
            }
            else
            {
                string[] temp = File.ReadAllLines(path);
                string   txt  = temp[0];
                txt = txt.Substring(0, txt.IndexOf("\t"));
                timeHighScoreLabel.Text = txt;
            }
        }
        private void DrawBossGraph(Graphics g, List <DateTime> datelist)
        {
            Brush[] brush =
            {
                Brushes.CornflowerBlue,
                Brushes.Aquamarine,
                Brushes.ForestGreen,
                Brushes.Gold,
                Brushes.OrangeRed,
            };

            var  ox        = 32;
            var  y         = 48;
            var  start     = datelist[0];
            var  prevtime  = new DateTime(start.Year, start.Month, start.Day, 5, 0, 0);
            var  limittime = prevtime.AddDays(1);
            var  starttime = prevtime;
            int  boss      = 0;
            Font fnt       = new Font("MS UI Gothic", 12);

            for (int i = 0; i < 5; i++)
            {
                g.FillRectangle(brush[i], i * 48 + 32, 8, 48, 16);
                g.DrawString((i + 1).ToString(), fnt, Brushes.Black, i * 48 + 32 + 16, 8);
            }


            for (int i = 0; i < 25; i++)
            {
                int x = ox + i * 30;
                g.DrawLine(Pens.White, x, 32, x, 300);

                if (i < 24)
                {
                    g.DrawString(((i + 5) % 24).ToString(), fnt, Brushes.Black, x, 32);
                }
            }

            y += 16;
            g.DrawString(starttime.Day.ToString(), fnt, Brushes.Black, 4, y + 8);
            foreach (var dt in LastAdd(datelist))
            {
                int bindex = boss % 5;

                if (limittime <= dt)
                {
                    DrawBox(g, brush[bindex], ox, y, prevtime, starttime, limittime.AddMinutes(-1));
                    prevtime  = limittime;
                    limittime = limittime.AddDays(1);
                    starttime = starttime.AddDays(1);
                    y        += 48;

                    g.DrawString(starttime.Day.ToString(), fnt, Brushes.Black, 4, y + 8);
                }
                DrawBox(g, brush[bindex], ox, y, prevtime, starttime, dt);

                if (boss % 5 == 0)
                {
                    g.DrawString((boss / 5 + 1).ToString(), fnt, Brushes.Black, ox + Px(prevtime, starttime), y - 16);
                }

                prevtime = dt;

                boss++;
            }
        }
        private void DrawAttackSpeedGraph(Graphics g, List <DateTime> datelist)
        {
            Brush[] brush =
            {
                Brushes.CornflowerBlue,
                Brushes.Aquamarine,
                Brushes.ForestGreen,
                Brushes.Gold,
                Brushes.OrangeRed,
                Brushes.Red,
            };
            Color[] colors =
            {
                Color.CornflowerBlue,
                Color.Aquamarine,
                Color.ForestGreen,
                Color.Gold,
                Color.OrangeRed,
                Color.Red,
            };

            var  ox        = 32;
            var  y         = 48;
            var  start     = datelist[0];
            var  prevtime  = new DateTime(start.Year, start.Month, start.Day, 5, 0, 0);
            var  limittime = prevtime.AddDays(1);
            var  starttime = prevtime;
            Font fnt       = new Font("MS UI Gothic", 12);

            const int graphheight = 300;

            IEnumerable <List <PointF> > pointrawlists = AttackSpeedList(datelist);
            int max = (int)(Math.Ceiling(pointrawlists.Max(n => n.Select(m => m.Y).Max())));

//            int attackheight = 0 < max ? graphheight / max : 30;

            int maxheight = Math.Max(10, max);

            var dispday = start;

            for (int i = 0; i < 5; i++)
            {
                g.FillRectangle(brush[i], i * 48 + 32, 8, 48, 16);
                g.DrawString($"{dispday.Month}/{dispday.Day}", fnt, Brushes.Black, i * 48 + 40, 8);
                dispday = dispday.AddDays(1);
            }


            for (int i = 0; i < 25; i++)
            {
                int x = ox + i * 30;
                g.DrawLine(Pens.White, x, 32, x, 32 + 32 + graphheight);

                g.DrawString(((i + 5) % 24).ToString(), fnt, Brushes.Black, x, 32);
            }

            for (int i = 0; i < max + 1; i++)
            {
                int ly = y + (i * 300) / maxheight + 16;
                g.DrawLine(Pens.White, 0, ly, 25 * 30 + 32, ly);

                g.DrawString(((max - i)).ToString(), fnt, Brushes.Black, 4, ly - 16);
            }

            var day = 0;

            foreach (var pointrawlist in pointrawlists)
            {
                using (var pen = new Pen(colors[day], 2))
                {
                    var drawline = pointrawlist.Select(n => new Point((int)(ox + n.X), (int)(y + 16 + graphheight - n.Y * 300 / maxheight))).ToArray();
                    g.DrawLines(pen, drawline);
                }

                day++;
            }
        }
Beispiel #38
0
        protected override void OnPaint(PaintEventArgs e)
        {
//			base.OnPaint(e);

            BtnState st = !Enabled ? BtnState.Inactive :
                          (_State == BtnState.Pushed) && _AllAsOneBt ? BtnState.Pushed : BtnState.Normal;

            BtnState stBT1 = !Enabled || _StateBT1 == BtnState.Inactive ? BtnState.Inactive :
                             (_StateBT1 == BtnState.Pushed) || (st == BtnState.Pushed) ? BtnState.Pushed :
                             (_StateBT1 == BtnState.MouseOver) && !_AllAsOneBt? BtnState.MouseOver : BtnState.Normal;

            BtnState stBT2 = !Enabled ? BtnState.Inactive :
                             (_StateBT2 == BtnState.Pushed) || (st == BtnState.Pushed) ? BtnState.Pushed :
                             (_StateBT2 == BtnState.MouseOver) && !_AllAsOneBt ? BtnState.MouseOver : BtnState.Normal;

            BtnRenderer.Draw(e.Graphics, _BtnInfo[st]);

            if (_PttImage != null)
            {
#if DEBUG1
                e.Graphics.DrawImage(_PttImage, _PttRect);
#else
                e.Graphics.DrawImage(_PttImage, _PttRect.X, _PttRect.Y);
#endif
            }
            if (_SquelchImage != null)
            {
#if DEBUG1
                e.Graphics.DrawImage(_SquelchImage, _SquelchRect);
#else
                e.Graphics.DrawImage(_SquelchImage, _SquelchRect.X, _SquelchRect.Y);
#endif

                if (_QidxValue >= 0)
                {
                    Rectangle txtRect = ClientRectangle;
                    txtRect.Offset(32, 2);
                    BtnRenderer.DrawString(e.Graphics, txtRect, Color.Transparent, st, _QidxValue.ToString(), _MediumFontBold, ContentAlignment.TopCenter, Color.Black);
                }
            }

            BtnRenderer.Draw(e.Graphics, _TxBtnInfo[stBT1]);
            BtnRenderer.Draw(e.Graphics, _RxBtnInfo[stBT2]);

            if (_DrawX)
            {
                using (Pen p = new Pen(Color.Red, 5))
                {
                    e.Graphics.DrawLine(p, 6, 6, Width - 6, Height - 6);
                    e.Graphics.DrawLine(p, Width - 6, 6, 6, Height - 6);
                }
            }

            Rectangle textRect = ClientRectangle;
            /** 20180608. Las frecuencias con ID de mas de 7 Caracteres utilizan un FONT ligeramente inferior */
#if DEBUG1
            textRect.Offset(0, -5);
            //_Frecuency = _Frecuency=="125.200" ? "EMERGENCIA" : _Frecuency;
            Font fontToUse = _Frecuency.Length > 7 ? _SmallFontBold1 : _MediumFontBold;
            BtnRenderer.DrawString(e.Graphics, textRect, _BtnInfo.GetBackColor(st), st, _Frecuency, fontToUse, ContentAlignment.TopCenter, ForeColor);
#else
            textRect.Offset(0, -5);
            Font fontToUse = _Frecuency.Length > 7 ? _SmallFontBold1 : _MediumFontBold;
            if (global::HMI.Model.Module.Properties.Settings.Default.BigFonts)
            {
                fontToUse = _BigFont;
            }
            BtnRenderer.DrawString(e.Graphics, textRect, _BtnInfo.GetBackColor(st), st, _Frecuency, fontToUse, ContentAlignment.TopCenter, ForeColor);
#endif
            if (global::HMI.Model.Module.Properties.Settings.Default.BigFonts)
            {
                fontToUse = _MediumFontBold2;
                textRect.Offset(0, 20);
            }
            else
            {
                textRect.Offset(0, 13);
                fontToUse = _SmallFont;
            }
            BtnRenderer.DrawString(e.Graphics, textRect, _BtnInfo.GetBackColor(st), st, _Alias, fontToUse, ContentAlignment.TopCenter, ForeColor);

            if (_RtxGroup > 0)
            {
                string rtxGroup = ((char)('G' + _RtxGroup - 1)).ToString();
                e.Graphics.DrawString(rtxGroup, _MediumFontBold, Brushes.Black, 3, _TxBtnInfo.Rect.Top - 15);
            }
            else if (_RtxGroup == -1)
            {
                e.Graphics.DrawString("R", _MediumFontBold, Brushes.Black, Width - 15, _TxBtnInfo.Rect.Top - 15);
            }

            using (Pen linePen = new Pen(Enabled ? _BtnInfo.GetBorderColor(BtnState.Normal) : _BtnInfo.GetBorderColor(BtnState.Inactive), 2))
            {
                e.Graphics.DrawLine(linePen, 1, _TxBtnInfo.Rect.Top, Width - 1, _TxBtnInfo.Rect.Top);
            }
        }
 /// <summary>
 /// esets the Font1 property to its default value.
 /// </summary>
 public void ResetFont1()
 {
     Font1 = null;
 }
        private SizeF MeasureString(string s, StyleInfo si, Graphics g, out float descent)
        {
            Font         drawFont   = null;
            StringFormat drawFormat = null;
            SizeF        ms         = SizeF.Empty;

            descent = 0;
            if (s == null || s.Length == 0)
            {
                return(ms);
            }
            try
            {
                // STYLE
                System.Drawing.FontStyle fs = 0;
                if (si.FontStyle == FontStyleEnum.Italic)
                {
                    fs |= System.Drawing.FontStyle.Italic;
                }

                // WEIGHT
                switch (si.FontWeight)
                {
                case FontWeightEnum.Bold:
                case FontWeightEnum.Bolder:
                case FontWeightEnum.W500:
                case FontWeightEnum.W600:
                case FontWeightEnum.W700:
                case FontWeightEnum.W800:
                case FontWeightEnum.W900:
                    fs |= System.Drawing.FontStyle.Bold;
                    break;

                default:
                    break;
                }
                try
                {
                    FontFamily ff = si.GetFontFamily();
                    drawFont = new Font(ff, si.FontSize, fs);
                    // following algorithm comes from the C# Font Metrics documentation
                    float descentPixel = si.FontSize * ff.GetCellDescent(fs) / ff.GetEmHeight(fs);
                    descent = RSize.PointsFromPixels(g, descentPixel);
                }
                catch
                {
                    drawFont = new Font("Arial", si.FontSize, fs);                      // usually because font not found
                    descent  = 0;
                }
                drawFormat           = new StringFormat();
                drawFormat.Alignment = StringAlignment.Near;

                CharacterRange[] cr = { new CharacterRange(0, s.Length) };
                drawFormat.SetMeasurableCharacterRanges(cr);
                Region[] rs = new Region[1];
                rs = g.MeasureCharacterRanges(s, drawFont, new RectangleF(0, 0, float.MaxValue, float.MaxValue),
                                              drawFormat);
                RectangleF mr = rs[0].GetBounds(g);

                ms.Height = RSize.PointsFromPixels(g, mr.Height);                       // convert to points from pixels
                ms.Width  = RSize.PointsFromPixels(g, mr.Width);                        // convert to points from pixels
                return(ms);
            }
            finally
            {
                if (drawFont != null)
                {
                    drawFont.Dispose();
                }
                if (drawFormat != null)
                {
                    drawFont.Dispose();
                }
            }
        }
Beispiel #41
0
 public void DrawString(string s, Font font, Brush brush, float x, float y)
 {
     this.renderTarget.DrawString(s, font, brush, x, y);
 }
 /// <summary>
 /// esets the Font2 property to its default value.
 /// </summary>
 public void ResetFont2()
 {
     Font2 = null;
 }
Beispiel #43
0
 public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format)
 {
     this.renderTarget.DrawString(s, font, brush, point, format);
 }
Beispiel #44
0
 public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format)
 {
     this.renderTarget.DrawString(s, font, brush, x, y, format);
 }
 /// <summary>
 /// Gets the descent of the font
 /// </summary>
 /// <param name="f"></param>
 /// <returns></returns>
 /// <remarks>
 /// Font metrics from http://msdn.microsoft.com/en-us/library/xwf9s90b(VS.71).aspx
 /// </remarks>
 public static float GetDescent(Font f)
 {
     float mainDescent = f.Size * f.FontFamily.GetCellDescent(f.Style) / f.FontFamily.GetEmHeight(f.Style);
     return mainDescent;
 }
Beispiel #46
0
 public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
 {
     this.renderTarget.DrawString(s, font, brush, layoutRectangle, format);
 }
Beispiel #47
0
        public InputComponent(
            ComponentGroup componentGroup,
            Vector2 position,
            Vector2 size,
            string defaultValue,
            string placeholderText,
            MultiStateSprite bgSprite,
            Font font,
            int fontSize,
            InputField.CharacterValidation characterValidation = InputField.CharacterValidation.None,
            int characterLimit = 0
            ) : base(componentGroup, position, size)
        {
            _bgSprite = bgSprite;

            Interactable = true;

            // Create background image
            Image        = GameObject.AddComponent <Image>();
            Image.sprite = bgSprite.Neutral;
            Image.type   = Image.Type.Sliced;

            var placeholder = new GameObject();

            placeholder.AddComponent <RectTransform>().sizeDelta = size;
            var placeholderTextComponent = placeholder.AddComponent <Text>();

            placeholderTextComponent.text      = placeholderText;
            placeholderTextComponent.font      = font;
            placeholderTextComponent.fontSize  = fontSize;
            placeholderTextComponent.alignment = TextAnchor.MiddleCenter;
            // Make the color white with opacity so it is clearly different from inputted text
            placeholderTextComponent.color = new Color(1f, 1f, 1f, 0.5f);

            // Set the transform parent to the InputComponent gameObject
            placeholder.transform.SetParent(GameObject.transform, false);
            Object.DontDestroyOnLoad(placeholder);

            var textObject = new GameObject();

            textObject.AddComponent <RectTransform>().sizeDelta = size - new Vector2(TextMargin * 2f, 0f);
            Text           = textObject.AddComponent <Text>();
            Text.text      = defaultValue;
            Text.font      = font;
            Text.fontSize  = fontSize;
            Text.alignment = TextAnchor.MiddleCenter;
            Text.color     = Color.white;

            // Set the transform parent to the InputComponent gameObject
            textObject.transform.SetParent(GameObject.transform, false);

            Object.DontDestroyOnLoad(textObject);

            // Create the actual inputField component
            InputField = GameObject.AddComponent <InputField>();
            InputField.targetGraphic       = Image;
            InputField.placeholder         = placeholderTextComponent;
            InputField.textComponent       = Text;
            InputField.text                = defaultValue;
            InputField.characterValidation = characterValidation;
            InputField.characterLimit      = characterLimit;

            InputField.shouldActivateOnSelect = false;
            InputField.onValueChanged.AddListener(value => { _onChange?.Invoke(value); });

            var eventTrigger = GameObject.AddComponent <EventTrigger>();

            AddEventTrigger(eventTrigger, EventTriggerType.PointerEnter, data => {
                if (Interactable)
                {
                    Image.sprite = bgSprite.Hover;
                }
            });
            AddEventTrigger(eventTrigger, EventTriggerType.PointerExit, data => {
                if (Interactable)
                {
                    Image.sprite = bgSprite.Neutral;
                }
            });
            AddEventTrigger(eventTrigger, EventTriggerType.PointerDown, data => {
                if (Interactable)
                {
                    Image.sprite = bgSprite.Active;
                }
            });
        }
 /// <summary>
 /// Gets the line spacing of the font
 /// </summary>
 /// <param name="f"></param>
 /// <returns></returns>
 /// <remarks>
 /// Font metrics from http://msdn.microsoft.com/en-us/library/xwf9s90b(VS.71).aspx
 /// </remarks>
 public static float GetLineSpacing(Font f)
 {
     float s = f.Size * f.FontFamily.GetLineSpacing(f.Style) / f.FontFamily.GetEmHeight(f.Style);
     return s;
 }
Beispiel #49
0
 public void SetText(int index, string txt, Font font, Color color, float lineHeight)
 {
     SetText(index, txt, font, color, null, lineHeight);
 }
Beispiel #50
0
        private void Imprimir_PrintPage_Credito(object sender, PrintPageEventArgs e)
        {
            DataTable dt = new DataTable();

            Font font  = new Font("Arial", 14);
            int  ancho = 350;
            int  y     = 20;
            int  x     = 250;


            e.Graphics.DrawString("---Veterinaria El Bosque----", font, Brushes.Black, new RectangleF(x, y        += 40, ancho, 20));
            e.Graphics.DrawString("Factura#:" + txt_Factura.Text, font, Brushes.Black, new RectangleF(x, y        += 40, ancho, 20));
            e.Graphics.DrawString("FechaFactura: " + txt_Fecha_Doc.Text, font, Brushes.Black, new RectangleF(x, y += 20, ancho, 20));
            e.Graphics.DrawString("Cliente: " + txt_Nombre.Text, font, Brushes.Black, new RectangleF(x, y         += 20, ancho, 20));
            e.Graphics.DrawString("FechaPago: " + txt_Fecha.Text, font, Brushes.Black, new RectangleF(x, y        += 20, ancho, 20));


            //e.Graphics.DrawString("---Productos/Servicios---", font, Brushes.Black, new RectangleF(x, y += 40, ancho, 20));


            //foreach (DataGridViewColumn columna in dtg_Detalles.Columns)
            //{


            //    DataColumn col = new DataColumn(columna.Name);


            //    dt.Columns.Add(col);


            //}
            //double cantidad;
            //string nombre;
            //double precio;
            //double impuesto;

            //double total = Convert.ToDouble(txt_Total.Text.ToString());
            //double subtotal;
            //subtotal = total / (1 + 0.13);
            //impuesto = total - subtotal;


            //foreach (DataGridViewRow row in dtg_Detalles.Rows)
            //{

            //    DataRow dr = dt.NewRow();
            //    dr[0] = row.Cells[7].Value.ToString();
            //    dr[1] = row.Cells[5].Value.ToString();
            //    dr[2] = row.Cells[6].Value.ToString();
            //    //dr[3] = row.Cells[3].Value.ToString();
            //    //dr[4] = row.Cells[4].Value.ToString();


            //    cantidad = Convert.ToDouble(dr[0].ToString());
            //    nombre = dr[1].ToString();
            //    precio = Convert.ToDouble(dr[2].ToString());
            //    //descuento = dr[3].ToString();
            //    //total = dr[4].ToString();

            //    e.Graphics.DrawString(cantidad + " " + nombre + " " + "c/u" + " " + "¢" + precio /*+ " " + descuento + " " + total*/, font, Brushes.Black, new RectangleF(x, y += 20, ancho, 20));


            //}
            e.Graphics.DrawString("---Monto Anterior:" + "¢" + txt_Credito.Text, font, Brushes.Black, new RectangleF(x, y += 30, ancho, 20));
            //e.Graphics.DrawString("---Impuesto: " + txt_Impuesto.Text, font, Brushes.Black, new RectangleF(x, y += 30, ancho, 20));
            e.Graphics.DrawString("---Abono:" + "¢" + txt_Abono.Text, font, Brushes.Black, new RectangleF(x, y        += 30, ancho, 20));
            e.Graphics.DrawString("---Saldo Actual:" + "¢" + txt_Saldo.Text, font, Brushes.Black, new RectangleF(x, y += 30, ancho, 20));
            e.Graphics.DrawString("---GRACIAS POR VISITARNOS---", font, Brushes.Black, new RectangleF(x, y            += 50, ancho, 20));
        }
Beispiel #51
0
 public StatusBarDrawItemEventArgs(Graphics g, Font font, Rectangle r, int itemId, DrawItemState itemState, StatusBarPanel panel, Color foreColor, Color backColor)
     : base(g, font, r, itemId, itemState)
 {
     throw null;
 }
Beispiel #52
0
        private void _CreateReceipt(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Graphics graphic    = e.Graphics;
            Font     font       = new Font("Courier New", 12);
            float    FontHeight = font.GetHeight();
            int      startX     = 10;
            int      startY     = 10;
            int      offset     = 40;

            graphic.DrawString("Hóa đơn thanh toán", new Font("Courier New", 18), new SolidBrush(Color.Black), startX, startY);
            int index = 0;

            if (lstPhong.Count >= 1)
            {
                string top = "Mã phòng".PadRight(24) + "Thành Tiền";
                graphic.DrawString(top, font, new SolidBrush(Color.Black), startX, startY + offset);
                offset = offset + (int)FontHeight;     //make the spacing consistent
                graphic.DrawString("----------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset);
                offset = offset + (int)FontHeight + 5; //make the spacing consistent

                foreach (string item in lstPhong)
                {
                    graphic.DrawString(item, font, new SolidBrush(Color.Black), startX, startY + offset);
                    graphic.DrawString(lstGiaPhong[index++].ToString(), font, new SolidBrush(Color.Black), startX + 250, startY + offset);
                    offset = offset + (int)FontHeight + 5; //make the spacing consistent
                }

                offset = offset + 20; //make some room so that the total stands out.
            }

            if (lstDV.Count >= 1)
            {
                string top1 = "Tên dịch vụ".PadRight(24) + "Thành Tiền";
                graphic.DrawString(top1, font, new SolidBrush(Color.Black), startX, startY + offset);
                offset = offset + (int)FontHeight;     //make the spacing consistent
                graphic.DrawString("----------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset);
                offset = offset + (int)FontHeight + 5; //make the spacing consistent

                index = 0;
                foreach (string item in lstDV)
                {
                    graphic.DrawString(item, font, new SolidBrush(Color.Black), startX, startY + offset);
                    graphic.DrawString(lstGiaDV[index++].ToString(), font, new SolidBrush(Color.Black), startX + 250, startY + offset);
                    offset = offset + (int)FontHeight + 5; //make the spacing consistent
                }

                offset = offset + 20; //make some room so that the total stands out.
            }

            graphic.DrawString("TỔNG TIỀN TRẢ ", new Font("Courier New", 12, FontStyle.Bold), new SolidBrush(Color.Black), startX, startY + offset);
            graphic.DrawString(_DoiSoSangDonViTienTe(sum), new Font("Courier New", 12, FontStyle.Bold), new SolidBrush(Color.Black), startX + 250, startY + offset);

            offset = offset + (int)FontHeight + 5; //make the spacing consistent
            graphic.DrawString("TIỀN MẶT ", font, new SolidBrush(Color.Black), startX, startY + offset);
            graphic.DrawString(_DoiSoSangDonViTienTe(txtTienTra.Text.Trim()), font, new SolidBrush(Color.Black), startX + 250, startY + offset);

            offset = offset + (int)FontHeight + 5; //make the spacing consistent
            graphic.DrawString("TIỀN DƯ ", font, new SolidBrush(Color.Black), startX, startY + offset);
            graphic.DrawString(_DoiSoSangDonViTienTe((sum - Convert.ToDouble(txtTienTra.Text.Trim()))), font, new SolidBrush(Color.Black), startX + 250, startY + offset);

            offset = offset + 20;                  //make some room so that the total stands out.

            offset = offset + (int)FontHeight + 5; //make the spacing consistent
            graphic.DrawString(" CẢM ƠN BẠN ĐÃ GHÉ THĂM!,", font, new SolidBrush(Color.Black), startX, startY + offset);
            offset = offset + (int)FontHeight + 5; //make the spacing consistent
            graphic.DrawString("HI VỌNG BẠN SẼ GHÉ THĂM LẠI!", font, new SolidBrush(Color.Black), startX, startY + offset);
        }
Beispiel #53
0
        /// <summary>
        /// This method returns typeface for given typeface using following rules:
        /// 1. Lookup in the cache
        /// 2. If not found, look in the assets in the fonts folder. Save your font under its FontFamily name.
        /// If no extension is written in the family name .ttf is asumed
        /// 3. If not found look in the files under fonts/ folder
        /// If no extension is written in the family name .ttf is asumed
        /// 4. If not found, try to return typeface from Xamarin.Forms ToTypeface() method
        /// 5. If not successfull, return Typeface.Default
        /// </summary>
        /// <returns>The extended typeface.</returns>
        /// <param name="font">Font</param>
        /// <param name="context">Android Context</param>
        public static Typeface ToExtendedTypeface(this Font font, Context context)
        {
            Typeface typeface = null;

            //1. Lookup in the cache
            var hashKey = font.ToHasmapKey();

            typeface = TypefaceCache.SharedCache.RetrieveTypeface(hashKey);
                        #if DEBUG
            if (typeface != null)
            {
                Console.WriteLine("Typeface for font {0} found in cache", font);
            }
                        #endif

            //2. If not found, try custom asset folder
            if (typeface == null && !string.IsNullOrEmpty(font.FontFamily))
            {
                string filename = font.FontFamily;
                //if no extension given then assume and add .ttf
                if (filename.LastIndexOf(".", System.StringComparison.Ordinal) != filename.Length - 4)
                {
                    filename = string.Format("{0}.ttf", filename);
                }
                try
                {
                    var path = "fonts/" + filename;
                                        #if DEBUG
                    Console.WriteLine("Lookking for font file: {0}", path);
                                        #endif
                    typeface = Typeface.CreateFromAsset(context.Assets, path);
                                        #if DEBUG
                    Console.WriteLine("Found in assets and cached.");
                                        #endif
#pragma warning disable CS0168 // Variable is declared but never used
                } catch (Exception ex)
                {
                                        #if DEBUG
                    Console.WriteLine("not found in assets. Exception: {0}", ex);
                    Console.WriteLine("Trying creation from file");
                                        #endif
                    try
                    {
                        typeface = Typeface.CreateFromFile("fonts/" + filename);


#if DEBUG
                        Console.WriteLine("Found in file and cached.");
#endif
                    } catch (Exception ex1)
#pragma warning restore CS0168 // Variable is declared but never used
                    {
                                                #if DEBUG
                        Console.WriteLine("not found by file. Exception: {0}", ex1);
                        Console.WriteLine("Trying creation using Xamarin.Forms implementation");
                                                #endif
                    }
                }
            }
            //3. If not found, fall back to default Xamarin.Forms implementation to load system font
            if (typeface == null)
            {
                typeface = font.ToTypeface();
            }

            if (typeface == null)
            {
                                #if DEBUG
                Console.WriteLine("Falling back to default typeface");
                                #endif
                typeface = Typeface.Default;
            }
            //Store in cache
            TypefaceCache.SharedCache.StoreTypeface(hashKey, typeface);

            return(typeface);
        }
Beispiel #54
0
        public void SetVarValueText(int index, float maxValue, string fontTxt, string backTxt, Font font, Color color, RectangleF?incRect, float lineHeight)
        {
            ScTxtInfo txtInfo;

            if (rowTextInfoList[index] != null)
            {
                txtInfo = rowTextInfoList[index];
            }
            else
            {
                txtInfo = new ScTxtInfo(this);
            }

            txtInfo.maxVarValue    = maxValue;
            txtInfo.fontTxt        = fontTxt;
            txtInfo.backTxt        = backTxt;
            txtInfo.txtColor       = color;
            txtInfo.txtFont        = font;
            txtInfo.lineHeight     = lineHeight;
            txtInfo.incRect        = incRect;
            rowTextInfoList[index] = txtInfo;
        }
Beispiel #55
0
        public ActionResult JournalVoucher(Int32 JVId)
        {
            // ==============================
            // PDF Settings and Customization
            // ==============================
            MemoryStream workStream = new MemoryStream();
            Rectangle    rectangle  = new Rectangle(PageSize.A3);
            Document     document   = new Document(rectangle, 72, 72, 72, 72);

            document.SetMargins(30f, 30f, 30f, 30f);
            PdfWriter.GetInstance(document, workStream).CloseStream = false;

            document.Open();

            // =====
            // Fonts
            // =====
            Font fontArial17Bold = FontFactory.GetFont("Arial", 17, Font.BOLD);
            Font fontArial11     = FontFactory.GetFont("Arial", 11);
            Font fontArial9Bold  = FontFactory.GetFont("Arial", 9, Font.BOLD);
            Font fontArial9      = FontFactory.GetFont("Arial", 9);
            Font fontArial10Bold = FontFactory.GetFont("Arial", 10, Font.BOLD);
            Font fontArial10     = FontFactory.GetFont("Arial", 10);
            Font fontArial11Bold = FontFactory.GetFont("Arial", 11, Font.BOLD);
            Font fontArial12Bold = FontFactory.GetFont("Arial", 12, Font.BOLD);
            Font fontArial13Bold = FontFactory.GetFont("Arial", 13, Font.BOLD);

            Paragraph line = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLACK, Element.ALIGN_LEFT, 4.5F)));

            var identityUserId   = User.Identity.GetUserId();
            var currentUser      = from d in db.MstUsers where d.UserId == identityUserId select d;
            var currentCompanyId = currentUser.FirstOrDefault().CompanyId;
            var currentBranchId  = currentUser.FirstOrDefault().BranchId;

            // ==============
            // Company Detail
            // ==============
            var companyName = (from d in db.MstCompanies where d.Id == Convert.ToInt32(currentCompanyId) select d.Company).FirstOrDefault();
            var address     = (from d in db.MstCompanies where d.Id == Convert.ToInt32(currentCompanyId) select d.Address).FirstOrDefault();
            var contactNo   = (from d in db.MstCompanies where d.Id == Convert.ToInt32(currentCompanyId) select d.ContactNumber).FirstOrDefault();
            var branch      = (from d in db.MstBranches where d.Id == Convert.ToInt32(currentBranchId) select d.Branch).FirstOrDefault();

            // ===========
            // Header Page
            // ===========
            PdfPTable headerPage = new PdfPTable(2);

            float[] widthsCellsHeaderPage = new float[] { 100f, 75f };
            headerPage.SetWidths(widthsCellsHeaderPage);
            headerPage.WidthPercentage = 100;
            headerPage.AddCell(new PdfPCell(new Phrase(companyName, fontArial17Bold))
            {
                Border = 0
            });
            headerPage.AddCell(new PdfPCell(new Phrase("Journal Voucher", fontArial17Bold))
            {
                Border = 0, HorizontalAlignment = 2
            });
            headerPage.AddCell(new PdfPCell(new Phrase(address, fontArial11))
            {
                Border = 0, PaddingTop = 5f
            });
            headerPage.AddCell(new PdfPCell(new Phrase(branch, fontArial11))
            {
                Border = 0, PaddingTop = 5f, HorizontalAlignment = 2
            });
            headerPage.AddCell(new PdfPCell(new Phrase(contactNo, fontArial11))
            {
                Border = 0, PaddingTop = 5f
            });
            headerPage.AddCell(new PdfPCell(new Phrase("Printed " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToString("hh:mm:ss tt"), fontArial11))
            {
                Border = 0, PaddingTop = 5f, HorizontalAlignment = 2
            });
            document.Add(headerPage);

            // =====
            // Space
            // =====
            PdfPTable spaceTable = new PdfPTable(1);

            float[] widthCellsSpaceTable = new float[] { 100f };
            spaceTable.SetWidths(widthCellsSpaceTable);
            spaceTable.WidthPercentage = 100;
            spaceTable.AddCell(new PdfPCell(new Phrase(" ", fontArial10Bold))
            {
                Border = 0, PaddingTop = 5f
            });

            document.Add(line);

            // ====================
            // Get Journal Vouchers
            // ====================
            var journalVouchers = from d in db.TrnJournalVouchers
                                  where d.Id == JVId
                                  select d;

            if (journalVouchers.Any())
            {
                String particulars = journalVouchers.FirstOrDefault().Particulars;
                String JVNumber    = journalVouchers.FirstOrDefault().JVNumber;
                String JVDate      = journalVouchers.FirstOrDefault().JVDate.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture);
                String preparedBy  = journalVouchers.FirstOrDefault().MstUser.FullName;
                String checkedBy   = journalVouchers.FirstOrDefault().MstUser1.FullName;
                String approvedBy  = journalVouchers.FirstOrDefault().MstUser2.FullName;

                PdfPTable tableJournalVouchers          = new PdfPTable(4);
                float[]   widthscellsTablePurchaseOrder = new float[] { 40f, 150f, 70f, 50f };
                tableJournalVouchers.SetWidths(widthscellsTablePurchaseOrder);
                tableJournalVouchers.WidthPercentage = 100;

                tableJournalVouchers.AddCell(new PdfPCell(new Phrase("Particulars", fontArial11Bold))
                {
                    Rowspan = 2, Border = 0, PaddingTop = 10f, PaddingLeft = 5f, PaddingRight = 5f
                });
                tableJournalVouchers.AddCell(new PdfPCell(new Phrase(particulars, fontArial11))
                {
                    Rowspan = 2, Border = 0, PaddingTop = 10f, PaddingLeft = 5f, PaddingRight = 5f
                });
                tableJournalVouchers.AddCell(new PdfPCell(new Phrase("No.", fontArial11Bold))
                {
                    Border = 0, PaddingTop = 10f, PaddingLeft = 5f, PaddingRight = 5f, HorizontalAlignment = 2
                });
                tableJournalVouchers.AddCell(new PdfPCell(new Phrase(JVNumber, fontArial11))
                {
                    Border = 0, PaddingTop = 10f, PaddingLeft = 5f, PaddingRight = 5f, HorizontalAlignment = 2
                });
                tableJournalVouchers.AddCell(new PdfPCell(new Phrase("Date", fontArial11Bold))
                {
                    Border = 0, PaddingTop = 5f, PaddingLeft = 5f, PaddingRight = 5f, HorizontalAlignment = 2
                });
                tableJournalVouchers.AddCell(new PdfPCell(new Phrase(JVDate, fontArial11))
                {
                    Border = 0, PaddingTop = 5f, PaddingLeft = 5f, PaddingRight = 5f, HorizontalAlignment = 2
                });
                document.Add(tableJournalVouchers);

                document.Add(spaceTable);

                // ============
                // Get Journals
                // ============
                var journals = from d in db.TrnJournals
                               where d.JVId == JVId
                               select new Models.TrnJournal
                {
                    Id                = d.Id,
                    JournalDate       = d.JournalDate.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture),
                    BranchId          = d.BranchId,
                    Branch            = d.MstBranch.Branch,
                    BranchCode        = d.MstBranch.BranchCode,
                    AccountId         = d.AccountId,
                    Account           = d.MstAccount.Account,
                    AccountCode       = d.MstAccount.AccountCode,
                    ArticleId         = d.ArticleId,
                    Article           = d.MstArticle.Article,
                    Particulars       = d.Particulars,
                    DebitAmount       = d.DebitAmount,
                    CreditAmount      = d.CreditAmount,
                    ORId              = d.ORId,
                    CVId              = d.CVId,
                    JVId              = d.JVId,
                    RRId              = d.RRId,
                    SIId              = d.SIId,
                    INId              = d.INId,
                    OTId              = d.OTId,
                    STId              = d.STId,
                    DocumentReference = d.DocumentReference,
                    APRRId            = d.APRRId,
                    ARSIId            = d.ARSIId,
                };


                if (journals.Any())
                {
                    PdfPTable tableStockTransferItems = new PdfPTable(6);
                    float[]   widthscellsPOLines      = new float[] { 75f, 30f, 75f, 75f, 45f, 45f };
                    tableStockTransferItems.SetWidths(widthscellsPOLines);
                    tableStockTransferItems.WidthPercentage = 100;
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase("Branch", fontArial11Bold))
                    {
                        HorizontalAlignment = 1, PaddingTop = 3f, PaddingBottom = 7f
                    });
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase("Code", fontArial11Bold))
                    {
                        HorizontalAlignment = 1, PaddingTop = 3f, PaddingBottom = 7f
                    });
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase("Account", fontArial11Bold))
                    {
                        HorizontalAlignment = 1, PaddingTop = 3f, PaddingBottom = 7f
                    });
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase("Article", fontArial11Bold))
                    {
                        HorizontalAlignment = 1, PaddingTop = 3f, PaddingBottom = 7f
                    });
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase("Debit", fontArial11Bold))
                    {
                        HorizontalAlignment = 1, PaddingTop = 3f, PaddingBottom = 7f
                    });
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase("Credit", fontArial11Bold))
                    {
                        HorizontalAlignment = 1, PaddingTop = 3f, PaddingBottom = 7f
                    });

                    Decimal totalDebitAmount  = 0;
                    Decimal totalCreditAmount = 0;

                    foreach (var journal in journals)
                    {
                        tableStockTransferItems.AddCell(new PdfPCell(new Phrase(journal.Branch, fontArial11))
                        {
                            HorizontalAlignment = 0, PaddingTop = 3f, PaddingBottom = 7f, PaddingLeft = 5f, PaddingRight = 5f
                        });
                        tableStockTransferItems.AddCell(new PdfPCell(new Phrase(journal.AccountCode, fontArial11))
                        {
                            HorizontalAlignment = 0, PaddingTop = 3f, PaddingBottom = 7f, PaddingLeft = 5f, PaddingRight = 5f
                        });
                        tableStockTransferItems.AddCell(new PdfPCell(new Phrase(journal.Account, fontArial11))
                        {
                            HorizontalAlignment = 0, PaddingTop = 3f, PaddingBottom = 7f, PaddingLeft = 5f, PaddingRight = 5f
                        });
                        tableStockTransferItems.AddCell(new PdfPCell(new Phrase(journal.Article, fontArial11))
                        {
                            HorizontalAlignment = 0, PaddingTop = 3f, PaddingBottom = 7f, PaddingLeft = 5f, PaddingRight = 5f
                        });
                        tableStockTransferItems.AddCell(new PdfPCell(new Phrase(journal.DebitAmount.ToString("#,##0.00"), fontArial11))
                        {
                            HorizontalAlignment = 2, PaddingTop = 3f, PaddingBottom = 7f, PaddingLeft = 5f, PaddingRight = 5f
                        });
                        tableStockTransferItems.AddCell(new PdfPCell(new Phrase(journal.CreditAmount.ToString("#,##0.00"), fontArial11))
                        {
                            HorizontalAlignment = 2, PaddingTop = 3f, PaddingBottom = 7f, PaddingLeft = 5f, PaddingRight = 5f
                        });

                        totalDebitAmount  += journal.DebitAmount;
                        totalCreditAmount += journal.CreditAmount;
                    }

                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase("Total", fontArial11Bold))
                    {
                        Colspan = 4, HorizontalAlignment = 2, PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                    });
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase(totalDebitAmount.ToString("#,##0.00"), fontArial11Bold))
                    {
                        HorizontalAlignment = 2, PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                    });
                    tableStockTransferItems.AddCell(new PdfPCell(new Phrase(totalCreditAmount.ToString("#,##0.00"), fontArial11Bold))
                    {
                        HorizontalAlignment = 2, PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                    });
                    document.Add(tableStockTransferItems);

                    document.Add(spaceTable);
                }

                // ==============
                // User Signature
                // ==============
                PdfPTable tableUsers            = new PdfPTable(3);
                float[]   widthsCellsTableUsers = new float[] { 100f, 100f, 100f };
                tableUsers.WidthPercentage = 100;
                tableUsers.SetWidths(widthsCellsTableUsers);
                tableUsers.AddCell(new PdfPCell(new Phrase("Prepared by", fontArial11Bold))
                {
                    PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase("Checked by", fontArial11Bold))
                {
                    PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase("Approved by", fontArial11Bold))
                {
                    PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase(" "))
                {
                    PaddingBottom = 50f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase(" "))
                {
                    PaddingBottom = 50f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase(" "))
                {
                    PaddingBottom = 50f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase(preparedBy, fontArial11))
                {
                    HorizontalAlignment = 1, PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase(checkedBy, fontArial11))
                {
                    HorizontalAlignment = 1, PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                });
                tableUsers.AddCell(new PdfPCell(new Phrase(approvedBy, fontArial11))
                {
                    HorizontalAlignment = 1, PaddingTop = 5f, PaddingBottom = 9f, PaddingLeft = 5f, PaddingRight = 5f
                });
                document.Add(tableUsers);
            }

            // Document End
            document.Close();

            byte[] byteInfo = workStream.ToArray();
            workStream.Write(byteInfo, 0, byteInfo.Length);
            workStream.Position = 0;

            return(new FileStreamResult(workStream, "application/pdf"));
        }
Beispiel #56
0
 /// <summary>
 /// Provides unique identifier for the given font.
 /// </summary>
 /// <returns>Unique string identifier for the given font</returns>
 /// <param name="font">Font.</param>
 private static string ToHasmapKey(this Font font)
 {
     return(string.Format("{0}.{1}.{2}.{3}", font.FontFamily, font.FontSize, font.NamedSize, (int)font.FontAttributes));
 }
Beispiel #57
0
    // Token: 0x06002911 RID: 10513 RVA: 0x0044C6EC File Offset: 0x0044A8EC
    protected override void Awake()
    {
        this.GM   = GUIManager.Instance;
        this.DM   = DataManager.Instance;
        this.AM   = ActivityManager.Instance;
        this.SM   = StringManager.Instance;
        this.AWM  = this.AM.AllianceWarMgr;
        this.door = (this.GM.FindMenu(EGUIWindow.Door) as Door);
        AssetBundle assetBundle = AssetManager.GetAssetBundle(this.abName, out this.abKey, false);

        if (assetBundle == null)
        {
            return;
        }
        GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(assetBundle.mainAsset);

        if (gameObject == null)
        {
            AssetManager.UnloadAssetBundle(this.abKey, true);
            return;
        }
        gameObject.transform.SetParent(base.transform, false);
        this.m_transform = gameObject.transform;
        this.m_transform.SetAsFirstSibling();
        this.GM.m_ActivityWindow = this;
        this.tmpData             = this.AM.AllianceWarData;
        Font ttffont = this.GM.GetTTFFont();

        this.m_transform.GetChild(7).GetChild(0).GetComponent <UIButton>().m_Handler = this;
        this.m_transform.GetChild(7).GetChild(0).GetComponent <CustomImage>().hander = this;
        this.m_transform.GetChild(7).GetComponent <CustomImage>().hander             = this;
        if (this.GM.bOpenOnIPhoneX)
        {
            this.m_transform.GetChild(7).GetComponent <CustomImage>().enabled = false;
        }
        this.InfoGO = this.m_transform.GetChild(6).gameObject;
        this.InfoGO.AddComponent <ArabicItemTextureRot>();
        this.m_transform.GetChild(6).GetComponent <UIButton>().m_Handler = this;
        this.Title1GO = this.m_transform.GetChild(4).gameObject;
        this.Title2GO = this.m_transform.GetChild(5).gameObject;
        UIText component = this.m_transform.GetChild(4).GetChild(0).GetComponent <UIText>();

        component.font = ttffont;
        component.text = this.DM.mStringTable.GetStringByID(17029u);
        this.rebuildText.Add(component);
        UIButtonHint uibuttonHint = this.m_transform.GetChild(4).GetChild(1).gameObject.AddComponent <UIButtonHint>();

        uibuttonHint.m_eHint    = EUIButtonHint.DownUpHandler;
        uibuttonHint.Parm1      = 0;
        uibuttonHint.ScrollID   = 1;
        uibuttonHint.m_Handler  = this;
        this.TitleRankText      = this.m_transform.GetChild(4).GetChild(1).GetChild(0).GetComponent <UIText>();
        this.TitleRankText.font = ttffont;
        this.TitleRankText.text = this.DM.mStringTable.GetStringByID(17029u);
        this.TitleRankTextStr   = this.SM.SpawnString(30);
        this.rebuildText.Add(this.TitleRankText);
        this.TitleSA1        = this.m_transform.GetChild(4).GetComponent <UISpritesArray>();
        this.TitleSA2        = this.m_transform.GetChild(4).GetChild(1).GetComponent <UISpritesArray>();
        this.Title2Text      = this.m_transform.GetChild(5).GetChild(0).GetComponent <UIText>();
        this.Title2Text.font = ttffont;
        this.rebuildText.Add(this.Title2Text);
        this.TimeGO         = this.m_transform.GetChild(3).gameObject;
        this.TimeSA         = this.m_transform.GetChild(3).GetComponent <UISpritesArray>();
        this.TimeTitle      = this.m_transform.GetChild(3).GetChild(0).GetComponent <UIText>();
        this.TimeTitle.font = ttffont;
        this.rebuildText.Add(this.TimeTitle);
        this.TimeText      = this.m_transform.GetChild(3).GetChild(1).GetComponent <UIText>();
        this.TimeText.font = ttffont;
        this.rebuildText.Add(this.TimeText);
        this.TimeTitle2      = this.m_transform.GetChild(3).GetChild(2).GetComponent <UIText>();
        this.TimeTitle2.font = ttffont;
        this.rebuildText.Add(this.TimeTitle2);
        this.TimeTitle2.enabled = false;
        this.TimeTitle2.gameObject.SetActive(true);
        this.TimeStr = this.SM.SpawnString(30);
        this.SetTimeTitle();
        this.SetTimeStr();
    }
Beispiel #58
0
        public static void printchinesechar(string ch, System.Drawing.Printing.PrintPageEventArgs e, float x, float y)
        {
            float cInter   = 5F;
            float eInter   = 2.6F;
            Brush ptBrush  = Brushes.Black;
            Font  ptFontCn = new Font("TEC", 18.5F, System.Drawing.FontStyle.Regular);
            Font  ptFontEn = null;

            if (EagleAPI2.ExistFont("MingLiU"))
            {
                ptFontEn = new Font("MingLiU", 11.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("楷体_GB2312"))
            {
                ptFontEn = new Font("楷体_GB2312", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("Courier New"))
            {
                ptFontEn = new Font("Courier New", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("Courier"))
            {
                ptFontEn = new Font("Courier", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else
            {
                ptFontEn = new Font("System", 12.0F, System.Drawing.FontStyle.Regular);
            }
            Font ptFontNo = null;

            if (EagleAPI2.ExistFont("MingLiU"))
            {
                ptFontNo = new Font("MingLiU", 11.0F, System.Drawing.FontStyle.Regular);
            }

            ptFontEn = new Font("TEC", 18.0F, System.Drawing.FontStyle.Regular);
            ptFontNo = new Font("TEC", 18.0F, System.Drawing.FontStyle.Regular);

            if (ch.CompareTo("zzzzzzzzzzzzzzz") > 0)
            {
                string lkxm = ch;
                float  xpos = x;
                for (int i = 0; i < lkxm.Length; i++)
                {
                    if (lkxm[i] > 'z')
                    {
                        e.Graphics.DrawString(lkxm[i].ToString(), ptFontCn, ptBrush, xpos, y);//Z文
                        xpos += cInter;
                    }
                    else
                    {
                        e.Graphics.DrawString(lkxm[i].ToString(), ptFontEn, ptBrush, xpos, y + 2.5F - 1F);//E文  -1F为TEC字体
                        xpos += eInter;
                    }
                }
            }
            else
            {
                e.Graphics.DrawString(ch, ptFontEn, ptBrush, x, y);
            }
        }
 public static void DrawShadowText(string stext, int x, int y, Color color, Font f)
 {
     f.DrawText(null, stext, x + 1, y + 1, Color.Black);
     f.DrawText(null, stext, x, y, color);
 }
Beispiel #60
0
    // Token: 0x06002913 RID: 10515 RVA: 0x0044CC34 File Offset: 0x0044AE34
    public void Initial(e_ActivityType Type, IActivityWindow handler)
    {
        this.WindowType = Type;
        this.m_handler  = handler;
        Font ttffont = this.GM.GetTTFFont();

        if (Type == e_ActivityType.SignUp)
        {
            Transform child = this.m_transform.GetChild(8);
            child.gameObject.SetActive(true);
            UIButtonHint uibuttonHint = child.GetChild(0).gameObject.AddComponent <UIButtonHint>();
            uibuttonHint.m_eHint   = EUIButtonHint.DownUpHandler;
            uibuttonHint.Parm1     = 1;
            uibuttonHint.ScrollID  = 1;
            uibuttonHint.m_Handler = this;
            this.Check1GO          = child.GetChild(1).gameObject;
            child.GetChild(1).gameObject.AddComponent <ArabicItemTextureRot>();
            this.Check2GO = child.GetChild(2).gameObject;
            child.GetChild(2).gameObject.AddComponent <ArabicItemTextureRot>();
            UIText component = child.GetChild(1).GetChild(0).GetComponent <UIText>();
            component.font = ttffont;
            component.text = this.DM.mStringTable.GetStringByID(17004u);
            this.rebuildText.Add(component);
            component      = child.GetChild(2).GetChild(0).GetComponent <UIText>();
            component.font = ttffont;
            component.text = this.DM.mStringTable.GetStringByID(17032u);
            this.rebuildText.Add(component);
            this.MessageText1      = child.GetChild(3).GetComponent <UIText>();
            this.MessageText1.font = ttffont;
            this.MessageText1Str   = this.SM.SpawnString(150);
            this.rebuildText.Add(this.MessageText1);
            this.MessageText2      = child.GetChild(4).GetComponent <UIText>();
            this.MessageText2.font = ttffont;
            this.MessageText2Str   = this.SM.SpawnString(150);
            this.rebuildText.Add(this.MessageText2);
            this.SignUpCount      = child.GetChild(5).GetComponent <UIText>();
            this.SignUpCount.font = ttffont;
            this.SignUpCountStr   = this.SM.SpawnString(30);
            this.rebuildText.Add(this.SignUpCount);
        }
        else if (Type == e_ActivityType.Run || Type == e_ActivityType.RunFail)
        {
            Transform child = this.m_transform.GetChild(9);
            child.gameObject.SetActive(true);
            this.MyNoText      = child.GetChild(2).GetComponent <UIText>();
            this.MyNoText.font = ttffont;
            this.MyNoTextStr   = this.SM.SpawnString(100);
            this.rebuildText.Add(this.MyNoText);
            this.StageText      = child.GetChild(3).GetComponent <UIText>();
            this.StageText.font = ttffont;
            this.rebuildText.Add(this.StageText);
            this.FTimeText      = child.GetChild(4).GetComponent <UIText>();
            this.FTimeText.font = ttffont;
            this.rebuildText.Add(this.FTimeText);
            this.FTimeTextStr = this.SM.SpawnString(100);
            this.BtnGO        = child.GetChild(5).gameObject;
            child.GetChild(5).GetComponent <UIButton>().m_Handler = this;
            this.Review1GO       = child.GetChild(6).gameObject;
            this.Review2GO       = child.GetChild(7).gameObject;
            this.ReviewText      = child.GetChild(8).GetComponent <UIText>();
            this.ReviewText.font = ttffont;
            this.rebuildText.Add(this.ReviewText);
            if (Type != e_ActivityType.RunFail)
            {
                if (this.AWM.bReplaying)
                {
                    this.m_transform.GetChild(1).gameObject.SetActive(false);
                    this.m_transform.GetChild(2).gameObject.SetActive(false);
                    this.InfoGO.SetActive(false);
                    this.TimeGO.SetActive(false);
                    this.BtnGO.SetActive(false);
                    this.Title1GO.SetActive(false);
                    this.Title2GO.SetActive(true);
                    this.Review1GO.SetActive(true);
                    this.Review2GO.SetActive(false);
                    this.Title2Text.text = this.DM.mStringTable.GetStringByID(14635u);
                    this.ReviewText.text = this.DM.mStringTable.GetStringByID(14616u);
                    this.ReviewText.gameObject.SetActive(true);
                }
                else if (this.AWM.MyAllySide == 0)
                {
                    this.m_transform.GetChild(1).gameObject.SetActive(false);
                    this.m_transform.GetChild(2).gameObject.SetActive(false);
                    this.InfoGO.SetActive(false);
                    this.TimeGO.SetActive(false);
                    this.BtnGO.SetActive(false);
                    this.Title1GO.SetActive(false);
                    this.Title2GO.SetActive(true);
                    this.Review1GO.SetActive(false);
                    this.Review2GO.SetActive(true);
                    this.Title2Text.text = this.DM.mStringTable.GetStringByID(14614u);
                    this.ReviewText.text = this.DM.mStringTable.GetStringByID(14615u);
                    this.ReviewText.gameObject.SetActive(true);
                }
            }
        }
        else if (Type == e_ActivityType.Ranking)
        {
            Transform child = this.m_transform.GetChild(10);
            child.gameObject.SetActive(true);
            this.No1Text      = child.GetChild(0).GetComponent <UIText>();
            this.No1Text.font = ttffont;
            this.No1TextStr   = this.SM.SpawnString(100);
            this.rebuildText.Add(this.No1Text);
            this.No2Text      = child.GetChild(1).GetComponent <UIText>();
            this.No2Text.font = ttffont;
            this.No2TextStr   = this.SM.SpawnString(100);
            this.rebuildText.Add(this.No2Text);
            this.SBtnGO = child.GetChild(2).gameObject;
            child.GetChild(2).GetComponent <UIButton>().m_Handler = this;
        }
        this.SetTitleRank();
        this.SetTopText();
    }