public static String[,] AlignString(String[,] Data, String[] Filler,int[] columnSpace , Font Font)
        {
            int NRow = Data.GetLength(0);
            int NCol = Data.GetLength(1);
            String[,] result = new String[NRow, NCol];

            System.Windows.Forms.Button aButton = new System.Windows.Forms.Button();
            Graphics G = aButton.CreateGraphics();
            System.Drawing.StringFormat sf = System.Drawing.StringFormat.GenericTypographic;
            sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;

            for (int j = 0; j < NCol; j++)
            {
                //計算此欄字串的最大長度
                SizeF maxSize = G.MeasureString(Data[0, j], Font, 0, sf);
                for (int i = 1; i < NRow; i++)
                {
                    SizeF sizeF = G.MeasureString(Data[i, j], Font, 0, sf);
                    if (sizeF.Width > maxSize.Width)
                        maxSize = sizeF;
                }

                SizeF fillerSizeF = G.MeasureString(Filler[j], Font, 0, sf);
                SizeF ColSize = new SizeF(maxSize.Width + fillerSizeF.Width * columnSpace[j], maxSize.Height);

                for (int i = 0; i < NRow; i++)
                {
                    result[i, j] = Data[i, j];
                    while (G.MeasureString(result[i, j], Font, 0, sf).Width < ColSize.Width)
                        result[i, j] += Filler[j];
                }
            }

            return result;
        }
        /// <summary>
        /// Kreiranje "tablice" ocjena na temelju proslijeđene string matrice.
        /// </summary>
        /// <param name="matrix"></param>
        public void CreateGrid(String[,] matrix)
        {
            contentGrid.ColumnDefinitions.Clear();
            contentGrid.RowDefinitions.Clear();
            contentGrid.Children.Clear();

            int height = 50;
            while (height * (matrix.GetLength(0) + 1) > contentGrid.Height)
                height--;

            for (int i = 0; i < matrix.GetLength(0); i++) {
                RowDefinition rowDef = new RowDefinition();
                rowDef.Height = new GridLength(height);
                contentGrid.RowDefinitions.Add(rowDef);

                for (int j = 0; j < matrix.GetLength(1); j++) {
                    ColumnDefinition columnDef = new ColumnDefinition();
                    columnDef.Width = new GridLength(j == 0 ? 150 : (contentGrid.Width / (matrix.GetLength(1) + 2)));
                    contentGrid.ColumnDefinitions.Add(columnDef);

                    Label label = new Label();
                    if (i == 0 || j == 0)
                        label.FontWeight = FontWeights.Bold;

                    Grid.SetRow(label, i);
                    Grid.SetColumn(label, j);
                    label.Content = matrix[i, j];
                    contentGrid.Children.Add(label);
                }//for 2
            }
        }
Exemple #3
0
 /// <summary>
 /// Schreibt die Daten in "data" in die Datei "file"
 /// </summary>
 /// <example>
 /// <code>
 /// 
 /// String[,] data = new String[2, 2];
 /// for (int i = 0; i < data.GetLength(0); i++)
 ///     for (int j = 0; j < data.GetLength(1); j++)
 ///         data[i, j] = i + "_" + j;
 /// CSV.write(data, "test.csv");
 /// 
 /// </code>
 /// Schreibt folgende Matrix in die Datei "test.csv"
 /// 
 /// 0_0 0_1
 /// 1_0 1_1
 /// </example>
 public static void write(String[,] data, String file)
 {
     StreamWriter sw = new StreamWriter(@file);
     for (int i = 0; i < data.GetLength(0); i++) {
         for (int j = 0; j < data.GetLength(1); j++) {
             sw.Write(data[i, j] + ";");
         }
         sw.Write("\n");
     }
     sw.Close();
 }
 public static void DisplayBoard(String[,] gameBoard)
 {
     for (int i = 0; i < gameBoard.GetLength(0); i++)
     {
         for (int j = 0; j < gameBoard.GetLength(1); j++)
         {
             Console.Write(" " + gameBoard[i, j] + " ");
         }
         Console.WriteLine("");
     }
 }
