a2500752df
SVN-Revision: r341
74 lines
2.5 KiB
C#
74 lines
2.5 KiB
C#
using DevExpress.XtraGrid.Columns;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
|
using Lskj.Business;
|
|
using Lskj.Control.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.Control
|
|
{
|
|
public partial class FrmPicture : BaseForm
|
|
{
|
|
public List<GridColumn> PicUrlColumns;
|
|
public DataRow FocusedRow;
|
|
public GridColumn FocusedColumn;
|
|
public Image Picture
|
|
{
|
|
get
|
|
{
|
|
return pictureEdit.Image;
|
|
}
|
|
set
|
|
{
|
|
pictureEdit.Image = value;
|
|
}
|
|
}
|
|
public FrmPicture()
|
|
{
|
|
InitializeComponent();
|
|
pictureEdit.Properties.ShowMenu = false;
|
|
this.lbLeft.Click += OnBtnLeftClick;
|
|
this.lbRight.Click += OnBtnRightClick;
|
|
}
|
|
|
|
private void OnBtnRightClick(object sender, EventArgs e)
|
|
{
|
|
int index = PicUrlColumns.IndexOf(FocusedColumn);
|
|
if (index >= 0 && index + 1 <= PicUrlColumns.Count - 1)
|
|
{
|
|
FocusedColumn = PicUrlColumns[index + 1];
|
|
if (FocusedColumn.Tag != null && FocusedColumn.Tag is GridColumnModel columnModel)
|
|
{
|
|
string imageUrl = FocusedRow.Table.Columns.Contains(columnModel.FieldName) ? FocusedRow[columnModel.FieldName] + "" : "";
|
|
if (string.IsNullOrEmpty(imageUrl))
|
|
{
|
|
return;
|
|
}
|
|
if (!imageUrl.StartsWith("http"))
|
|
{
|
|
string oaUrl = SystemInfo.Instance.OAUrl.EndsWith("/") ? SystemInfo.Instance.OAUrl : $"{SystemInfo.Instance.OAUrl}/";
|
|
imageUrl = $"{oaUrl}{imageUrl}";
|
|
}
|
|
if (columnModel.LabPicUrlImages.ContainsKey(imageUrl))
|
|
{
|
|
Image image = ((KeyValuePair<Image, Image>)columnModel.LabPicUrlImages[imageUrl]).Key;
|
|
Picture = image;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnBtnLeftClick(object sender, EventArgs e)
|
|
{
|
|
int index = PicUrlColumns.IndexOf(FocusedColumn);
|
|
if (index >= 0 && index - 1 >= 0)
|
|
{
|
|
FocusedColumn = PicUrlColumns[index - 1];
|
|
|