天道酬勤,学无止境

Need a very customized large Winforms grid

I am about to develop a Windows PC application (it can be WinForms or WPF) and my main concern is a UI problem I will have to address.

Basically, I need to have a grid of about 50x50 that I need to get input from the user for. That's 2500 fields. Realistically most will be left blank, about 10% will be filled out by a user. Each field can be blank or have a number from 1 to 4. I want easy input - a drop down box perhaps (since it doesn't make sense to tab through all 2500 fields when with the keyboard, I want the user to fill out the values with the mouse).

I was thinking the drop down boxes or maybe even labels that change value when you click them, but the problem is (from the tests I've done) adding 2500 of ANY type of control will make the interface horribly slow. I tried using a tablelayoutpanel in a WinForms app with the suspend/resumeupdate functions, and also doublebuffering and that helps a bit, but it's still terribly slow. I am reluctant to go the DataGridView route because I need VERY custom headers and I need the UI to auto update some percentages as the user changes values in the fields. But I will not be opposed if that's my only option.

I heard WPF may be better since you can have many controls and each one doesn't take its own windows handle, and there's virtualization (not sure how hard that is to implement).

I'm open to suggestions. I know someone will suggest to break up the grid, which I may end up doing. Either way, I'd like to know the most efficient method for a large grid with many controls in a Windows app as if I were going to develop this without breaking up the grid.

I'm using VS 2013, developing in C#, .NET 4.0.

Thanks!

评论

As demonstrated by @Kerry's answer, the winforms answer to almost everything is "you can't do that in winforms, therefore you need to create a much poorer substitute UI design that fits into winforms limitations." - that is not what I would expect from any decent UI framework.

This is what I achieved in WPF in 10 minutes with some 20 lines of C# code and 50 lines of XAML:

enter image description here

  • The response time when interacting with this WPF UI is Immediate on my machine (an I5 CPU and a regular video card). Even with no virtualization (since I'm using an UniformGrid which does not virtualize), this is way better than anything you can ever hope to achieve in winforms.
  • I introduced a ComboBox with numbers 1-4 as you requested.
  • Fully customizable (without resorting to any "owner draw" hacks). I even added these Row and Column numbers which of course are all part of the scrollable area.
  • Touch-Ready - this kind of big-scrolling UI is really better suited for a touch device. Something that the winforms paradigm does not even take into account. Otherwise, you could also implement Excel-like keyboard navigation in the grid with the arrow keys to create a better non-touch user experience.
  • With a small effort you could also make the row and column headers fixed while retaining their consistency with the scroll offset of the entire grid.
  • This is actually a ListBox, which means it has the concept of SelectedItem and it also by default exhibits the ListBox-like visual style (you can see the light-blue background and outline on the selected item).
  • The logic is decoupled from the UI by creating a proper ViewModel with a collection of Items and then using ItemsControls to let WPF do it's job of creating the UI. There's not a single line of C# code in this example that manipulates any UI element. It's all done via beautiful DataBinding.

Full source:

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <DataTemplate x:Key="MarkerTemplate">
            <Border BorderBrush="Gray" BorderThickness="1" Margin="1" Background="Gainsboro">
                <Grid Width="50" Height="30">
                    <TextBlock Text="{Binding}" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Grid>
            </Border>
        </DataTemplate>

        <Style TargetType="ListBoxItem">
            <Setter Property="Padding" Value="0"/>
        </Style>
    </Window.Resources>

    <DockPanel>
        <ListBox ItemsSource="{Binding Items}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="Gray" BorderThickness="1">
                    <Grid Width="50" Height="30">
                        <TextBlock Text="{Binding Value}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                        <ComboBox x:Name="ComboBox" SelectedItem="{Binding Value}" 
                                  IsDropDownOpen="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"
                                  Visibility="Collapsed">
                            <sys:Int32>1</sys:Int32>
                            <sys:Int32>2</sys:Int32>
                            <sys:Int32>3</sys:Int32>
                            <sys:Int32>4</sys:Int32>
                        </ComboBox>
                    </Grid>
                    </Border>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
                            <Setter TargetName="ComboBox" Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
            </ListBox.ItemTemplate>

            <ListBox.Template>
                <ControlTemplate TargetType="ListBox">
                    <ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                        <DockPanel>
                            <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding ColumnMarkers}"
                                ItemTemplate="{StaticResource MarkerTemplate}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <VirtualizingStackPanel Orientation="Horizontal"/>
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>

                            <ItemsControl DockPanel.Dock="Left" ItemsSource="{Binding RowMarkers}"
                                          ItemTemplate="{StaticResource MarkerTemplate}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <VirtualizingStackPanel Orientation="Vertical"/>
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>

                            <UniformGrid Rows="50" Columns="50" IsItemsHost="True"/>
                        </DockPanel>
                    </ScrollViewer>
                </ControlTemplate>
            </ListBox.Template>
        </ListBox>
    </DockPanel>
</Window>

Code Behind:

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;

namespace WpfApplication3
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            DataContext = new ViewModel();
        }
    }
}