Exemple #5
0
        /// <summary>
        /// Erzeugt eine RGBMap(string[x,y]="255,255,255") aus einer PixelMap(byte[x,y,rgba]=0-255).
        /// </summary>
        public static string[,] GetRGBMapFromPixelMap(byte[, ,] pPixelMap)
        {
            string[,] TmpRGBMap = new String[pPixelMap.GetLength(0),pPixelMap.GetLength(1)];
            for (int i = 0; i < TmpRGBMap.GetLength(0); i++)
            {
                for (int t = 0; t < TmpRGBMap.GetLength(1); t++)
                {
                    TmpRGBMap[i,t] = pPixelMap[i, t, 0].ToString() + "," + pPixelMap[i, t, 1].ToString() + "," + pPixelMap[i, t, 2].ToString();
                }

            }
            return TmpRGBMap;
        }
        public void TestIntialBoardElems()
        {
            Game game = new Game();
            String[,] gameBoard = new String[4,4];

            for (int i = 0; i < gameBoard.GetLength(0); i++)
            {
                for (int j = 0; j < gameBoard.GetLength(1); j++)
                {
                    Debug.Write(" " + gameBoard[i, j] + " ");
                }
                Debug.WriteLine("");
            }
        }
Exemple #7
0
        //reads a CSV into a String[,]
        public static String[,] readCSV(string s)
        {
            String[] lines = File.ReadAllLines(s);
            String[,] vals = new String[lines.Length, lines[0].Split(',').Length];
            for (int i = 0; i < vals.GetLength(0); i++)
            {
                String[] thisLine = lines[i].Split(',');
                for (int j = 0; j < vals.GetLength(1); j++)
                {
                    vals[i, j] = thisLine[j];
                }
            }

            return vals;
        }
Exemple #8
0
        public String[,] getRange(int startrow, int startcol, int endrow, int endcol)
        {
            String[,] data = new String[endrow - startrow + 1, endcol - startcol + 1];

                for (int i = 0; i < data.GetLength(0); i++)
                {
                    for (int j = 0; j < data.GetLength(1); j++)
                    {
                        data[i, j] = (((Range)xlWorksheet.Cells[i + startrow, j + startcol]).Value2 != null
                                    ? ((Range)xlWorksheet.Cells[i + startrow, j + startcol]).Value2.ToString()
                                    : "");
                    }
                }
            return data;
        }
        public MapItem[,] createMapItemList(String[,] map)
        {
            int size = map.GetLength(0);
            MapItem[,] itList = new MapItem[size, size];
            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    itList[j, i] = new MapItem();
                    /*if (new String[] { MapItem.BLANK, MapItem.COIN, MapItem.LIFEPACK }.Contains(map[j, i], StringComparer.Ordinal))
                        itList[j, i].Contain = MapItem.BLANK;
                    else
                        itList[j, i].Contain = MapItem.STONE;*/
                    itList[j, i].Contain = map[j, i];
                    if (DecodeOperations.playerDir.Contains(map[j, i],StringComparer.Ordinal))
                    {
                        itList[j, i].Dir = Array.FindIndex(DecodeOperations.playerDir, pl => pl.Contains(map[j, i]));
                    }

                    itList[j, i].Name = i.ToString() + "," + j.ToString();
                    itList[j, i].Pre = null;
                    itList[j, i].Dis = Int32.MaxValue - 1;
                }
            }
            return itList;
        }
Exemple #10
0
        private void BorrowBook_Load(object sender, EventArgs e)
        {
            bookDetail.Rows.Clear();
            string[,] book = new String[DBCommand.countRow(), 10];
            try
            {
                book = DBCommand.searchBook("", "", "", "", "", "", "");
                for (int i = 0; i < book.GetLength(0); i++)
                {
                    bookDetail.Rows.Add();
                    for (int j = 0; j < 10; j++)
                    {
                        bookDetail.Rows[i].Cells[j].Value = book[i, j];
                    }
                }

            }
            catch (FileLoadException e2)
            {
                Console.WriteLine(e2);
                bookDetail.Rows.Add();
                for (int j = 0; j < 10; j++)
                {
                    bookDetail.Rows[0].Cells[j].Value = "N/A";
                }
            }
        }
