1-) C# RMOS - gridControl1 gridView1 e resimli button ekleme
1- RESİM EKLEMEK İÇİN
buttons->kind -> Glyph sonra imageoptions -> image ekle -> sonra içinden imagetotextaling-> leftcenter yap onayla yazısını captiona yaz. TextEditStyle -> HideTextEditor yap
|
EKRAN GÖRÜNTÜSÜ
DataTable dataTable = new DataTable(); dataTable.Columns.Add("ad"); DataRow dataRow = dataTable.NewRow(); dataRow["ad"] = "rambo"; dataTable.Rows.Add(dataRow); gridControl1.DataSource= dataTable; |
2- DİNAMİK RESİM EKLEMEK İÇİN :
repositoryitempictureedit kullan
public void LogoGetir() { repositoryItemPictureEdit1.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom; repositoryItemPictureEdit1.NullText = "Resim Yok"; repositoryItemPictureEdit1.InitialImage = null; // Opsiyonel gridViewSiparis.Columns["Logo"].ColumnEdit = repositoryItemPictureEdit1; gridViewSiparis.Columns["Logo"].UnboundType = DevExpress.Data.UnboundColumnType.Object; gridViewSiparis.Columns["Logo"].OptionsColumn.AllowEdit = false; gridViewSiparis.Columns["Logo"].OptionsColumn.ReadOnly = true; gridViewSiparis.CustomUnboundColumnData += (s, e) => { if (e.Column.FieldName == "Logo" && e.IsGetData) { string tip = gridViewSiparis.GetRowCellValue(e.ListSourceRowIndex, "tip") as string;
string projeDizini = Environment.CurrentDirectory; string klasorAdi = "Logo"; string resimAdi = "";
// Sipariş tipine göre resim adını belirleyin if (tip == "trendyol") { resimAdi = "trendyol.png"; } else if (tip == "getir") { resimAdi = "getir.jpg"; } // Diğer sipariş tiplerini burada ekleyebilirsiniz.
if (!string.IsNullOrEmpty(resimAdi)) { string dosyaUzantisi = ".png"; string imagePath = $"{projeDizini}\\{klasorAdi}\\{resimAdi}";
if (File.Exists(imagePath)) { e.Value = Image.FromFile(imagePath); } else { // Resim dosyası bulunamadığında "Resim Yok" metnini veya varsayılan bir görseli gösterebilirsiniz // Örneğin: // e.Value = Image.FromFile(Path.Combine(projeDizini, klasorAdi, "resim_yok.jpg")); } } else { // Tip bilinmeyen sipariş tipleri için varsayılan resmi ayarlayabilirsiniz. } } };
} |