예제 #1
0
        private void CreateItemPanel(ImageItem item, string itemName, int index, out System.Windows.Forms.Panel PanelItem)
        {
            System.Windows.Forms.CheckBox CheckBoxItem;
            System.Windows.Forms.Panel    PanelBackGround;
            System.Windows.Forms.Panel    PanelTextBackColor;
            System.Windows.Forms.Label    LabelText;
            RasterImageViewer             Picturebox;

            PanelItem          = new System.Windows.Forms.Panel();
            CheckBoxItem       = new System.Windows.Forms.CheckBox();
            PanelBackGround    = new System.Windows.Forms.Panel();
            PanelTextBackColor = new System.Windows.Forms.Panel();
            LabelText          = new System.Windows.Forms.Label();
            Picturebox         = new RasterImageViewer();

            //
            // PanelItem
            //
            PanelItem.Controls.Add(PanelBackGround);
            PanelItem.BackColor = this.BackColor;
            PanelItem.Location  = new Point(73, 46);
            PanelItem.Size      = new Size((int)((double)ItemHeight * 0.86), ItemHeight);
            //
            // CheckBoxItem
            //
            CheckBoxItem.AutoSize  = true;
            CheckBoxItem.Location  = new Point(4, 5);
            CheckBoxItem.Size      = new Size(12, 11);
            CheckBoxItem.FlatStyle = FlatStyle.Standard;
            CheckBoxItem.UseVisualStyleBackColor = true;
            //
            // PanelBackGround
            //
            PanelBackGround.BackColor = this.BackColor;
            PanelBackGround.Controls.Add(CheckBoxItem);
            PanelBackGround.Controls.Add(PanelTextBackColor);
            PanelBackGround.Controls.Add(Picturebox);
            PanelBackGround.Location = new Point(6, 7);
            PanelBackGround.Size     = new Size(PanelItem.Width - 12, PanelItem.Height - 15); // 120
            //
            // PanelTextBackColor
            //
            PanelTextBackColor.BackColor = Color.LightCoral;
            PanelTextBackColor.Controls.Add(LabelText);
            PanelTextBackColor.Location = new Point(3, PanelBackGround.Height - 25);
            PanelTextBackColor.Size     = new Size(PanelBackGround.Width - 7, 21);
            //
            // LabelText
            //
            LabelText.AutoSize = true;
            LabelText.Location = new Point(3, 3);
            LabelText.Size     = new Size(97, 13);
            //
            // Picturebox
            //
            Picturebox.BorderStyle         = BorderStyle.None;
            Picturebox.Location            = new Point(3, 4);
            Picturebox.Size                = new Size(PanelBackGround.Width - 7, PanelBackGround.Height - 30);
            Picturebox.SizeMode            = RasterPaintSizeMode.FitAlways;
            Picturebox.HorizontalAlignMode = RasterPaintAlignMode.Center;
            Picturebox.VerticalAlignMode   = RasterPaintAlignMode.Center;
            Picturebox.TabStop             = false;
            Picturebox.BackColor           = this.BackColor;
            Picturebox.Click              += new EventHandler(ItemClick);
            LabelText.Click               += new EventHandler(ItemClick);
            PanelItem.Click               += new EventHandler(ItemClick);
            PanelTextBackColor.Click      += new EventHandler(ItemClick);
            PanelBackGround.Click         += new EventHandler(ItemClick);
            CheckBoxItem.Click            += new EventHandler(ItemClick);

            CheckBoxItem.GotFocus       += new EventHandler(ItemGotFocus);
            Picturebox.GotFocus         += new EventHandler(ItemGotFocus);
            LabelText.GotFocus          += new EventHandler(ItemGotFocus);
            PanelItem.GotFocus          += new EventHandler(ItemGotFocus);
            PanelTextBackColor.GotFocus += new EventHandler(ItemGotFocus);
            PanelBackGround.GotFocus    += new EventHandler(ItemGotFocus);

            Picturebox.KeyDown         += new KeyEventHandler(ListImageBoxControls_KeyDown);
            LabelText.KeyDown          += new KeyEventHandler(ListImageBoxControls_KeyDown);
            PanelItem.KeyDown          += new KeyEventHandler(ListImageBoxControls_KeyDown);
            PanelTextBackColor.KeyDown += new KeyEventHandler(ListImageBoxControls_KeyDown);
            PanelBackGround.KeyDown    += new KeyEventHandler(ListImageBoxControls_KeyDown);
            CheckBoxItem.KeyDown       += new KeyEventHandler(ListImageBoxControls_KeyDown);

            Leadtools.Codecs.RasterCodecs cd = new Leadtools.Codecs.RasterCodecs();
            Picturebox.Image = item.Image;
            LabelText.Text   = itemName + " Page #" + (index + 1);

            PanelItem.Tag          = this._lstItems.Count;
            Picturebox.Tag         = this._lstItems.Count;
            PanelBackGround.Tag    = this._lstItems.Count;
            PanelTextBackColor.Tag = this._lstItems.Count;
            LabelText.Tag          = this._lstItems.Count;
            CheckBoxItem.Tag       = this._lstItems.Count;
        }