Exemple #11
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            bookDetail.Rows.Clear();
            String[,] book = new String[DBCommand.countRow(), 10];
            try
            {
                book = DBCommand.searchBook(nameField.Text, "", writerField.Text, "", "", publishedYrBox.Text, "");
                for (int i = 0; i < book.GetLength(0); i++)
                {
                    bookDetail.Rows.Add();
                    for (int j = 0; j < 10; j++)
                    {
                        bookDetail.Rows[i].Cells[j].Value = book[i, j];
                    }
                }

            }
            catch (FileLoadException e2)
            {
                Console.WriteLine(e2);
                bookDetail.Rows.Add();
                for (int j = 0; j < 10; j++)
                {
                    bookDetail.Rows[0].Cells[j].Value = "N/A";
                }
            }
        }
        public void TestMergeDown()
        {
            Game game = new Game();
            String[,] gameBoard = new String[4, 4] { { "0", "0", "0", "0" },
                                                     { "0", "2", "4", "4" },
                                                     { "0", "4", "2", "2" },
                                                     { "0", "8", "4", "8" }};

            gameBoard = game.MoveDown(gameBoard);

            for (int i = 0; i < gameBoard.GetLength(0); i++)
            {
                for (int j = 0; j < gameBoard.GetLength(1); j++)
                {
                    Debug.Write(" " + gameBoard[i, j] + " ");
                }
                Debug.WriteLine("");
            }
        }
        public static void Main(String[] args)
        {
            if (args.GetLength(0) < 1)
            {
                usage();
                return;
            }
            int argi = 0;
            bool quiet = false;
            if (args[argi] == "-q")
            {
                quiet = true;
                argi++;
            }

            if (argi == args.GetLength(0))
            {
                usage();
                return;
            }

            String url = args[argi];

            if (!quiet)
                Console.WriteLine("Loading Schema: " + url);

            if (argi < (args.GetLength(0) - 1))
            {
                if (!quiet)
                    Console.WriteLine("Outputing to file: " + args[argi + 1]);

                StreamWriter output =
               new StreamWriter(new FileStream(args[argi + 1], FileMode.Create));

                NormalizeXmlSchema(url, output);
            }
            else
            {
                NormalizeXmlSchema(url, Console.Out);
            }
        }
Exemple #14
0
		public static int Execute(String[] args)
		{
			HttpServer httpServer;
			if (args.GetLength(0) > 0)
			{
				httpServer = new MyHttpServer(IPAddress.Any, Convert.ToInt16(args[0]));
			}
			else
			{
				httpServer = new MyHttpServer(IPAddress.Any, 8080);
			}
			Thread thread = new Thread(new ThreadStart(httpServer.Listen));
			thread.Start();
			return 0;
		}
 public static int Main(String[] args)
 {
     HttpServer httpServer;
     if (args.GetLength(0) > 0)
     {
         httpServer = new MyHttpServer(Convert.ToInt16(args[0]));
     }
     else
     {
         httpServer = new MyHttpServer(8080);
     }
     Thread thread = new Thread(new ThreadStart(httpServer.listen));
     thread.Start();
     return 0;
 }
        public void TestGenerateNewBoardSquare()
        {
            Game game = new Game();
            String[,] gameBoard = new String[4, 4] { { "4", "2", "4", "2" },
                                                     { "0", "0", "0", "0" },
                                                     { "2", "0", "2", "0" },
                                                     { "2", "2", "2", "0" }};

            String[,] gameBoard2 = new String[4, 4] { { "4", "2", "4", "2" },
                                                      { "2", "2", "2", "0" },
                                                      { "2", "2", "2", "2" },
                                                      { "2", "2", "2", "2" }};

            game.GenerateNewSquareElement(gameBoard2);

            for (int i = 0; i < gameBoard2.GetLength(0); i++)
            {
                for (int j = 0; j < gameBoard2.GetLength(1); j++)
                {
                    Debug.Write(" " + gameBoard2[i, j] + " ");
                }
                Debug.WriteLine("");
            }
        }
