随笔分类 - C#学习笔记
摘要:使用System.IO.Ports.SerialPort.GetPortNames()枚举可用串口并验证是否被占用,空闲串口添加到comobox1控件中显示。代码如下:验证可用串口 1 public bool IsPortOpen() 2 { 3 //create vars for testing 4 bool _available = false; 5 SerialPort _tempPort; 6 String[] Portname = SerialPort.GetPortNames(); 7 8 //create a loop for each string in SerialPort.
阅读全文
摘要:button控件属性表:PropertyDescriptionAutoEllipsisSpecifies whether to append dots (…) when the text in the button is too long and can't fit the button.AutoSizeSpecifies whether the button will automatically resize to fit its content.FlatStyleDetermines the style of the button. Popup makes the button f
阅读全文
摘要:默认值:Sizable。可供设置的FormBorderStyle 如下表:ValueDescriptionNoneThe form has no border.FixedSingleThe form has a non-resizable single line border.Fixed3DThe form has a non-resizable 3d border.FixedDialogThe form has a thick, non-resizable, dialog style border that has no minimize or maximize boxes.SizableT
阅读全文
摘要:我们在使用messagebox时,通常采用下面的最简化的方式:MessageBox.Show("Hello World!");当我们为messagebox添加标题时,可以这样做:MessageBox.Show("Hello World!", "A Message");也可以使用System.Windows.Forms.MessageBoxButtons enumeration为messagebox添加按钮。MessageBox.Show("Hello World!", "A Message",
阅读全文
摘要:Control.Anchor 属性 :获取或设置控件绑定到的容器的边缘并确定控件如何随其父级一起调整大小。AnchorStyles 值的按位组合。默认值是 Top 和 Left。使用 Anchor 属性可以定义在调整控件的父控件大小时如何自动调整控件的大小。将控件锚定到其父控件后,可确保当调整父控件的大小时锚定的边缘与父控件的边缘的相对位置保持不变。一个控件可以锚定到其容器的一个或多个边缘。例如,如果有一个带有 Button 的 Form,而该按钮的 Anchor 属性值设置为 Top 和 Bottom,当 Form 的 Height 增加时,Button 伸展,以保持到 Form 的上边缘和
阅读全文
摘要:FormBorderStyle :指示窗体的边框和和标题栏的外观和行为。1.None-->无边框;2.FixedSingle-->固定的单行边框;3.Fixed3D-->固定的三维边框;4.FixedDialog-->固定的对话框样式的粗边框;5.Sizable-->可调整大小的边框;6.FixedToolWindow-->不可调整大小的工具窗口边框。工具窗口不会显示在任务栏中也不会显示在当用户按 Alt+Tab 时出现的窗口中。尽管指定 FixedToolWindow 的窗体通常不显示在任务栏中,还是必须确保 ShowInTaskbar 属性设置为 fal
阅读全文
浙公网安备 33010602011771号