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


C# Font.SetColor方法代码示例

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


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

示例1: Prepare_Print

    protected void Prepare_Print()
    {
        String[] weekDays = new String[] { " ","Sun", "Mon", "Tue", "Wed", "Thu" };
        int[] sessions = new int[] {0,1,2,3,4,5,6,7,8,9};
        PdfPTable tblSchedule = new PdfPTable(10);
        PdfPRow[] tempRow = new PdfPRow[6];
        PdfPCell[][] tempCell = new PdfPCell[6][];
        int rowIndex = 0;
        int cellIndex = 0;
        Paragraph subject = new Paragraph();
        Paragraph teacher = new Paragraph();
        Paragraph lunch = new Paragraph();
        Paragraph dayPara = new Paragraph();
        Paragraph sessionPara = new Paragraph();
        Paragraph teacherPara = new Paragraph();

        Font lunch_font = new Font();
        Font day_session_para = new Font();
        Font session_font = new Font();
        Font teacher_font = new Font();

        session_font.Size = 10;
        teacher_font.SetStyle("Italics");
        teacher_font.Size = 7;

        lunch_font.SetColor(153, 153, 255);
        lunch_font.SetStyle("italics");
        lunch = new Paragraph("Lunch", lunch_font);

        day_session_para.SetColor(0, 0, 153);

        foreach (String weekDay in weekDays)
        {
            tempCell[rowIndex] = new PdfPCell[10];
            tempRow[rowIndex] = new PdfPRow(tempCell[rowIndex]);
            foreach (int session in sessions)
            {
                if (session == 0 || session == 6)
                {
                    if (session == 0)
                    {
                        dayPara = new Paragraph(weekDays[rowIndex],day_session_para);
                        tempCell[rowIndex][cellIndex] = new PdfPCell(dayPara);
                    }
                    else
                        if (weekDay != " ")
                        {
                            tempCell[rowIndex][cellIndex] = new PdfPCell(lunch);
                        }
                        else
                        {
                            //tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(Convert.ToString(sessions[cellIndex])));
                            dayPara = new Paragraph(Convert.ToString(sessions[cellIndex]), day_session_para);
                            tempCell[rowIndex][cellIndex] = new PdfPCell(dayPara);
                        }
                }
                else
                {
                    if (weekDay == " ")
                    {
                        dayPara = new Paragraph(Convert.ToString(sessions[cellIndex]), day_session_para);
                        tempCell[rowIndex][cellIndex] = new PdfPCell(dayPara);
                        //tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(Convert.ToString(sessions[cellIndex])));
                    }
                    else
                    {
                        string query = "select B.CourseTitle,A.TeacherID from tblStudentCourseMap as A,tblCourses as B where A.ComCod = B.ComCod and A.DaySession = '" + weekDay + session + "' and A.StudentID = '" + Current_User_ID + "'";
                        myCon.ConOpen();
                        SqlDataReader sessionDet = myCon.ExecuteReader(query);

                        if (sessionDet.Read())
                            if (!sessionDet.IsDBNull(0))
                            {
                                sessionPara = new Paragraph(sessionDet.GetString(0), session_font);
                                //tempCell[rowIndex][cellIndex] = new PdfPCell(sessionPara);
                                teacherPara = new Paragraph(sessionDet.GetString(1), teacher_font);
                                tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(sessionPara));
                                tempCell[rowIndex][cellIndex].Phrase.Add(new Phrase("\n"));
                                tempCell[rowIndex][cellIndex].Phrase.Add(teacherPara);
                                //tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(sessionDet.GetString(0) + "\n" + sessionDet.GetString(1)));
                            }
                            else
                            {
                                tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(""));
                                //tempCell[rowIndex][cellIndex
                            }
                        else
                            tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(""));
                        myCon.ConClose();
                        tempCell[rowIndex][cellIndex].FixedHeight = 75;
                    }

                }

                //tempCell[rowIndex][cellIndex].Width = 50;
                cellIndex++;
                //tempRow[rowIndex].Cells.Add(tempCell[cellIndex++, rowIndex]);
            }
            cellIndex = 0;
            //rowIndex++;
//.........这里部分代码省略.........
开发者ID:kannan4355,项目名称:TimeTableManagementSystem,代码行数:101,代码来源:StudentHome.aspx.cs


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