Exemple #17
0
        //create basic visual pattern
        public static String[,] DrawBoard()
        {
            String[,] f = new String[7, 15];

            //Loop over each row from up to down
            for (int i = 0; i < f.GetLength(0); i++)
            {
                for (int j = 0; j < f.GetLength(1); j++)
                {
                    if (j % 2 == 0) f[i, j] = "|";
                    else f[i, j] = " ";
                    //now make the lowest row
                    if (i == 6) f[i, j] = "-";
                }
            }
            return f;
        }
Exemple #18
0
        public MenuScreen(ScreenManager sm ,String[] items, Action[] funcs)
            : base(sm)
        {
            menuItems = new List<MenuItem>();
            curSelection = 0;

            // Default
            if (items == null) items = new string[] { "Back" };
            if (funcs == null) funcs = new Action[] { MenuItemFunctions.BackToGame };

            for (int i = 0; i < items.GetLength(0); i++)
                menuItems.Add(new MenuItem(this, items[i], funcs[i], MenuItem.MenuItemAlignment.Center));

            if (menuItems.Count == 0) {
                Console.WriteLine("Tried to make a menu screen with no items!");
                Environment.Exit(1);
            }
        }
Exemple #19
0
        public static int Main(String[] args)
        {
            Console.BackgroundColor = ConsoleColor.White;
            Console.Clear();
            int port = 4456;
            Console.Title = "FBRPan - Emulator Panel";
            Console.ForegroundColor = ConsoleColor.Black;
            Console.WriteLine("");
            Console.WriteLine(@"        .--------.  .--------.    .--------.                                   ");
            Console.WriteLine(@"        : .------´  : .-----. :   : .-----. :                                  ");
            Console.WriteLine(@"        : `------.  : :_____: ;   : :_____: ;   .-----. .-----. .-.  .-.       ");
            Console.WriteLine(@"        : .------´  : .-----.´    : .-.  .-´    : .-. : : .-. : :  \ : :       ");
            Console.WriteLine(@"        : :         : :_____:`:   : :  \  \     : `-´ ; : `-´ : : \ `´ :       ");
            Console.WriteLine(@"        :_:         :________ :   :_:    \ _\   :_:¨¨´  :_:¨:_: :_:  :_:        ");
            Console.BackgroundColor = ConsoleColor.Black;

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(@"                             Developed by FilipeBR                              ");
            Console.ForegroundColor = ConsoleColor.Black;
            Console.BackgroundColor = ConsoleColor.White;
            Console.WriteLine("> Starting...");
            HttpServer httpServer;
            if (args.GetLength(0) > 0)
            {
                httpServer = new MyHttpServer(Convert.ToInt16(args[0]));
            }
            else
            {
                httpServer = new MyHttpServer(port);
            }
            Thread thread = new Thread(new ThreadStart(httpServer.listen));
            thread.Start();
            Console.WriteLine("> Started");
            Console.WriteLine("> Running on port {0}", port);
            Console.Title = Console.Title + " - Runnig on port " + port;
            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Black;
                MyHttpServer.HandleCommand(Console.ReadLine());
            }
        }
