PDA

View Full Version : سوال: راه حل برای استفاده از Telerik RadGridView DetailsColumn



popo69
شنبه 06 مهر 1392, 15:38 عصر
سلام دوستان و برنامه نویسان عزیز
بنده یه راهنمایی می خواستم

می خواستم اگر کسی با خاصیت radgridview DetailsColumn کامپوننت Telerik کار کرده لطفا راه حل یا سمپلی برام بزاره - تصویر رو ضمیمه می کنم که بیشتر با چیزی که مد نظر بنده هست آشنا بشید.
111288
اینم کد همین Telerik Demo :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Telerik.QuickStart.WinControls;
using Telerik.WinControls;
using System.IO;
using Telerik.WinControls.Data;
using Telerik.WinControls.UI;

namespace Telerik.Examples.WinControls.GridView.Rows.RowDeta ils
{
public partial class Form1 : ExamplesForm
{
public Form1()
{
InitializeComponent();
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

// TODO: This line of code loads data into the 'nwindDataSet.Employees' table. You can move, or remove it, as needed.
this.employeesTableAdapter.Fill(this.northwindData Set.Employees);

this.radGridView1.ReadOnly = true;
this.radGridView1.AllowColumnReorder = false;
this.radGridView1.AllowColumnResize = false;
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
this.radGridView1.AutoExpandGroups = true;
this.radGridView1.TableElement.RowHeight = 40;

this.radGridView1.GroupDescriptors.Add(new GridGroupByExpression("City GroupBy City"));
this.radGridView1.Groups[1][0].IsCurrent = true;

this.radGridView1.Columns["Photo"].VisibleInColumnChooser = false;
this.radGridView1.Columns["Photo"].IsVisible = false;
this.radGridView1.Columns["Notes"].WrapText = true;
this.radGridView1.Columns["LastName"].SortOrder = Telerik.WinControls.UI.RadSortOrder.Descending;

this.radGridView1.DetailsColumn = this.radGridView1.Columns["Notes"];
}

private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
if (e.CellElement.RowInfo.IsCurrent &&
e.CellElement.ColumnInfo == this.radGridView1.DetailsColumn)
{
e.CellElement.DrawFill = true;
e.CellElement.GradientStyle = GradientStyles.Solid;
e.CellElement.BackColor = Color.White;

e.CellElement.TextImageRelation = TextImageRelation.ImageBeforeText;
e.CellElement.TextAlignment = ContentAlignment.TopLeft;
e.CellElement.ImageAlignment = ContentAlignment.MiddleLeft;
e.CellElement.Padding = new Padding(10);
e.CellElement.ImageLayout = ImageLayout.Zoom;

byte[] bytes = (byte[])e.CellElement.RowInfo.Cells["Photo"].Value;
e.CellElement.Image = GetImageFromBytes(bytes);
}
else
{
e.CellElement.ResetValue(LightVisualElement.DrawFi llProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.Gradie ntStyleProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.BackCo lorProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.ImageP roperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.Paddin gProperty, ValueResetFlags.Local);
}
}

private const int OleHeaderSize = 78;

private Image GetImageFromBytes(byte[] bytes)
{
if (bytes == null || bytes.Length == 0)
{
return null;
}

Image result = null;
MemoryStream stream = null;

try
{
int count;
int start;

if (IsOleContainer(bytes))
{
count = bytes.Length - OleHeaderSize;
start = OleHeaderSize;
}
else
{
count = bytes.Length;
start = 0;
}

stream = new MemoryStream(bytes, start, count);
result = Image.FromStream(stream);
}
catch
{
result = null;
}
finally
{
if (stream != null)
{
stream.Close();
}
}
return result;
}

private bool IsOleContainer(byte[] imageData)
{
return (imageData != null
&& imageData[0] == 0x15
&& imageData[1] == 0x1C);
}

protected override void WireEvents()
{
this.radGridView1.CellFormatting += new Telerik.WinControls.UI.CellFormattingEventHandler( this.radGridView1_CellFormatting);
}
}
}


مشکلی که دارم وقتی کد :

this.radGridView1.DetailsColumn = this.radGridView1.Columns["Notes"];

خطای not Refrence = Telerik.WinControls.UI.RadGridView

همچین رفرنسی تو DLL های Telerik نیست ...

اگه کسی راهی می شناسه - کدی - سمپلی - چیزی لطفا راهنمایی کنه - با تشکر

popo69
یک شنبه 07 مهر 1392, 08:06 صبح
اساتید؟ دوستان؟ کسی اطلاعاتی در این مورد نداره؟