grid

阅读 / 问答 / 标签

如何根据条件改变delphi中TcxGrid控件显示框的背景颜色?

专业不一样

如何获取datagridview行号和列号?

winform中让datagridview自动显示行号代码如下:private void gvPurchaseOrder_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e){using (SolidBrush b = new SolidBrush(this.gvPurchaseOrder.RowHeadersDefaultCellStyle.ForeColor)){e.Graphics.DrawString(Convert.ToString(e.RowIndex + 1, CultureInfo.CurrentUICulture),e.InheritedRowStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);}}

C# 自定义表格 水晶报表 报表 CrystalReport TableView DataGridView

找个第三方报表软件,可以简单搞定!代码较多,和使用的报表软件有关,不好提供!

我想把winform中datagridview 列名 NAME 变成中文“名称”,怎么实现?举例说明!!!

datagridview.Columns["NAME"].Name = "名称"

我用C#做网站时,想鼠标选中gridview内的行时时,文本框显示相应的内容,应该怎么写呢???请高手们支招

生成gridview的时候 给每一行绑定一个onclick事件 在onclick事件中给文本框赋值

vfp大神请进,我想用grid显示查询内容,但是点查询按钮后grid里总是空白的

into table a这里的a有问题在vfp中,a可以是个工作区例如select a可能你认为这个命令的作用是选择a表可我也可以认为是选择a工作区这可能并不是导致grid不显示的关键原因thisform.grid1.recordsource="select * from cpb where xih=thisform.text1.value into table a"thisform.grid1.recordsource="a" 这两句修改成select * from cpb where xih=thisform.text1.value into cursor tempthisform.grid1.recordsource = "temp"thisform.grid1.recordsourcetype = 1再试试

【coding】关于DataGridView如何自动刷新的解决方法

很少做Windows桌面应用程序,更少做Windows桌面应用程序的界面。对控件使用相当生疏。 今天碰到一问题,用DataGridView直接绑定了List<T>,绑定后,数据源的数据发生增删后,DataGridView只能在Form_Load中刷新。在其它事件中,数据源的数据变更,DataGridView都不刷新,调用Refresh等方法也无效。 于是放了下狗,狗中提供了两个方法: 1、重新触发Form_Load事件。 2、把DataGridView的DataSource设置为null,再重新绑定为List<T>。 觉得这两个方法都很瓦,而且会造成数据增删后行定位很麻烦。于是重新阅读查到的文章和回复,在其中一个回复中看到了这样的话:数据源用BindingSoruce。(真是精炼的提示啊) 研究了一下。这个问题可以这样解决: 1、创建一个BindingSource的实例,并把List<T>作为构造函数的参数。DataGridView绑定这个实例。 2、增删数据时,调用BindingSource的对应方法,而不是调用List<T>的对应方法,这时DataGridView是能自动刷新的。而且不用专门写DataGridView的行定位代码。 3、设置Position属性,会造成DataGridView的行定位刷新,有滚动条的时候,会自动完成滚动。 4、List<T>的内容是可以读取的(BindingSource的List属性,返回的是IList,需要做类型转换,使用不方便)。但是切记不要直接操作List<T>,任何操作都要通过BindingSource的对应方法来做。 5、BindingSource有一些事件,如ListChanged、PositionChanged,比DataGridView中的类似事件更好操纵。

DataGrid里的column怎么用?

DataNavigateUrlField 获取或设置数据源中要绑定到 HyperLinkColumn 中的超链接的 URL 的字段。 DataNavigateUrlFormatString 获取或设置当 URL 数据绑定到数据源中的字段时,HyperLinkColumn 中的超链接的 URL 的显示格式。 Target 获取或设置单击列中的超链接时显示链接到的网页内容的目标窗口或框架。

关于MSFlexgrid控件(注册)的一个小问题