Exemple #20
0
 /// <summary>
 /// search a pattern in a text 
 /// </summary>
 /// <param name="Source">text where looking for</param>
 /// <param name="Pattern">pattern to look for</param>
 /// <param name="Optionen">Optionen</param>
 /// <returns>array of result</returns>
 public static String[,] Search(this String Source, String Pattern, RegexOptions Optionen = RegexOptions.None)
 {
     if (!Regex.IsMatch(Source, Pattern, Optionen)) return null;
     MatchCollection aMatch = Regex.Matches(Source, Pattern, Optionen);
     String[,] RetString = new String[aMatch.Count, aMatch[0].Groups.Count - 1];
     Int32 i = 0;
     Int32 ii = 0;
     foreach (Match bMatch in aMatch)
     {
         do
         {
             RetString[i, ii] = bMatch.Groups[ii + 1].Value;
             if (ii != RetString.GetLength(1))
             {
                 ii++;
             }
         } while (ii < bMatch.Groups.Count - 1);
         ii = 0;
         i++;
     }
     return RetString;
 }
        public static DataTable convertArrayToDataTable(String[,] array, List<String> columnNames)
        {
            DataTable table = new DataTable();
            int rows = array.GetLength(0);

            foreach (String columnName in columnNames)
            {
                table.Columns.Add(columnName);
            }

            for (int outerIndex = 0; outerIndex < rows; outerIndex++)
            {
                DataRow newRow = table.NewRow();
                for (int innerIndex = 0; innerIndex < columnNames.Count; innerIndex++)
                {
                    newRow[innerIndex] = array[outerIndex, innerIndex];
                }
                table.Rows.Add(newRow);
            }

            return table;
        }
Exemple #22
0
        /// <summary>
        /// Создание символьной таблицы из массива, соответствующего таблице Excel
        /// </summary>
        /// <param name="arr">Символьная таблица в виде массива массива строк [4,xxx]</param>
        public cSymbolTable(String[,] arr)
        {
            Symbols = new ObservableCollection<mSymbolTableItem>();

               string s =  arr[1,1];

               for (int row = 0; row < arr.GetLength(0); row++)
            {
               mSymbolTableItem item = new mSymbolTableItem();

               item.SignalName = arr[row, 0];
               item.SignalAdress = arr[row, 1];
               item.SignalDataType = arr[row, 2];
               item.SignalComment = arr[row, 3];
               item.SignalType = arr[row, 4];
               item.Codename = arr[row,5];
               item.SystemNumber = arr[row, 6];
               item.DeviceType = arr[row, 7];
               item.DeviceNumber = arr[row, 8];
               item.Etc = arr[row,9];
               item.DeviceTag = arr[row, 10];

               item.DB_FullName = item.SystemNumber;

               try
               {
                   item.DB_ArrayIndex = int.Parse(arr[row, 8]);
               }
               catch (Exception e)
               {
                   item.DB_ArrayIndex = 0;
               }

               Symbols.Add(item);
            }
        }
Exemple #23
0
        public void printArrayToSheetTemplate(String[,] arr, string sheetName)
        {
            if ( (excelbook != null) & (arr.GetLength(0) > 0) )
            {
                Excel.Worksheet destSheet = null;

                //----- Добавление листа на базе шаблона
                if (!(isSheetExist(sheetName)))
                {
                    destSheet = excelbook.Worksheets.get_Item("template");
                    destSheet.Copy(excelbook.Worksheets.get_Item("template"));
                    destSheet = excelbook.Worksheets.get_Item("template (2)");
                    destSheet.Name = sheetName;
                }
                else destSheet = excelbook.Worksheets.get_Item(sheetName);
                destSheet.Select();
                destSheet.UsedRange.Clear();

                Excel.Range rng = destSheet.get_Range("A1", System.Reflection.Missing.Value).get_Resize(arr.GetLength(0), arr.GetLength(1));
                rng.set_Value(System.Reflection.Missing.Value, arr);

                OnReportMessage("Выгружены данные в лист " + sheetName);
            }
        }
