Skip to content

Commit 8bb5f52

Browse files
committed
How to suspend the PING sound when perform the Tab operation in DataGrid(SfDataGrid)?
1 parent 304f756 commit 8bb5f52

14 files changed

+1145
-0
lines changed

BuzzerSound/Form1.Designer.cs

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BuzzerSound/Form1.cs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using Syncfusion.WinForms.Controls;
2+
using Syncfusion.WinForms.DataGrid.Styles;
3+
using System.Windows.Forms;
4+
using Syncfusion.WinForms.DataGrid.Enums;
5+
using System.Collections.Specialized;
6+
using System.Threading.Tasks;
7+
using System;
8+
using System.Collections.ObjectModel;
9+
using System.Collections.Generic;
10+
using Syncfusion.WinForms.DataGrid;
11+
using Syncfusion.WinForms.Core.Utils;
12+
using System.Linq;
13+
using System.Data;
14+
using Syncfusion.WinForms.GridCommon.ScrollAxis;
15+
using Syncfusion.WinForms.DataGrid.Renderers;
16+
17+
namespace GettingStarted
18+
{
19+
public partial class Form1 : Form
20+
{
21+
#region Constructor
22+
public Form1()
23+
{
24+
InitializeComponent();
25+
DataTable dt = new DataTable();
26+
dt.Columns.Add("CustomerName", typeof(string));
27+
dt.Columns.Add("Country", typeof(string));
28+
dt.Columns.Add("CustomerID", typeof(string));
29+
dt.Columns.Add("ShipCity", typeof(string));
30+
dt.Rows.Add(new string[] { "Antonio Moreno", "Mexico", "ANTON", "Mexico D.F." });
31+
dt.Rows.Add(new string[] { "Thomas Hardy", "UK", "AROUT", "London" });
32+
dt.Rows.Add(new string[] { "Christina Berglund", "Sweden", "BERGS", "Lula" });
33+
dt.Rows.Add(new string[] { "Hanna Moos", "Germany", "BLAUS", "Mannheim" });
34+
dt.Rows.Add(new string[] { "Frederique Citeaux", "France", "BLONP", "Strasbourg" });
35+
dt.Rows.Add(new string[] { "Martin Sommer", "Spain", "BOLID", "Madrid" });
36+
this.sfDataGrid.CellRenderers["TextBox"] = new GridTextBoxCellRendererExt();
37+
sfDataGrid.EditMode = Syncfusion.WinForms.DataGrid.Enums.EditMode.SingleClick;
38+
sfDataGrid.SelectionMode = Syncfusion.WinForms.DataGrid.Enums.GridSelectionMode.Single;
39+
sfDataGrid.DataSource = dt;
40+
sfDataGrid.CurrentCellActivated += SfDataGrid_CurrentCellActivated;
41+
}
42+
43+
private void SfDataGrid_CurrentCellActivated(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellActivatedEventArgs e)
44+
{
45+
RowColumnIndex rowColumnIndex = new RowColumnIndex(e.DataRow.Index, e.DataColumn.Index);
46+
sfDataGrid.MoveToCurrentCell(rowColumnIndex);
47+
this.sfDataGrid.CurrentCell.BeginEdit();
48+
}
49+
#endregion
50+
}
51+
52+
class GridTextBoxCellRendererExt : GridTextBoxCellRenderer
53+
{
54+
protected override void OnInitializeEditElement(DataColumnBase column, Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex rowColumnIndex, TextBox uiElement)
55+
{
56+
base.OnInitializeEditElement(column, rowColumnIndex, uiElement);
57+
uiElement.KeyDown += uiElement_KeyDown;
58+
}
59+
60+
protected override void OnUnwireEditUIElement(TextBox uiElement)
61+
{
62+
base.OnUnwireEditUIElement(uiElement);
63+
uiElement.KeyDown -= uiElement_KeyDown;
64+
}
65+
66+
void uiElement_KeyDown(object sender, KeyEventArgs e)
67+
{
68+
if (e.KeyCode == Keys.Tab)
69+
e.SuppressKeyPress = true;
70+
}
71+
}
72+
}

BuzzerSound/Form1.resx

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
</root>
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{CC01EE4E-ABA4-4CED-978A-51C7F2376D4B}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>GettingStarted</RootNamespace>
11+
<AssemblyName>GettingStarted</AssemblyName>
12+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<TargetFrameworkProfile />
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="Syncfusion.Core.WinForms" />
37+
<Reference Include="Syncfusion.Data.WinForms">
38+
</Reference>
39+
<Reference Include="Syncfusion.GridCommon.WinForms" />
40+
<Reference Include="Syncfusion.SfDataGrid.WinForms">
41+
</Reference>
42+
<Reference Include="Syncfusion.SfInput.WinForms" />
43+
<Reference Include="Syncfusion.SfListView.WinForms">
44+
</Reference>
45+
<Reference Include="Syncfusion.Shared.Base" />
46+
<Reference Include="System" />
47+
<Reference Include="System.ComponentModel.DataAnnotations" />
48+
<Reference Include="System.Core" />
49+
<Reference Include="System.Data.Linq" />
50+
<Reference Include="System.Xml.Linq" />
51+
<Reference Include="System.Data.DataSetExtensions" />
52+
<Reference Include="Microsoft.CSharp" />
53+
<Reference Include="System.Data" />
54+
<Reference Include="System.Deployment" />
55+
<Reference Include="System.Drawing" />
56+
<Reference Include="System.Windows.Forms" />
57+
<Reference Include="System.Xml" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Compile Include="Form1.cs">
61+
<SubType>Form</SubType>
62+
</Compile>
63+
<Compile Include="Form1.Designer.cs">
64+
<DependentUpon>Form1.cs</DependentUpon>
65+
</Compile>
66+
<Compile Include="Program.cs" />
67+
<Compile Include="Properties\AssemblyInfo.cs" />
68+
<EmbeddedResource Include="Form1.resx">
69+
<DependentUpon>Form1.cs</DependentUpon>
70+
</EmbeddedResource>
71+
<EmbeddedResource Include="Properties\Resources.resx">
72+
<Generator>ResXFileCodeGenerator</Generator>
73+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
74+
<SubType>Designer</SubType>
75+
</EmbeddedResource>
76+
<Compile Include="Properties\Resources.Designer.cs">
77+
<AutoGen>True</AutoGen>
78+
<DependentUpon>Resources.resx</DependentUpon>
79+
<DesignTime>True</DesignTime>
80+
</Compile>
81+
<None Include="app.config" />
82+
<None Include="Properties\Settings.settings">
83+
<Generator>SettingsSingleFileGenerator</Generator>
84+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
85+
</None>
86+
<Compile Include="Properties\Settings.Designer.cs">
87+
<AutoGen>True</AutoGen>
88+
<DependentUpon>Settings.settings</DependentUpon>
89+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
90+
</Compile>
91+
</ItemGroup>
92+
<ItemGroup>
93+
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
94+
</ItemGroup>
95+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
96+
<ItemGroup>
97+
<Reference Include="Syncfusion.Licensing" />
98+
</ItemGroup>
99+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
100+
Other similar extension points exist, see Microsoft.Common.targets.
101+
<Target Name="BeforeBuild">
102+
</Target>
103+
<Target Name="AfterBuild">
104+
</Target>
105+
-->
106+
</Project>

0 commit comments

Comments
 (0)