ViewModel:

public class ViewModel
{
    public List<string> RowMarkers { get; set; }

    public List<string> ColumnMarkers { get; set; }

    public ObservableCollection<Item> Items { get; set; }

    public ViewModel()
    {
        RowMarkers = Enumerable.Range(1, 50).Select(x => x.ToString()).ToList();
        ColumnMarkers = new[] { " " }.Concat(Enumerable.Range(1, 50).Select(x => x.ToString())).ToList();

        var list = new List<Item>();

        for (int i = 0; i < 50; i++)
        {
            for (int j = 0; j < 50; j++)
            {
                list.Add(new Item());
            }
        }

        Items = new ObservableCollection<Item>(list);
    }
}

Data Item:

public class Item
{
    public int? Value { get; set; }
}
  • You will probably want to add Row and Column properties to the Item class so that you can keep track of what rows/columns actually contain values. Then You could use LINQ like so:

    var values = Items.Where(x => Value != null);
    

    and obtain a list of Items and get item.Row and Item.Column for each of them.

  • Forget winforms. It's completely useless. - at this point, winforms is completely obsolete. Whatever you can achieve with winforms, you can achieve the same thing in WPF with 10% the amount of code and probably with much better results. winforms is not recommended for any new projects, only to maintain legacy applications. It is an ancient technology that is not suited to cater for today's UI needs. That's why Microsoft created WPF to replace it.

  • WPF Rocks. Just copy and paste my code in a File -> New Project -> WPF Application and see the results for yourself.

  • Let me know if you need further help.

Important Note: the WPF default control templates are much lighter weight in Windows 8 than their Windows 7 counterparts (following the Windows 8 philosophy of removing the heavy Aero stuff and practically all transparencies to have a smaller UI footprint).

This means that testing my code on Windows 7 might not yield the expected results in terms of performance. If that happens to be the case, Don't worry. It is fixable. A small amount of additional XAML would have to be introduced (some Styles and ControlTemplates) to replace the Windows 7 defaults by something "faster".

Although you've already got your answer and it's an old post, I will give you a solution using the useless alternative, just for sport and to show to some people that it's not as useless as they think. Of course it is faster to do some things in WPF (IF you know it very well) and maybe shorter most of the times, but if you're a real programmer, there is no such thing as 'useless framework'.

