/// <summary> /// Constructeur du Formulaire /// </summary> /// <param name="ListPhoto"></param> /// <param name="numPhotoSelected"></param> /// <param name="_angle"></param> public frmViewPhoto(List<PhotoControl> ListPhoto, int numPhotoSelected, float _angle) { Log.Debug("Formulaire [Visualisation Photo] {NAME: " + ListPhoto[numPhotoSelected].InfoPhoto.namePhoto + "}"); p_angleInit = _angle; p_numPhoto = numPhotoSelected; p_infoVignette = ListPhoto[p_numPhoto].InfoPhoto; p_listPhoto = ListPhoto; InitializeComponent(); _readyToSelect = false; _isSelectable = false; }
/// <summary> /// Evénement CLAVIER /// </summary> /// <param name="msg"></param> /// <param name="keyData"></param> /// <returns></returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { const int WM_KEYDOWN = 0x100; const int WM_SYSKEYDOWN = 0x104; if (((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN)) && _readyToSelect) { switch (keyData) { case Keys.Right: if (p_numPhoto == p_listPhoto.Count - 1) { p_numPhoto = 0; } else { p_numPhoto++; } p_infoVignette = p_listPhoto[p_numPhoto].InfoPhoto; this.frmViewPhoto_Load(null, null); break; case Keys.Left: if (p_numPhoto == 0) { p_numPhoto = p_listPhoto.Count - 1; } else { p_numPhoto--; } p_infoVignette = p_listPhoto[p_numPhoto].InfoPhoto; this.frmViewPhoto_Load(null, null); break; // Gérer la navigation dans la liste case Keys.Escape: case Keys.End: this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); break; // Gérer la navigation dans la liste case Keys.Enter: if (_isSelectable) { this.DialogResult = System.Windows.Forms.DialogResult.OK; OnPhotoSelected(new ImgCrtlEventArg() { NumElement = p_numPhoto }); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } break; } } return true; }
private void initCtrl(LibLabo.Ctrls.PhotoControl.InfoVignette _infoPhoto, int numElement, bool _showImage) { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); InitializeComponent(); toolTip = new ToolTip(); p_infoVignette = _infoPhoto; numPhoto.Text = _infoPhoto.numPhoto.ToString(); p_fileName = _infoPhoto.namePhoto; if (_showImage) { this.loadPhoto(); } p_isSelected = false; this.selectPhotoItem.Text = "Sélectionner cette photo"; p_numElement = numElement; this.Anchor = AnchorStyles.Bottom; this.AutoSize = true; this.Dock = DockStyle.Fill; this.ResumeLayout(false); }