public static Control CreateControl(string zoomPolicy, Font font, Size layoutSize) { switch (zoomPolicy) { case "RasterImageListZoomPolicy": RasterImageList imageList1 = new RasterImageList(); imageList1.Dock = DockStyle.Fill; using (RasterCodecs codecs = new RasterCodecs()) { MemoryStream stream1 = new MemoryStream(); Properties.Resources.Accnt.Save(stream1, ImageFormat.Png); stream1.Position = 0; RasterImage image1 = codecs.Load(stream1); stream1.Close(); stream1 = new MemoryStream(); Properties.Resources.Bill.Save(stream1, ImageFormat.Png); stream1.Position = 0; RasterImage image2 = codecs.Load(stream1); stream1.Close(); stream1 = new MemoryStream(); Properties.Resources.Check.Save(stream1, ImageFormat.Png); stream1.Position = 0; RasterImage image3 = codecs.Load(stream1); stream1.Close(); stream1 = new MemoryStream(); Properties.Resources.Cust.Save(stream1, ImageFormat.Png); stream1.Position = 0; RasterImage image4 = codecs.Load(stream1); stream1.Close(); imageList1.Items.Add(new RasterImageListItem(image1, 1, "aaa")); imageList1.Items.Add(new RasterImageListItem(image2, 1, "bbb")); imageList1.Items.Add(new RasterImageListItem(image3, 1, "ccc")); imageList1.Items.Add(new RasterImageListItem(image4, 1, "ddd")); } return(imageList1); case "RasterImageViewerZoomPolicy": RasterImageViewer imageViewer1 = new RasterImageViewer(); imageViewer1.Dock = DockStyle.Fill; using (RasterCodecs codecs = new RasterCodecs()) { MemoryStream stream1 = new MemoryStream(); Properties.Resources.Forest.Save(stream1, ImageFormat.Png); stream1.Position = 0; RasterImage image1 = codecs.Load(stream1); stream1.Close(); imageViewer1.Image = image1; } return(imageViewer1); default: break; } return(null); }
/// <summary> /// アプリケーションの初期化処理を行います。 /// </summary> private void InitClass() { // フォームのタイトルを設定します。 this.Text = "TWAIN 取得 【振替伝票読み取り】"; //自分自身のバージョン情報を取得する 2011/03/25 //System.Diagnostics.FileVersionInfo ver = // System.Diagnostics.FileVersionInfo.GetVersionInfo( // System.Reflection.Assembly.GetExecutingAssembly().Location); //キャプションにバージョンを追加 2011/03/25 //Messager.Caption += " ver " + ver.FileMajorPart.ToString() + "." + ver.FileMinorPart.ToString(); //Text = Messager.Caption; // ロック解除状態を確認します。 //Support.Unlock(false); // RasterImageViewerコントロールを初期化します。 _viewer = new RasterImageViewer(); //_viewer.Dock = DockStyle.Fill; _viewer.BackColor = Color.DarkGray; Controls.Add(_viewer); _viewer.BringToFront(); _viewer.Visible = false; // コーデックパスを設定します。 RasterCodecs.Startup(); // RasterCodecsオブジェクトを初期化します。 _codecs = new RasterCodecs(); if (TwainSession.IsAvailable(this)) { // TwainSessionオブジェクトを初期化します。 _twainSession = new TwainSession(); // TWAIN セッションを初期化します。 _twainSession.Startup(this, "FKDL", "LEADTOOLS", "Ver16.5J", "OCR", TwainStartupFlags.None); //_twainSession.Startup2(this, "FKDL", "LEADTOOLS", "Ver16.5J", "OCR", TwainStartupFlags.None, TwainLanguage.LanguageJapanese, TwainCountry.CountryJapan); } else { //_miFileAcquire.Enabled = false; //_miFileSelectSource.Enabled = false; } // 各値を初期化します。 _fileName = string.Empty; _fileFormat = RasterImageFormat.Tif; _pageNo = 1; _sFileNumber = 0; //UpdateMyControls(); UpdateStatusBarText(); }
public void InsertImage(RasterImage img, string imageName) { // initialize the _viewer object _viewer = new RasterImageViewer(); _viewer.Dock = DockStyle.Fill; _viewer.BackColor = Color.DarkGray; Controls.Add(_viewer); _viewer.BringToFront(); _viewer.Image = img; Text = imageName; }
Entity.InputRecord[] DenData; //伝票データ配列 /// <summary> /// 伝票画像を印刷する /// </summary> /// <param name="Img">LeadTools画像</param> public void Image(RasterImageViewer Img) { prnImage = Img; PrintDocument PrnImg = new PrintDocument(); PrnImg.PrinterSettings = new PrinterSettings(); //用紙方向:縦 PrnImg.DefaultPageSettings.Landscape = false; //用紙サイズ:A4 foreach (System.Drawing.Printing.PaperSize ps in PrnImg.PrinterSettings.PaperSizes) { if (ps.Kind == System.Drawing.Printing.PaperKind.A4) { PrnImg.DefaultPageSettings.PaperSize = ps; break; } } //印刷実行 PrnImg.PrintPage += new PrintPageEventHandler(Image_PrintPage); PrnImg.Print(); }
private void IntializeAnnContainer() { SuspendLayout(); imageViewer = new RasterImageViewer(); imageViewer.Dock = DockStyle.Fill; imageViewer.EnableScrollingInterface = true; this.imageViewer.KeyDown += new System.Windows.Forms.KeyEventHandler(this.imageViewer_KeyDown); this.imageViewer.DoubleClick += new System.EventHandler(this.imageViewer_Clicked); // this.imageViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this._viewer_MouseMove); this.Controls.Add(imageViewer); _automationManager = new AnnAutomationManager(); _annAutomation = new AnnAutomation(_automationManager, this.imageViewer); _annAutomation.Active = true; this.imageViewer.BringToFront(); //imageViewer. _codec = new RasterCodecs(); CodecsTxtLoadOptions txtOption = _codec.Options.Txt.Load; txtOption.Enabled = true; _automationManager.RasterCodecs = _codec; _automationManager.RedactionRealizePassword = ""; _automationManager.CreateDefaultObjects(); CustomizeObjectProperty(); PropertyForm propForm = new PropertyForm(); _automationManager.ObjectPropertiesDialogType = propForm.GetType(); // _automationManager.ObjectPropertiesDialogType = null; AddCheckMark(_automationManager); _automationManager.CreateToolBar(); _automationManager.ToolBar.BringToFront(); imageToolBar = new ImageToolBar(); this.imageToolBar.TifEditor = this; toolBar = imageToolBar.GetExtendedToolBar(_automationManager.ToolBar); toolBar.Dock = DockStyle.Bottom; this.Controls.Add(_automationManager.ToolBar); topToolBar = imageToolBar.AddCustomToolBar(topToolBar); imageToolBar.UpdateToolBar(); ResumeLayout(); RasterPaintProperties prop = imageViewer.PaintProperties; // prop.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray | RasterPaintDisplayModeFlags.Bicubic; prop.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray; imageViewer.PaintProperties = prop; InitialzeEdit(); }
private void MainForm_Load(object sender, System.EventArgs e) { // Initialize the raster viewer object _viewer = new RasterImageViewer(); _viewer.Dock = DockStyle.Fill; panel6.Controls.Add(_viewer); _viewer.BringToFront(); cfind.ImplementationClass = CONFIGURATION_IMPLEMENTATIONCLASS; cfind.ProtocolVersion = CONFIGURATION_PROTOCOLVERSION; cfind.ImplementationVersionName = CONFIGURATION_IMPLEMENTATIONVERSIONNAME; LoadSettings(); SizeColumns(listViewStudies); SizeColumns(listViewSeries); cfind.Status += new StatusEventHandler(cfind_Status); cfind.FindComplete += new FindCompleteEventHandler(cfind_FindComplete); cfind.MoveComplete += new MoveCompleteEventHandler(cfind_MoveComplete); propertyGridSearch.SelectedObject = query; Application.ApplicationExit += new EventHandler(Application_ApplicationExit); }
public ImageSizing(RasterImageViewer viewer) { this.viewer = viewer; imageScaleFactor = this.viewer.ScaleFactor; }
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; }