This is just a raw example (you won't use it anyway) so don't be the fussy kind. It could use some image for cells for better look etc, but that's not important. Anyway, it's a complete Control (no designer code required), so if you paste the code in your solution somewhere, you will be able to place it on your form from the ToolBox and you'll immediately see how it looks. Run it to test the behavior. Index it with [x,y] to get or set values programatically.

public class ValuesPanel : Panel
{
    public int this[int x, int y] { get { return cells[x, y]; } set { cells[x, y] = value; } }
    private int[,] cells = new int[50, 50];
    const int cell_width = 15, cell_height = 15;
    private int x, y, scroll_x, scroll_y;

    public ValuesPanel()
    {
        SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
        AutoScrollMinSize = new Size(50 * cell_width, 50 * cell_height);
        BorderStyle = BorderStyle.Fixed3D;
        Cursor = Cursors.Hand;
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        e.Graphics.FillRectangle(Brushes.DeepSkyBlue, x * cell_width - scroll_x, y * cell_height - scroll_y, cell_width, cell_height);
        for (int j = 0; j < 50; j++)
            for (int i = 0; i < 50; i++)
            {
                int xx = i * cell_width - scroll_x, yy = j * cell_height - scroll_y;
                e.Graphics.DrawString(cells[i, j].ToString(), Font, new SolidBrush(ForeColor), new PointF(3 + xx, 1 + yy));
                e.Graphics.DrawLine(Pens.Gray, xx, yy, xx + cell_width - 2, yy);
                e.Graphics.DrawLine(Pens.Gray, xx, yy + cell_height - 2, xx, yy);
                e.Graphics.DrawLine(Pens.White, xx + 1, yy + cell_height - 1, xx + cell_width - 1, yy + cell_height - 1);
                e.Graphics.DrawLine(Pens.White, xx + cell_width - 1, yy + 1, xx + cell_width - 1, yy + cell_height - 1);
            }
    }

    protected override void OnScroll(ScrollEventArgs se)
    {
        Invalidate();
        base.OnScroll(se);
        scroll_x = HorizontalScroll.Value;
        scroll_y = VerticalScroll.Value;
    }

    protected override void OnMouseMove(MouseEventArgs e)
    {
        base.OnMouseMove(e);
        x = Math.Min(49, (e.Location.X + scroll_x) / cell_width);
        y = Math.Min(49, (e.Location.Y + scroll_y) / cell_height);
        Invalidate();
    }

    protected override void OnMouseDown(MouseEventArgs e)
    {
        base.OnMouseDown(e);
        if (e.Button == MouseButtons.Left)
            cells[x, y] = (cells[x, y] % 4) + 1;
        else if (e.Button == MouseButtons.Right)
            cells[x, y] = cells[x, y] < 2 ? 4 : cells[x, y] - 1;
    }
}

I really like WPF, but I can't stand someone calling WinForms "useless". Keep coding! ;)

You need to categorize those inputs into logical groups.

Imagine a form, similar to the Properties window in Visual Studio. At the top is a combobox that lists all the major logical groups (Airplanes, Cars, Tractors, Buses, Etc). When selected, a datagridview appears with the first column being the name of the property, and second column holding the value.

All properties must have default values and must clearly reflect that in the datagridview.

A Save button in the lower right hand corner of the form is available that when pressed, saves the current logical group values.

The datagridview must be scrollable. You only show 15-20 items like the Properties window does.

When the user selects another logical group from the combobox, that logical groups properties and values are loaded.

This is a much cleaner way to get user input and is easily understood by the user.

Don't present the user with a 50x50 grid expecting them to know what to fill in and what not to. Pretend you are designing for a kid. Make it simple and easy to recognize and understand.

Perhaps, I am late to this party, but I have stumbled across this old question while browsing StackOverflow. I saw no WinForms solution among the answers, and I thought my answer could help people searching for a solution solely for this platform.

Below is the solution I implemented with our iGrid WinForms grid in a minute:

private iGDropDownList myCombo = new iGDropDownList();

private void Form1_Load(object sender, EventArgs e)
{
    myCombo.Items.Add(1);
    myCombo.Items.Add(2);
    myCombo.Items.Add(3);
    myCombo.Items.Add(4);

    iGrid1.DefaultCol.CellStyle.DropDownControl = myCombo;

    iGrid1.Cols.Count = 50;
    iGrid1.Rows.Count = 50;
}

And the corresponding screenshot:

If you want, you can hide all combobox buttons by setting the ShowControlsInAllCells property to false.

One of the main benefits of using iGrid for such a solution is that it works extremely fast even on cheap low-end tablets. The cells of iGrid do not contain real combobox controls, this all is drawn in highly-optimized drawing code only in the cells currently visible in the viewport. Thus, for iGrid there is no difference whether you display 50 or 500'000 rows - the contents will be drawn and scrolled with the same speed.

You can add to this that iGrid is still being developed and supported, even in 2017!

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • 在ListView的网格中显示128x128像素或更大的缩略图图标(Displaying thumbnail icons 128x128 pixels or larger in a grid in ListView)
    问题 原始问题(请参阅下面的更新) 我有一个WinForms程序,它需要一个带有大图标(实际上是128x128或更大的缩略图)的体面的可滚动图标控件,可以单击该图标来突出显示或双击来执行某些操作。 最好将空间浪费最小化(每个图标下方可能需要短文件名标题;如果文件名太长,我可以添加省略号)。 (来源:updike.org) 我尝试将ListView与LargeIcon(默认为.View)一起使用,结果令人失望: (来源:updike.org) 也许我没有正确填充控件? 代码: ImageList ilist = new ImageList(); this.listView.LargeImageList = ilist; int i = 0; foreach (GradorCacheFile gcf in gc.files) { Bitmap b = gcf.image128; ilist.Images.Add(b); ListViewItem lvi = new ListViewItem("text"); lvi.ImageIndex = i; this.listView.Items.Add(lvi); i++; } 我需要带有很少空白空间的大图标,而不需要带有令人尴尬的小图标的大空白空间。 是否有我需要的.NET控件? 有没有喜欢的第三方控件可以做到这一点? 如果不是
  • WinForms带有背景图像的分层控件在滚动时会导致撕裂(WinForms Layered Controls with Background images cause tearing while scrolling)
    问题 我有一个具有以下属性的Form : 背景图片具有透明背景的可滚动Panel ,并且Dock = DockStyle.Fill 具有Width和Height PictureBox ,它显示滚动条 现在,所有控件都设置为DoubleBuffered,包括窗体本身。 除了滚动PictureBox的面板时,一切都按预期进行,滚动窗体背景图像时,它会重复显示垂直和水平撕裂,尽管它的静态图像适合窗体的大小;而当您停止滚动时,它会正确显示。 这仅在拖动滚动条时发生,如果我单击滚动条中的任何点以将其移动,则显示正确。 根据我的理解,双缓冲应该消除这种情况,但是即使双缓冲相同,也可能会好一些,但滚动时仍然是一个巨大的问题。 我试图将所有控件放置在另一个面板中,而不是使用表单背景图像,并将此面板放置在表单上,​​但是没有任何区别。 回答1 您正在使用Windows系统选项(名称为“拖动时显示窗口内容”)进行战斗。 Windows的所有现代版本都将其打开。 禁用它不是一个现实的目标,因为它是系统选项,会影响所有应用程序的所有窗口。 没有后门可以有选择地绕过此选项。 启用后,操作系统将优化窗口的滚动。 它执行快速bitblt来移动视频帧缓冲区中的像素,并仅针对滚动显示的窗口部分生成绘制消息。 像向下滚动时底部的几行像素一样。 winapi调用的基础是ScrollWindowEx()。
  • Displaying thumbnail icons 128x128 pixels or larger in a grid in ListView
    Original Question (see Update below) I have a WinForms program that needs a decent scrollable icon control with large icons (128x128 or larger thumbnails, really) that can be clicked to hilight or double clicked to perform some action. Preferably there would be minimal wasted space (short filename captions might be needed below each icon; if the filename is too long I can add an ellipsis). (source: updike.org) I tried using a ListView with LargeIcon (default .View) and the results are disappointing: (source: updike.org) Perhaps I am populating the control incorrectly? Code: ImageList ilist =
  • Structuring projects & dependencies of large winforms applications in C#
    UPDATE: This is one of my most-visited questions, and yet I still haven't really found a satisfactory solution for my project. One idea I read in an answer to another question is to create a tool which can build solutions 'on the fly' for projects that you pick from a list. I have yet to try that though. How do you structure a very large application? Multiple smallish projects/assemblies in one big solution? A few big projects? One solution per project? And how do you manage dependencies in the case where you don't have one solution. Note: I'm looking for advice based on experience, not
  • Render winforms controls more smoothly
    My winforms application is rendering very choppy. Is there a technique that can be used to either draw a form off screen, or to have it be hidden until the layout has been processed? Anything to help speed up the visual load of my forms. Thanks for any help. edit: Forms have a couple grids each, and around 20 - 30 additional controls (textboxes / checkboxes). All controls are third party and I don't do any custom painting myself.
  • ListBoxItem中的复杂UI(Complex UI inside ListBoxItem)
    问题 在WPF中,我可以通过为ListBox提供ItemTemplate来将任何UI添加到ListBoxItem : <ListBox ItemsSource="{Binding}"> <ListBox.ItemTemplate> <DataTemplate> <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="8" Padding="4,0,4,0"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="50"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <CheckBox Grid.Column="1" Content="Is Active Customer" IsChecked="{Binding IsActive}"/> <Label Content="Id:" Grid.Row="1" HorizontalAlignment="Right"/> <Label Content="Name:" Grid
  • 创建新的GUI时,WPF是Windows窗体的首选吗? [关闭](When creating a new GUI, is WPF the preferred choice over Windows Forms? [closed])
    问题 从目前的情况来看,这个问题不适合我们的问答形式。 我们希望答案会得到事实,参考或专业知识的支持,但是这个问题可能会引起辩论,争论,民意测验或进一步的讨论。 如果您认为此问题可以解决并且可以重新提出,请访问帮助中心以获取指导。 9年前关闭。 已锁定。 该问题及其答案被锁定,因为该问题是题外话,但具有历史意义。 它目前不接受新的答案或互动。 Windows窗体的大多数限制和技巧对大多数程序员来说都是常见的。 但是从.NET 3.0开始,Windows Presentation Foundation也提供了WPF。 据说您可以使用它使“性感的应用程序”更容易,并且使用.NET 3.5 SP1可以大大提高执行速度。 但是另一方面,WPF的许多工作也有所不同。 我不会说这比较困难,但是您必须从头开始学习“一切”。 我的问题:当您必须创建一个新的GUI并且项目没有时间压力时,花这些额外的时间值得吗? 回答1 WPF使您能够做一些令人惊奇的事情,而我喜欢它……但是,每当开发人员问我是否认为他们应该转向新技术时,我总是有义务限制我的建议。 您的开发人员是否愿意(最好是EAGER)花费时间学习有效使用WPF? 我从没想过要对MFC,Windows Forms甚至是不受管理的DirectX这么说,但是您可能不希望团队在正常开发过程中尝试“挑选” WPF。 循环运输产品!
  • Complex UI inside ListBoxItem
    In WPF, I can add whatever UI into ListBoxItems by providing the ListBox with an ItemTemplate: <ListBox ItemsSource="{Binding}"> <ListBox.ItemTemplate> <DataTemplate> <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="8" Padding="4,0,4,0"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="50"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <CheckBox Grid.Column="1" Content="Is Active Customer" IsChecked="{Binding IsActive}"/> <Label Content="Id:" Grid.Row="1" HorizontalAlignment=
  • Terrible performance of custom-drawn control
    I am making simple graph control in wpf. And I can't explain nor fix performance problem: it's too slow compared to winforms. Perhaps I am doing something wrong. I prepare demo to demonstrate the problem. Here is test control: public class Graph : FrameworkElement { private Point _mouse; private Point _offset = new Point(500, 500); public Graph() { Loaded += Graph_Loaded; } private void Graph_Loaded(object sender, RoutedEventArgs e) { // use parent container with background to receive mouse events too var parent = VisualTreeHelper.GetParent(this) as FrameworkElement; if (parent != null) parent
  • Looking for a custom image grid
    I'm trying to find a grid which is especially designed to show images. It needs to have good performance too, and preferably with some sort of thumbnail cache. The images need to be loaded from files, and it would be good if images can be assigned dynamically too. It shouldn't work on a list of col/row records like standard grids, but a single list of items, each item representing an image. There should be a property to define col width and row height for all cols and rows at once, not one at a time. The end goal is to list all images with user options to control how large to display the
  • WinForms Designer and TableLayoutPanel SmartTag Customization
    I am trying to customize the existing Smart Tag content for a TableLayoutPanel Windows Forms control for use in the Windows Forms designer (I implemented a designer that leverages the WinForms designer features exposed by the System.ComponentModel.Design and System.Windows.Forms.Design namespaces). Whatever approach is offered as a solution, it's got to also work when my control is added to the Visual Studio toolbox and when my control is placed on a WinForm surface in design mode while in the Visual Studio IDE. Here's what I'm trying to do: In design mode, a TableLayoutPanel control instance
  • 如何在winforms应用程序中设置数据网格滚动条的位置?(How can I set the position of my datagrid scrollbar in my winforms app?)
    问题 在我的C#winforms应用程序中,我有一个数据网格。 重新加载datagrid时,我想将滚动条设置回用户设置的位置。 我怎样才能做到这一点? 编辑:我使用的是旧的winforms DataGrid控件,而不是较新的DataGridView 回答1 您实际上并没有直接与滚动条进行交互,而是设置了FirstDisplayedScrollingRowIndex 。 因此,在重新加载之前,请捕获该索引,一旦重新加载,请将其重置为该索引。 编辑:在评论中的好点。 如果您使用的是DataGridView那么它将起作用。 如果您使用的是旧的DataGrid那么最简单的方法是从其继承。 参见此处:链接 DataGrid具有受保护的GridVScrolled方法,该方法可用于将网格滚动到特定行。 若要使用它,请从DataGrid派生一个新的网格并添加ScrollToRow方法。 C#代码 public void ScrollToRow(int theRow) { // // Expose the protected GridVScrolled method allowing you // to programmatically scroll the grid to a particular row. // if (DataSource != null) { GridVScrolled
  • 互太纺织控股有限公司如何迈向工业4.0
    我们公司大概20年前建立,我们在10年前上市。我们有3.5亿美元的营业收入,现在在香港,我们有6000多名员工,同时有一些越南、中国的工厂。我们的差异点是什么?我们有自己的发电厂,一个在越南,一个在中国,所以很多数据要分析,我们也做自己的污水处理。很多人问,为什么要有自己的发电厂呢?因为更便宜吗?不是。发电是很费钱的。第一,有自己的电网,有自己的发电设施就更加稳定。在20年前,我们在中国的时候没有那么稳定。同时我们也使用蒸汽作为我们的副产品,同时还有热水,我们支持自己的发电设备,而且充分利用了这些热能量。 我们有很多的客户,比如说H&M等等知名的零售品牌,在制衣行业,我们还有纱线,还有羊毛、尼龙,然后把它变成长丝长线,然后我们进行纺织,这是第一步;第二步要染色,我们所做的事情都是根据客户的需求按订单生产,最后进入我们的工厂。我们可以做以下的事情:生产、染色、成品,有一些工作间是做染色,有一些做纱线,有一些做纺织。这是一个很大的数据产生的源头,这些信息需要整合在一起,客户说我想要多少的纺织密度,你要分析每一步骤是否达到客户的要求,我们纺织的时候是否达到要求。同时还有高温处理,特别是要保证洗涤时不掉色。最终完工,我们用蒸汽机,要保证它的稳定性。我刚才讲到的染色,像我衣服这种蓝颜色,有两种类型的蓝色,每个用户说的蓝色都是不一样的,因此我们工作的复杂程度是可想而知的。还有一点
  • 使用Windows窗体实现MVC(Implementing MVC with Windows Forms)
    问题 在哪里可以找到一个很好的示例,说明如何在Windows窗体中完全实现MVC模式? 我在各个站点(例如,The Code Project和.NetHeaven)上找到了许多教程和代码示例,但是与MVC相比,它们在观察者模式方面更具代表性。 由于我要开发的应用程序是针对学校项目的,因此我不愿意使用诸如PureMVC或MVC#之类的框架。 回答1 我认为应用程序彼此之间是如此不同,并且我们对应如何编写应用程序的理解仍然非常有限。 我以前处理过的Windows Forms应用程序彼此之间有很大的不同。 我看到的一些设计差异是(包括大多数组合): 直接与数据库对话(2层) 使用已为给定应用程序编写的后端(3层) 使用为许多应用程序编写的一组Web服务,这些Web服务不能为您的应用程序更改。 (面向服务的体系结构) CRUD操作正在完成更新使用命令模式进行更新(将命令发送到后端服务器) 大量使用数据绑定/没有使用数据绑定大多数数据都是“表式”的(例如发票),可以在标准网格控件中很好地工作/对于大多数UI数据都需要自定义控件。 一个开发人员/由10或20个开发人员组成的团队(仅在用户界面上) 使用模拟等进行大量的单元测试/没有单元测试 因此,我认为不可能创建一个总是很合适的MVC(或MVP)实现。 我见过的最好的帖子真正地解释了MVC,以及为什么要以这种方式构建MVC系统,这是Jeremy
  • 2020 前端必看 20个最好的 前端 Web开发工具
    引言 市面上有许多前端开发工具可以加速 Web 开发工作。本文是对一些顶级 Web 开发工具的一次精选汇总,分别介绍了每款工具的关键特性,并已附上下载链接。 1. Novi Builder Novi Builder 是一个拖放式构建器,它对于经验丰富的 Web 开发人员而言是一个不错的选择。它为开发人员提供了访问源代码的权限,并允许开发人员在 Web 设计中进行多项更改。你能用它完全控制你的 Web 项目,并且可以充分利用它的各项功能。尽管这款工具对于初学者来说可能很难入门,但在它的众多优势面前这一不足也就不值一提了。 特性: 高级代码编辑器附加应用集成多种预制主题拖放界面电商功能支持预览工具 下载链接: https://novibuilder.com/ 2. ONE Subscription ONE Subscription 是一款很有用的 Web 开发工具包,包含了众多高质量的数字产品。它提供了大批高品质的部件,可以打造出功能完善的博客、在线商店、登录页面等各种网站。总的来说,它能为你提供数以千计的主题和模板、多种插件和图形元素、附加服务以及其他许多好处。 特性: 对所有部件提供专业支持定期更新安全性(如果你订阅后尚未从数据库中下载任何内容,则可以在订阅开始后的 14 天内轻松取消订阅)无使用限制的年度许可证很多有用的服务(例如模板定制或安装) 下载链接: https:/
  • 正式发布! .NET开发控件集ComponentOne 新版本加入Blazor UI
    近期,由葡萄城推出的ComponentOne .NET开发控件集正式发布最新版本! ComponentOne 是一套专注于企业 .NET开发、支持 .NET Core 平台,并完美集成于 Visual Studio 的第三方控件集,包含 300 多种 .NET 控件种类,提供表格数据处理、数据可视化、报表、日程安排、输入和编辑等七大功能。 本次新版本有一项令无数开发者感到兴奋的新特性: ComponentOne加入了全新的UI控件——Blazor UI。 Blazor是什么?它是一项将C#和 .NET都放入浏览器的Microsoft技术。使用Blazor,开发人员可以在服务器和客户端上直接使用C#编码,构建丰富的Web应用程序。Blazor使用WebAssembly来工作,WebAssembly是一种高性能的管道,可以将代码预编译为紧凑的二进制格式。最重要的是,每个主流浏览器(包括移动版本)都支持WebAssembly。 而在ComponentOne 中加入 Blazor UI控件,意味着C#开发者可以不再过多依赖于HTML、JavaScript和CSS,直接构建出更高性能的移动互联网应用程序。 与此同时,本次发布 ComponentOne 中的所有控件均支持 .NET Core 3.0。开发者在使用ComponentOne搭建企业级 .NET应用,享受 .NET
  • WinForms应用程序的正确本地化(Proper localization of a WinForms application)
    问题 我有一个WinForms应用程序,我想将其翻译成多种语言。 但是,我没有本地化WinForms应用程序的经验,并且我发现与此主题非常矛盾的信息。 基本上,我想要的是: 在源代码中,每种语言只需要一个文件该文件在编译时被编译到主应用程序中-构建应用程序后无需附属程序集或外部数据文件用户可以选择语言,我不需要/想要基于操作系统进行自动检测这应该主要包含strings和ints ,还应该包含CultureInfo 我见过的大多数解决方案每个Form和/或外部附属程序集都有一个.resx文件。 我需要自己动手吗? 还是框架中已经有东西? .net Framework 3.5 SP1如果重要)。 编辑: 在大多数情况下,Visual Studio已经为我想要的提供了支持,但是有两个问题。 当我将Form.Localizable设置为true我得到了这个不错的Designer支持,但是每个Form生成一个resx 。 在InitializeComponent中手动覆盖它的想法失败了,因为它是由设计师编写的代码,将被定期覆盖。 从理论上讲,我只想: a)覆盖ComponentResourceManager的创建,以将其指向我的全局resx并 b) ApplyResources的调用更改为将CultureInfo作为第三个参数的重载。 似乎我必须向构造函数添加一个函数调用
  • 在C#中构造大型Winforms应用程序的项目和依赖项(Structuring projects & dependencies of large winforms applications in C#)
    问题 更新: 这是我最常问到的问题之一,但对于我的项目,我仍然没有真正找到令人满意的解决方案。 我在回答另一个问题时读到的一个想法是创建一个工具,该工具可以为您从列表中选择的项目“即时”构建解决方案。 我还没有尝试过。 您如何构造一个非常大的应用程序? 一个大解决方案中有多个小型项目/装配体? 一些大项目? 每个项目一个解决方案? 在没有解决方案的情况下,如何管理依赖关系。 注意:我在寻找基于经验的建议,而不是您在Google上找到的答案(我可以自己做)。 我目前正在开发一个包含80个dll的应用程序,每个dll都有自己的解决方案。 管理依赖项几乎是一项全职工作。 有一个自定义的内部“源代码控制”,具有添加的功能,可在各处复制依赖项dll。 对我来说似乎是次佳的解决方案,但是有更好的方法吗? 我担心,在实践中使用80个项目的解决方案在实践中会非常困难。 (上下文:winforms,而不是网络) 编辑:(如果您认为这是一个不同的问题,请给我评论) 在我看来,以下两者之间存在相互依存关系: 应用程序的项目/解决方案结构文件夹/文件结构源代码控制的分支结构(如果使用分支) 但是,即使有可能,我也很难将它们分开来单独考虑。 我在这里问了另一个相关的问题。 回答1 源代码控制 我们将20或30个项目构建为4或5个离散解决方案。 我们将Subversion用于SCM。 1
  • 实现全托管,腾讯云服务网格的架构演进
    一、 istio 现状和发展趋势1. istio发展现状 istio现在是目前最流行的服务网格实现,它的流行主要体现在两个方面。一是社区非常的活跃,过去一年,Istio 在 GitHub 增长最快的开源项目排行榜上名列第四。另一方面 istio 在业界有了越来越多的生产落地。在一项云原生调研报告中,已经有18% 的用户在生产环境中使用mesh 技术,而另外47% 的用户正在进行 mesh 落地评估,而在这部分评估和测试的用户中,有接近7成的用户是在评估 istio。istio 今年的一个大事件是将商标转让给了OUC(Open Usage Commons ),官方宣称的目的是给 istio 提供更加中立和独立的监督,当然这个做法不太符合社区的主流期望,也就是大家一直在讨论 istio 什么时候加入cncf,这里我们就不展开讨论。istio 是在 17 年 5月份发布的第一个版本,到目前为止已经演进了三年多,目前有固定的发布节奏,每个季度会发布一个子版本。istio 是在 18年7月发布 1.0 版本,宣布 Production ready,但在这之后 istio 多次的重新定义生产落地,这从一个侧面也反映了 istio 还处在一个高速演进的过程中,大的架构变迁仍然会时有发生。所以说如果大家尝试在生产环境中使用开源 istio,开发和运维人员需要对 istio 组件有深刻的理解
  • 实现全托管,腾讯云服务网格的架构演进
    一、 istio 现状和发展趋势1. istio发展现状 istio现在是目前最流行的服务网格实现,它的流行主要体现在两个方面。一是社区非常的活跃,过去一年,Istio 在 GitHub 增长最快的开源项目排行榜上名列第四。另一方面 istio 在业界有了越来越多的生产落地。在一项云原生调研报告中,已经有18% 的用户在生产环境中使用mesh 技术,而另外47% 的用户正在进行 mesh 落地评估,而在这部分评估和测试的用户中,有接近7成的用户是在评估 istio。istio 今年的一个大事件是将商标转让给了OUC(Open Usage Commons ),官方宣称的目的是给 istio 提供更加中立和独立的监督,当然这个做法不太符合社区的主流期望,也就是大家一直在讨论 istio 什么时候加入cncf,这里我们就不展开讨论。istio 是在 17 年 5月份发布的第一个版本,到目前为止已经演进了三年多,目前有固定的发布节奏,每个季度会发布一个子版本。istio 是在 18年7月发布 1.0 版本,宣布 Production ready,但在这之后 istio 多次的重新定义生产落地,这从一个侧面也反映了 istio 还处在一个高速演进的过程中,大的架构变迁仍然会时有发生。所以说如果大家尝试在生产环境中使用开源 istio,开发和运维人员需要对 istio 组件有深刻的理解