예제 #2
0
        /// ------------------------------------------------------------------------------
        /// <summary>
        ///     伝票画像表示 </summary>
        /// <param name="iX">
        ///     現在の伝票</param>
        /// <param name="tempImgName">
        ///     画像名</param>
        /// ------------------------------------------------------------------------------
        public void ShowImage(string tempImgName)
        {
            //修正画面へ組み入れた画像フォームの表示
            //画像の出力が無い場合は、画像表示をしない。
            if (tempImgName == string.Empty)
            {
                leadImg.Visible     = false;
                lblNoImage.Visible  = false;
                global.pblImagePath = string.Empty;
                return;
            }

            //画像ファイルがあるとき表示
            if (System.IO.File.Exists(tempImgName))
            {
                lblNoImage.Visible = false;
                leadImg.Visible    = true;

                // 画像操作ボタン
                btnPlus.Enabled  = true;
                btnMinus.Enabled = true;

                //画像ロード
                Leadtools.Codecs.RasterCodecs.Startup();
                Leadtools.Codecs.RasterCodecs cs = new Leadtools.Codecs.RasterCodecs();

                // 描画時に使用される速度、品質、およびスタイルを制御します。
                Leadtools.RasterPaintProperties prop = new Leadtools.RasterPaintProperties();
                prop = Leadtools.RasterPaintProperties.Default;
                prop.PaintDisplayMode   = Leadtools.RasterPaintDisplayModeFlags.Resample;
                leadImg.PaintProperties = prop;

                leadImg.Image = cs.Load(tempImgName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);

                //画像表示倍率設定
                if (global.miMdlZoomRate == 0f)
                {
                    leadImg.ScaleFactor *= global.ZOOM_RATE;
                }
                else
                {
                    leadImg.ScaleFactor *= global.miMdlZoomRate;
                }

                //画像のマウスによる移動を可能とする
                leadImg.InteractiveMode = Leadtools.WinForms.RasterViewerInteractiveMode.Pan;

                // グレースケールに変換
                Leadtools.ImageProcessing.GrayscaleCommand grayScaleCommand = new Leadtools.ImageProcessing.GrayscaleCommand();
                grayScaleCommand.BitsPerPixel = 8;
                grayScaleCommand.Run(leadImg.Image);
                leadImg.Refresh();

                cs.Dispose();
                Leadtools.Codecs.RasterCodecs.Shutdown();
                //global.pblImagePath = tempImgName;
            }
            else
            {
                //画像ファイルがないとき
                lblNoImage.Visible = true;

                // 画像操作ボタン
                btnPlus.Enabled  = false;
                btnMinus.Enabled = false;

                leadImg.Visible = false;
                //global.pblImagePath = string.Empty;
            }
        }
예제 #3
0
        public void Initialize(string documentFileName, int firstPageNumber, int lastPageNumber, Leadtools.Codecs.RasterCodecs rasterCodecsInstance)
        {
            Text = string.Format("{0} - {1}", documentFileName, Messager.Caption);

            _viewerControl.SetDocument(documentFileName, firstPageNumber, lastPageNumber, rasterCodecsInstance);

            // Initialize printing
            if (PrinterSettings.InstalledPrinters != null && PrinterSettings.InstalledPrinters.Count > 0)
            {
                _printDocument = new PrintDocument();
                _printDocument.PrinterSettings = new PrinterSettings();
                _printDocument.BeginPrint     += new PrintEventHandler(_printDocument_BeginPrint);
                _printDocument.PrintPage      += new PrintPageEventHandler(_printDocument_PrintPage);
                _printDocument.EndPrint       += new PrintEventHandler(_printDocument_EndPrint);
            }
            else
            {
                // No installed printers on this machine
                _printDocument = null;
            }
        }