小编Pra*_*kla的帖子

使用C#在每行中动态添加Button到ListView

我有一个ListView我必须显示从我的数据库表中提取的所有行.我必须在每一行中给出两个编辑和删除按钮.由于我是初学者,我在XAML中尝试了以下代码 -

<ListView Height="352" HorizontalAlignment="Left" Margin="20,90,0,0" Name="Tab1lstProductCategories" VerticalAlignment="Top" Width="1008">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Category Name" DisplayMemberBinding="{Binding Col1}" Width="200"/>
                                <GridViewColumn Header="Created Date" DisplayMemberBinding="{Binding Col2}" Width="200"/>
                                <GridViewColumn Header="Last Updated" DisplayMemberBinding="{Binding Col3}" Width="200"/>
                                <GridViewColumn Header="Edit" Width="200">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Content="Edit" Click="EditCategory" CommandParameter="{Binding Id}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="Delete" Width="200">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Content="Delete" Click="DeleteCategory"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
Run Code Online (Sandbox Code Playgroud)

在C#中我写了 -

 DataTable dt=db.Select("select * from ProductCategories");
           for (int i = 0; i < dt.Rows.Count; i++)
        {
            //Button edit, delete;
            //edit = …
Run Code Online (Sandbox Code Playgroud)

c# wpf listview

5
推荐指数
1
解决办法
2万
查看次数

在Delphi 7中调用.net 4.0构建的dll

搜索并应用以下问题的所有解决方案后,无法正常工作.我做了什么 - 1.我在C#中创建了一个.dll,使其可见.我用regasm抄了.tlb.3.创建了一个Delphi 7项目,我导入了这个类型库(.tlb)并调用了这个dll的函数.我的电脑上运行正常.

现在当我将这些所有文件(包括.dll,甚至.dcu)复制到另一台PC(安装了.Net framework 4.5)并尝试运行.exe时,它给了我错误" Class not registered ",当我尝试注册它时使用RegSvr32然后它显示错误 - " 未找到入口点 ".

我还缺少什么?在另一台PC上运行带有dll的Delphi 7 exe还有其他先决条件吗?

.net c# delphi dll c#-4.0

4
推荐指数
1
解决办法
808
查看次数

C#vs Delphi-两个代码给出了不同的值‰

任何人都可以告诉我为什么我得到‰符号的不同值?我的Delphi7代码是 -

k := ord('‰'); //k is of type longint; receiving k as 137
Run Code Online (Sandbox Code Playgroud)

我的C#代码是 -

k = (long)('‰');//k is of type long; receiving k as 8240
Run Code Online (Sandbox Code Playgroud)

请给我一个解决方案,我怎样才能在C#中获得相同的价值?因为Delphi代码解决了我的目的.

c# delphi delphi-7

1
推荐指数
1
解决办法
207
查看次数

Delphi 7 vs C#表达式评估

我有一个Delphi-7表达式,如下所示,所有变量都是longint-

cy:=((s1 and s2)or((s1 or s2)and not res))shr 31;
Run Code Online (Sandbox Code Playgroud)

在C#表达式中,所有变量都是int-类型

cy = ((s1 & s2) | ((s1 | s2) & (~res)))>>31;
Run Code Online (Sandbox Code Playgroud)

哪里

s1  = -659459908
s2  =  283372503 
res =  217426595
Run Code Online (Sandbox Code Playgroud)

Delphi 7对它进行评估时,我通过快速观察向右看表达式的值,它将值显示为-1,但是当我ShowMessage(IntToStr(cy))显示为1时.

而C#仍显示-1.

我正在使用Windows-10 64位系统并从VS2013编译任何CPU的代码.我尝试将C#变量声明为Int32,但也会出现相同的现象.

任何人都可以讲述这种现象,我们说什么以及如何进一步发展.

c# delphi delphi-7

1
推荐指数
1
解决办法
217
查看次数

标签 统计

c# ×4

delphi ×3

delphi-7 ×2

.net ×1

c#-4.0 ×1

dll ×1

listview ×1

wpf ×1