Exemple #24
0
 protected static PdfArray ProcessOptions(String[,] options) {
     PdfArray array = new PdfArray();
     for (int k = 0; k < options.GetLength(0); ++k) {
         PdfArray ar2 = new PdfArray(new PdfString(options[k, 0], PdfObject.TEXT_UNICODE));
         ar2.Add(new PdfString(options[k, 1], PdfObject.TEXT_UNICODE));
         array.Add(ar2);
     }
     return array;
 }
        /// <summary>
        /// Polje 3D matrica: [1] naziv tablice za spajanje, [2] vanjski ključ, [2] ključ u tablici za spajanje
        /// Join('users u', 't.user_id', 'u.id')
        /// <param name="joinParams"></param>
        /// <returns></returns>
        public StatementBuilder Join(String[,] joinParams)
        {
            if (joinParams.GetLength(1) != 3)
                throw new StatementBuilderException("Each array must be 3 of lenght");

            List<String> aliasesList = new List<String>();

            for (int i = 0; i < joinParams.GetLength(0); i++) {
                String[] parts = joinParams[i, 0].Split(' ');
                if (parts.Length != 2)
                    throw new StatementBuilderException("Join statement doesn't contain aliases");
                aliasesList.Add(parts[1]);
                selectStatement.Append("JOIN " + joinParams[i, 0] + " ON " + joinParams[i, 1] + " = " + joinParams[i, 2] + " ");
            }

            tableAlias = FindTableAlias(aliasesList);
            AddTableAlias(tableAlias);

            isJoined = true;

            return this;
        }
        public void TestShiftUp()
        {
            Game game = new Game();
            String[,] gameBoard = new String[4, 4] { { "0", "0", "2", "4" },
                                                     { "4", "2", "0", "0" },
                                                     { "2", "2", "4", "0" },
                                                     { "2", "0", "4", "0" }};

            gameBoard = game.ShiftElementsUp(gameBoard);

            for (int i = 0; i < gameBoard.GetLength(0); i++)
            {
                for (int j = 0; j < gameBoard.GetLength(1); j++)
                {
                    Debug.Write(" " + gameBoard[i, j] + " ");
                }
                Debug.WriteLine("");
            }
        }
Exemple #27
0
 public String[,] parseConfig()
 {
     if (File.Exists(CONFIGFILE))
     {
         using (StreamReader configFile = new StreamReader(CONFIGFILE))
         {
             String raw = configFile.ReadToEnd();
             String[] pre = raw.Split('\n');
             String[,] config = new String[pre.Length, 2];
             for (int i = 0; i < config.GetLength(0); i++)
             {
                 config[i, 0] = pre[i].Split('=')[0];
                 config[i, 1] = pre[i].Split('=')[1];
             }
             for (int i = 0; i < config.GetLength(0); i++)
             {
                 listView1.Items.Add(config[i, 0] + "=" + config[i, 1]);
             }
             return config;
         }
     }
     else
     {
         say("Config doesn't exist, creating a default...");
         say("Creating config...");
         using (StreamWriter configFile = File.CreateText(CONFIGFILE))
         {
             configFile.WriteLine("file=C:\\Sample\\Todo\\File.txt");
             configFile.WriteLine("pypath=C:\\Path\\To\\Python27\\Python.exe");
             configFile.WriteLine("ipath=C:\\Path\\To\\GTasks\\Interface.py");
         }
         say("Created config, please customize it and press refresh to continue");
         return null;
     }
 }
