コード例 #1
0
ファイル: ImageBoxTests.cs プロジェクト: m-kosina/GEDKeeper
        public void Init()
        {
            fForm            = new Form();
            fForm.ClientSize = new Size(383, 221);
            fForm.Text       = "ImageViewTests";

            fImageBox      = new ImageBox();
            fImageBox.Dock = DockStyle.Fill;

            fForm.SuspendLayout();
            fForm.Controls.Add(fImageBox);
            fForm.ResumeLayout(false);
            fForm.PerformLayout();
        }
コード例 #2
0
ファイル: ImageView.cs プロジェクト: m-kosina/GEDKeeper
        private void InitializeComponent()
        {
            SuspendLayout();

            btnSizeToFit        = new Button();
            btnSizeToFit.Size   = new Size(28, 28);
            btnSizeToFit.Image  = UIHelper.LoadResourceImage("Resources.btn_size_to_fit.png");
            btnSizeToFit.Click += btnSizeToFit_Click;

            btnZoomIn        = new Button();
            btnZoomIn.Size   = new Size(28, 28);
            btnZoomIn.Image  = UIHelper.LoadResourceImage("Resources.btn_zoom_in.png");
            btnZoomIn.Click += btnZoomIn_Click;

            btnZoomOut        = new Button();
            btnZoomOut.Size   = new Size(28, 28);
            btnZoomOut.Image  = UIHelper.LoadResourceImage("Resources.btn_zoom_out.png");
            btnZoomOut.Click += btnZoomOut_Click;

            cbZoomLevels          = new ComboBox();
            cbZoomLevels.ReadOnly = true;
            cbZoomLevels.Size     = new Size(140, 28);
            cbZoomLevels.TextChanged /*SelectedIndexChanged*/ += cbZoomLevels_SelectedIndexChanged;

            toolStrip         = new Panel();
            toolStrip.Content = new StackLayout()
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 10,
                Items       =
                {
                    btnSizeToFit,
                    btnZoomIn,
                    btnZoomOut,
                    cbZoomLevels
                }
            };

            imageBox                  = new ImageBox();
            imageBox.AllowZoom        = true;
            imageBox.BackgroundColor  = Colors.Gray;
            imageBox.ImageBorderColor = Colors.AliceBlue;
            imageBox.ImageBorderStyle = ImageBoxBorderStyle.FixedSingleGlowShadow;
            imageBox.SelectionMode    = ImageBoxSelectionMode.Zoom;
            imageBox.ZoomChanged     += imageBox_ZoomChanged;

            Content = new TableLayout()
            {
                Rows =
                {
                    new TableRow()
                    {
                        Cells ={ toolStrip             }
                    },
                    new TableRow()
                    {
                        ScaleHeight = true,
                        Cells       = { imageBox }
                    }
                }
            };

            ResumeLayout();
        }