未安装VC使用activeX控件- -Tag: 串口控件 注册 在使用串口控件时,在没有装VC的机器上碰到问题regsvr32 注册成功,但仍然不能使用,经查找是LicenseKey的问题只需在创建控件时增加下列几行即可WCHAR pwchLicenseKey[] = { 0x0043, 0x006F, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067, 0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039, 0x0039, 0x0034, 0x0020 }; BSTR bstrLicense = ::SysAllocStringLen(pwchLicenseKey, sizeof(pwchLicenseKey)/sizeof(WCHAR)); if(!m_ComPort.Create(NULL,0,CRect(0,0,0,0),AfxGetMainWnd(), IDC_MSCOMM1,NULL,FALSE,bstrLicense)) { AfxMessageBox("Failed to create OLE Communications Control "); return -1; //fail to create }......::SysFreeString(bstrLicense);具体参考原文见下:-----------------------------------------------------------------------------------------------------This article was previously published under Q151771 SUMMARYThe LicReqst sample illustrates how to use the IClassFactory2 interface to request an object"s License key. The following file is available for download from the Microsoft Download Center:Licreqst.exeFor additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591 How to Obtain Microsoft Support Files from Online Services Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. NOTE: Use the -d option when running Licrqst.exe to decompress the file and recreate the proper directory structure. MORE INFORMATIONThe LicReqst sample is a dialog-based MFC application that illustrates how to use the IClassFactory2 interface to request an object"s License key. LicReqst displays the ProgID of each of the currently registered ActiveX controls in a Listbox. When one of the displayed ProgID"s is selected, an instance of the corresponding control is created and then asked for it"s License key. If a valid key is returned, LicReqst displays the key and enables the "Copy to Clipboard" button that allows the License key to be copied to the Clipboard. The License key can then easily be pasted into code that uses the CWnd::CreateControl method to dynamically create an instance of the Control. LicReqst creates a textual version of the License key data in the form of a declaration of an array of WCHAR when copying the key to the Clipboard. This is done because the License key data could contain non-printable characters. A human-readable version of the License key data is also provided for reference and is included inside a Comment block in the final string that is copied to the Clipboard. For example, if an object uses the string "Copyright (c) 1994" (without the quotes) for its License key, LicReqst would generate the following block of text that could be copied to and pasted from the Clipboard: /* Copyright (c) 1994 */ WCHAR pwchLicenseKey[] = { 0x0043, 0x006F, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067, 0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039, 0x0039, 0x0034, 0x0020 }; You can use the previous block of text in code that creates an instance of the Licensed object, and you can use the pwchLicenseKey variable to specify the object"s License key. For example, if MFC code is dynamically creating an instance of a Licensed ActiveX Control using the Create method of a Visual C++ Component Gallery generated wrapper class, the pwchLicenseKey variable can be used in the Create call like this: BSTR bstrLicense = ::SysAllocStringLen(pwchLicenseKey, sizeof(pwchLicenseKey)/sizeof(WCHAR)); m_MyControl.Create(NULL, WS_VISIBLE, CRect(10,10,10,10), this, 2, NULL, FALSE, bstrLicense); ::SysFreeString(bstrLicense); Note how a BSTR is created from the pwchLicenseKey variable and how the BSTR is then used for the License key parameter in the Create call. NOTE: The code in this sample that generates the text copied to the Clipboard makes the assumption that it is being executed on a little endian system (Intel x86-class processors). Because of this, it will not work correctly on big endian system. For these systems, it is still possible to use the Helper function used internally by the sample to request the License key from an object. The sample uses a Helper function called RequestLicenseKey() to get the License key from an object based on its ProgID. The source code for the RequestLicenseKey() function is shown later in the Sample Code section. To find other locations of interest in the sample source code, use the Find in Files feature of the Visual C++ Developer Studio to search for the string named SAMPLE CODE. This string has been used to tag each of the modified sections in the source code. NOTE: Running the LicReqst sample on a licensed machine to obtain an object"s License key, and then distributing that key to allow applications to be developed on other non-licensed machines, may be a violation of established copyrights. For more information and to determine if an object"s License key can be legally redistributed, refer to the License Agreement provided with the object or contact the creator of the object. Sample Code// Compile options needed: none/////////////////////////////////////////////////////////////////////// // SAMPLE CODE - Implementation of the RequestLicenseKey function// // The RequestLicenseKey function uses the IClassFactory2 interface// to request a License key from an object specified by its ProgID.// // Parameters:// // [out] BSTR& bstrLicenseKey// Upon return, this BSTR will contain either a valid// License key or an error message. It is the caller"s// responsibility to call ::SysFreeString on this BSTR.// // [in] CString strProgID// Specifies the ProgID of the object from which to request the// License key.// // // Return Value:// // A BOOL specifying success or failure. If TRUE is returned,// the License key was retrieved successfully and the// bstrLicenseKey parameter contains a valid License key. If// FALSE is returned, the License key was not retrieved// successfully and the bstrLicenseKey parameter contains a// descriptive error string.// // Regardless of the return value, it is the responsibility of// the caller to call ::SysFreeString on the returned bstrLicenseKey// parameter.// BOOL RequestLicenseKey(BSTR& bstrLicenseKey, CString strProgID) { USES_CONVERSION; LPCLASSFACTORY2 pClassFactory; CLSID clsid; BOOL bValidKeyReturned = FALSE; // Get the CLSID of the specified ProgID. if (SUCCEEDED(CLSIDFromProgID(T2OLE(strProgID), &clsid))) { // Create an instance of the object and query it for // the IClassFactory2 interface. if (SUCCEEDED(CoGetClassObject(clsid, CLSCTX_INPROC_SERVER, NULL, IID_IClassFactory2, (LPVOID *)(&pClassFactory)))) { LICINFO licinfo; // Check to see if this object has a runtime License key. if (SUCCEEDED(pClassFactory->GetLicInfo(&licinfo))) { if (licinfo.fRuntimeKeyAvail) { HRESULT hr; // The object has a runtime License key, so request it. hr = pClassFactory->RequestLicKey(0, &bstrLicenseKey); if (SUCCEEDED(hr)) { if(bstrLicenseKey == NULL) bstrLicenseKey = ::SysAllocString( L""); else // You have the license key. bValidKeyReturned = TRUE; } else // Requesting the License key failed. switch(hr) { case E_NOTIMPL: bstrLicenseKey = ::SysAllocString( L""); break; case E_UNEXPECTED: bstrLicenseKey = ::SysAllocString( L""); break; case E_OUTOFMEMORY: bstrLicenseKey = ::SysAllocString( L""); break; case CLASS_E_NOTLICENSED: bstrLicenseKey = ::SysAllocString( L""); break; default: bstrLicenseKey = ::SysAllocString( L""); } } else bstrLicenseKey = ::SysAllocString( L""); } else bstrLicenseKey = ::SysAllocString( L""); // Make sure you release the reference to the class factory. pClassFactory->Release(); } else bstrLicenseKey = ::SysAllocString( L""); } else bstrLicenseKey = ::SysAllocString( L""); // Return a BOOL specifying whether or not you were able to get a // valid license key. return bValidKeyReturned; }

请教怎样在datagrid中使用cellstyle

<!--用于DataGridColumn.CellStyle--> <Style TargetType="sdk:DataGridCell" x:Key="cellRightStyle"> <Setter Property="HorizontalContentAlignment" Value="Right"/> </Style> <!--用于DataGridTextColumn 的 EditingElementStyle --> <Style TargetType="TextBox" x:Key="txtCellRightStyle"> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="TextAlignment" Value="Right"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="FontSize" Value="12"/> </Style> <!--用于DataGridTextColumn 的 ElementStyle --> <Style TargetType="TextBlock" x:Key="tbCellCenterStyle"> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="TextAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="FontSize" Value="12"/> <Setter Property="MinHeight" Value="16" /> </Style>DataGridColumn.CellStyle 用于 DataGridCell;DataGridBoundColumn.ElementStyle 用于 DataGridBoundColumn 中元素的类型,对于 DataGridTextColumn 则为 TextBlock ;DataGridBoundColumn.EditingElementStyle 和 ElementStyle 类似,对于 DataGridTextColumn 则为 TextBox

WPF DataGrid 某列单元格中的内容如何居中显示

自定义样式,可以达到效果。但是我在使用的时候,出现一个小问题,不知道大家遇到没有,我用了自定义的样式以后,是好看了,可是数据源更新后,数据在界面的更新却特别的慢!

C# WPF DataGrid按钮列已经插入 但是名字都是统一的 怎么改变 按钮的名字 让自己可以定义

你是通过命令绑定的,可以在命令上增加一个属性是Text,或者CommandName之类的然后<Button Command="{Binding Path=Edit}" Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text"/>另外,既然有命令绑定了,就不要用Click事件了

WPF中对datagrid删除选中的某一行。

简单说一下我的想法:获取当前选中的行,选中行的序号那个列应该是唯一的.在数据库中删除选中行的数据,在刷新datagrid即可.

C# wpf datagrid 动态加载数据后改变单元格颜色bug

根据什么来改颜色?打字不易,如满意,望采纳。

wpf, datagrid最后空白列,消除方法

放在Viewbox里是可以的啊,我试过的。

WPF的DataGrid怎么实现多行表头

<Style x:Key="CityNumStyle" TargetType="DataGridColumnHeader"><Setter Property="Template"><Setter.Value><ControlTemplate><Grid x:Name="Root"><!--<Rectangle x:Name="BackgroundGradient" Fill="#eee" Stretch="Fill" Grid.ColumnSpan="2" />--><ContentPresenter Content="区号" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center" /></Grid></ControlTemplate></Setter.Value></Setter></Style><Style x:Key="CityNameStyle" TargetType="DataGridColumnHeader"><Setter Property="Foreground" Value="#222" /><Setter Property="HorizontalContentAlignment" Value="Left" /><Setter Property="VerticalContentAlignment" Value="Center" /><Setter Property="IsTabStop" Value="False" /><Setter Property="SeparatorBrush" Value="#CCC" /><Setter Property="Padding" Value="8" /><Setter Property="Template"><Setter.Value><ControlTemplate><Grid x:Name="Root"><Grid.ColumnDefinitions><ColumnDefinition /><ColumnDefinition Width="auto" /></Grid.ColumnDefinitions><!--<Rectangle x:Name="BackgroundRectangle" Fill="#eee" Stretch="Fill" Grid.ColumnSpan="2" />--><Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"><Grid.RowDefinitions><RowDefinition Height="20" /><RowDefinition Height="1" /><RowDefinition Height="20" /></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width=

WPF—— Grid里怎么显示性别?

新建一个类实现System.Windows.Data.IValueConverter接口在接口方法Convert里,把object参数value转换成int,在把int对应的男或女的字符串return出去在绑定里应用那个新类转换器,语法是Text="{Binding RSex, Converter={StaticResource 你写的转换器}, Mode=OneWay}"

WPF的DataGrid怎么实现多行表头

<Style x:Key="CityNumStyle" TargetType="DataGridColumnHeader"><Setter Property="Template"><Setter.Value><ControlTemplate><Grid x:Name="Root"><!--<Rectangle x:Name="BackgroundGradient" Fill="#eee" Stretch="Fill" Grid.ColumnSpan="2" />--><ContentPresenter Content="区号" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center" /></Grid></ControlTemplate></Setter.Value></Setter></Style><Style x:Key="CityNameStyle" TargetType="DataGridColumnHeader"><Setter Property="Foreground" Value="#222" /><Setter Property="HorizontalContentAlignment" Value="Left" /><Setter Property="VerticalContentAlignment" Value="Center" /><Setter Property="IsTabStop" Value="False" /><Setter Property="SeparatorBrush" Value="#CCC" /><Setter Property="Padding" Value="8" /><Setter Property="Template"><Setter.Value><ControlTemplate><Grid x:Name="Root"><Grid.ColumnDefinitions><ColumnDefinition /><ColumnDefinition Width="auto" /></Grid.ColumnDefinitions><!--<Rectangle x:Name="BackgroundRectangle" Fill="#eee" Stretch="Fill" Grid.ColumnSpan="2" />--><Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"><Grid.RowDefinitions><RowDefinition Height="20" /><RowDefinition Height="1" /><RowDefinition Height="20" /></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width=

DBGrid相同数据合并成一个格[最好用Delphi回答]

能不能在通俗点得

VB的MSHFlexGrid控键怎么实现复制功能,用粘贴板?Clipboard.SetText

不可能的,如果可以做的话,我想要从mshflexgrid本身改造才能做到,太麻烦了,呵呵

In-Grid 的one more time的歌词

One more time -In-GridBaby, one more time Can I blow your mind Do you wanna stay Honey, come and playI"ll make you fly away If you take it slow I"ll show you where to go And make the moments flow Come into my world I take you deep inside Baby, come and hide Wanna love you tonight Can I make you mine You"re gonna be alright Baby, one more time Can I blow your mind Boy, you let me shine Can I make you mine Gonna be just fine All I wanna hear Your breathing in my ear Sugar have no fear I"ll love you night and day Please, don"t go away Can I be your prey Feel my body tonight My love I cannot hide It"s gonna be alright Baby, one more time Can I blow your mind Maybe, if we join our hearts forever We can make it better I"m loving every minute of the hourIf you can be mineBaby, one more timeCan I blow your mind
 首页 上一页  1 2 3 4