小编Nae*_*Nae的帖子

使用语句与命名空间路径?C#

我最近停止使用,而是使用我调用的任何对象的完整命名空间路径.

例:

using System;    

namespace QuizViewer
{
    class Class1
    {
        Console.WriteLine("Hello World!");
    }
}
Run Code Online (Sandbox Code Playgroud)

这就是我现在所做的.

namespace QuizViewer
{
    class Class1
    {
        System.Console.WriteLine("Hello World!");
    }
}
Run Code Online (Sandbox Code Playgroud)

在你问为什么我这样做之前,我正在使用这种风格,以便我可以准确地看到我的对象来自哪里,并且在使用不同的Timer对象和具有相似名称的其他对象时更容易.

这种编程风格是否有任何性能提升或降低?

.net c# namespaces using-statement

20
推荐指数
5
解决办法
5902
查看次数

在.Net 4.5中无法识别HttpUtility

我开发了一个WinForm应用程序,目标框架设置为.net 4.0,现在我希望添加到一个项目,它的目标框架设置为.net 4.5.在我将4.0 WinForm应用程序添加到我的4.5项目后,我不断在我的HttpUtility对象上收到错误.

 data += "&batch_data=" + HttpUtility.UrlEncode(batch, System.Text.Encoding.GetEncoding("ISO-8859-1"));
Run Code Online (Sandbox Code Playgroud)

"当前上下文中不存在名称'HttpUtility'"

我确实包含了HttpUtility所在的System.Web命名空间.

Visual Studio错误:

CS0234 The type or namespace name 'HttpUtility' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Run Code Online (Sandbox Code Playgroud)

c# winforms system.web

20
推荐指数
2
解决办法
4万
查看次数

Visual Studio Code - 多个键盘快捷键?

有没有办法在VS代码中为一个动作设置两个键盘快捷键?例如,我想通过按左箭头键或Alt+ 将光标移动到左侧A.

visual-studio-code

20
推荐指数
2
解决办法
3510
查看次数

为什么有状态小部件被定义为flutter中的两个类?

我是新手扑动/飞镖,所以当我尝试制作应用程序时,我也试着理解为什么事情是某种方式.在flutter文档中,有一个有状态小部件的示例代码,如下所示:

class YellowBird extends StatefulWidget {
  const YellowBird({ Key key }) : super(key: key);

  @override
  _YellowBirdState createState() => new _YellowBirdState();
}

class _YellowBirdState extends State<YellowBird> {
  @override
  Widget build(BuildContext context) {
    return new Container(color: const Color(0xFFFFE306));
  }
}
Run Code Online (Sandbox Code Playgroud)

问题:

  1. 为什么他们用两个类而不是一个类定义?我猜测State类可以在其他地方使用,所以最好分开.

  2. 从我的理解,createState()函数返回一个类型的对象State,所以_YellowBirdState extends State有意义,但为什么YellowBird传递到泛型类State?我的猜测它与Yellowbird扩展StatefulWidget课程有关但不太确定.

generics dart flutter

18
推荐指数
3
解决办法
2221
查看次数

有什么区别:=和= mysql赋值运算符

有什么区别:MySql中的=和=赋值运算符?

使用这两个地方哪个地方稳定?

它是相同的还是仅仅是另一种选择?

mysql

14
推荐指数
2
解决办法
2596
查看次数

无边框颜色的圆角文本文件

我需要一个圆角TextField,我可以这样做,但它显示的是默认边框颜色。我尝试更改borderSide但无法更改颜色(它仍然是黑色):

       TextFormField(
                decoration: InputDecoration(
                    prefixIcon: Icon(
                      Icons.person,
                      color: Colors.white,
                    ),
                    border: OutlineInputBorder(
                      // width: 0.0 produces a thin "hairline" border
                      borderRadius: BorderRadius.all(Radius.circular(90.0)),
                      borderSide: BorderSide(color: Colors.white24)
                      //borderSide: const BorderSide(),
                    ),

                    hintStyle: TextStyle(color: Colors.white,fontFamily: "WorkSansLight"),
                    filled: true,
                    fillColor: Colors.white24,
                    hintText: 'Password'),
              ),
Run Code Online (Sandbox Code Playgroud)

我需要这个,我不想要焦点线,但光标应该是白色的。我试图更改border参数中的所有内容,但仍然没有更改。

我想要:

在此处输入图片说明

我得到这个:

在此处输入图片说明

android text flutter

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

从TextCtrl框中获取字符串

如何从TextCtrl盒子里拿出琴弦?这是练习代码:

import wx



class citPanel(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)


        wx.StaticText(self, -1, "Choose put you would like:", (45, 15))

        self.quote = wx.StaticText(self, -1, "1:", wx.Point(275, 180), wx.Size(200, -1))
        self.quote = wx.StaticText(self, -1, "2:", wx.Point(275, 230), wx.Size(200, -1))
        self.quote = wx.StaticText(self, -1, "3:", wx.Point(275, 280), wx.Size(200, -1))




class nextButton(wx.Button):
    def __init__(self, parent, id, label, pos):
        wx.Button.__init__(self, parent, id, label, pos)

class cancelButton(wx.Button):
    def __init__(self, parent, id, label, pos):
        wx.Button.__init__(self, parent, id, label, pos)

class searchBox(wx.TextCtrl):
def __init__(self, …
Run Code Online (Sandbox Code Playgroud)

python wxpython textctrl

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

如何使Tkinter小部件居中?

我有Tkinter的窗口,canvaslabel用200x200的图片就可以了.label无论窗口大小如何,我都希望在窗口的中心.

from Tkinter import *
import Image, ImageTk, ImageDraw

imgsize = (200,200)
canvas_bg = "#000000"

root = Tk()
## root.geometry("350x350")

panel = PanedWindow()
panel.pack(expand=0)

canvas = Canvas(panel, bg=canvas_bg)

blank_source = Image.new('RGBA',imgsize, "#ffffff")
blank = ImageTk.PhotoImage(blank_source)

label = Label(canvas, image=blank)
label.configure(image = blank)

canvas.pack( expand=0)
mainloop()
Run Code Online (Sandbox Code Playgroud)

有什么办法吗?

python tkinter

9
推荐指数
1
解决办法
3万
查看次数

如何使用grid()水平居中小部件?

grid()用来将小部件放在tkinter窗口中.我试图在窗口的水平中心放置一个标签,让它保持在那里,即使窗口调整大小.我怎么能这样做?

pack()顺便说一句,我不想用.我想继续使用grid().

python tkinter widget grid-layout

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

无法获取 cmap 表大小!扑腾

E/flutter ( 7514): [ERROR:flutter/third_party/txt/src/minikin/FontFamily.cpp(184)] Could not get cmap table size!
E/flutter ( 7514): 
F/flutter ( 7514): [FATAL:flutter/third_party/txt/src/minikin/FontCollection.cpp(95)] nTypefaces == 0
F/libc    ( 7514): Fatal signal 6 (SIGABRT), code -6 in tid 7541 (1.ui)
Run Code Online (Sandbox Code Playgroud)

dart flutter

8
推荐指数
2
解决办法
5766
查看次数