Exemple #28
0
 protected PdfFormField GetChoiceField(bool isList) {
     options &= (~MULTILINE) & (~COMB);
     String[] uchoices = choices;
     if (uchoices == null)
         uchoices = new String[0];
     int topChoice = GetTopChoice();
     if (text == null)
         text = ""; //fixed by Kazuya Ujihara (ujihara.jp)
     if (topChoice >= 0)
         text = uchoices[topChoice];
     PdfFormField field = null;
     String[,] mix = null;
     if (choiceExports == null) {
         if (isList)
             field = PdfFormField.CreateList(writer, uchoices, topChoice);
         else
             field = PdfFormField.CreateCombo(writer, (options & EDIT) != 0, uchoices, topChoice);
     }
     else {
         mix = new String[uchoices.Length, 2];
         for (int k = 0; k < mix.GetLength(0); ++k)
             mix[k, 0] = mix[k, 1] = uchoices[k];
         int top = Math.Min(uchoices.Length, choiceExports.Length);
         for (int k = 0; k < top; ++k) {
             if (choiceExports[k] != null)
                 mix[k, 0] = choiceExports[k];
         }
         if (isList)
             field = PdfFormField.CreateList(writer, mix, topChoice);
         else
             field = PdfFormField.CreateCombo(writer, (options & EDIT) != 0, mix, topChoice);
     }
     field.SetWidget(box, PdfAnnotation.HIGHLIGHT_INVERT);
     if (rotation != 0)
         field.MKRotation = rotation;
     if (fieldName != null) {
         field.FieldName = fieldName;
         if (uchoices.Length > 0) {
             if (mix != null) {
                 if (choiceSelections.Count < 2) {
                     field.ValueAsString = mix[topChoice,0];
                     field.DefaultValueAsString = mix[topChoice,0];
                 } else {
                     WriteMultipleValues( field, mix);
                 }
             } else {
                 if (choiceSelections.Count < 2) {
                     field.ValueAsString = text;
                     field.DefaultValueAsString = text;
                 } else {
                     WriteMultipleValues( field, null );
                 }
             }
         }
         if ((options & READ_ONLY) != 0)
             field.SetFieldFlags(PdfFormField.FF_READ_ONLY);
         if ((options & REQUIRED) != 0)
             field.SetFieldFlags(PdfFormField.FF_REQUIRED);
         if ((options & DO_NOT_SPELL_CHECK) != 0)
             field.SetFieldFlags(PdfFormField.FF_DONOTSPELLCHECK);
         if ((options & MULTISELECT) != 0) {
             field.SetFieldFlags( PdfFormField.FF_MULTISELECT );
         }
     }
     field.BorderStyle = new PdfBorderDictionary(borderWidth, borderStyle, new PdfDashPattern(3));
     PdfAppearance tp;
     if (isList) {
         tp = GetListAppearance();
         if (topFirst > 0)
             field.Put(PdfName.TI, new PdfNumber(topFirst));
     }
     else
         tp = GetAppearance();
     field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
     PdfAppearance da = (PdfAppearance)tp.Duplicate;
     da.SetFontAndSize(RealFont, fontSize);
     if (textColor == null)
         da.SetGrayFill(0);
     else
         da.SetColorFill(textColor);
     field.DefaultAppearanceString = da;
     if (borderColor != null)
         field.MKBorderColor = borderColor;
     if (backgroundColor != null)
         field.MKBackgroundColor = backgroundColor;
     switch (visibility) {
         case HIDDEN:
             field.Flags = PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_HIDDEN;
             break;
         case VISIBLE_BUT_DOES_NOT_PRINT:
             break;
         case HIDDEN_BUT_PRINTABLE:
             field.Flags = PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_NOVIEW;
             break;
         default:
             field.Flags = PdfAnnotation.FLAGS_PRINT;
             break;
     }
     return field;
 }
Exemple #29
0
        public static void wstra(FileStream fout, String[] stra)
        {
            int ns=stra.GetLength(0);

            fout.WriteByte((byte)ns);

            if (ns == 0)
                return;

            for (int i = 0; i < ns; i++)
                wstr(fout, stra[i]);
        }
Exemple #30
0
        /// <summary>
        /// Esta Funcion es igual a la anterior, solo que utiliza una Matriz {NombreCampo, Valor} para cargar los Parametros.
        /// </summary>
        private SqlCommand cargarParametrosCommand(SqlCommand cmd, String[,] aParam, String sListOutParam)
        {
            cmd.Parameters.Clear();

            if (aParam != null)
            {
                for (int i = 0; i < aParam.GetLength(0); i++)
                {
                    if (sListOutParam.ToUpper().Contains(aParam[i, 0].ToUpper()))
                        cmd.Parameters.AddWithValue("@" + aParam[i, 0], aParam[i, 1]).Direction = ParameterDirection.Output;
                    else
                        cmd.Parameters.AddWithValue("@" + aParam[i, 0], aParam[i, 1]);
                }
            }

            return cmd;
        }