本文整理汇总了C#中Panel.SetSizer方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.SetSizer方法的具体用法?C# Panel.SetSizer怎么用?C# Panel.SetSizer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel.SetSizer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FrontPanelPanel
public FrontPanelPanel(MainFrame parent, ComService comService)
: base(parent)
{
_comService = comService;
_comService.DataArrived += ComDataArrived;
FlexGridSizer sizer = new FlexGridSizer(4, 0, 0);
sizer.Add(new StaticText(this, "External\nVoltage", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
_externalVoltage = new ValueDisplay(this) { Value = "0.0", Unit = "mV" };
sizer.Add(_externalVoltage, 0, SizerFlag.All, 5);
sizer.Add(new StaticText(this, "Load\nVoltage", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
_loadVoltage = new ValueDisplay(this) { Value = "0.0", Unit = "mV" };
sizer.Add(_loadVoltage, 0, SizerFlag.All, 5);
sizer.Add(new StaticText(this, "External\nCurrent", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
_externalCurrent = new ValueDisplay(this) { Value = "0.0", Unit = "mA" };
sizer.Add(_externalCurrent, 0, SizerFlag.All, 5);
sizer.Add(new StaticText(this, "Load\nCurrent", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
_loadCurrent = new ValueDisplay(this) { Value = "0.0", Unit = "mV" };
sizer.Add(_loadCurrent, 0, SizerFlag.All, 5);
sizer.Add(0, 0);
sizer.Add(0, 0);
sizer.Add(new StaticText(this, "Target\nCurrent", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
Panel targetCurrentPanel = new Panel(this);
var targetCurrentSizer = new FlexGridSizer(2, 5, 5);
_targetCurrentSet = new Button(targetCurrentPanel, ID_TargetCurrentSet, "Set");
EvtButton(ID_TargetCurrentSet, (s, e) => SetTargetCurrent());
_targetCurrent = new TextCtrl(targetCurrentPanel, "0.0mA", WxDefaultPosition, new Size(70, _targetCurrentSet.Size.Height));
targetCurrentSizer.Add(_targetCurrent);
targetCurrentSizer.Add(_targetCurrentSet);
targetCurrentPanel.SetSizer(targetCurrentSizer);
targetCurrentSizer.SetSizeHints(targetCurrentPanel);
sizer.Add(targetCurrentPanel, 0, SizerFlag.All, 5);
SetSizer(sizer);
sizer.SetSizeHints(this);
EvtDestroy((s, e) => { OnDestory(); e.Skip(true); });
_targetCurrent.EvtSetFocus((s, e) => _targetCurrentHasFocus = true);
_targetCurrent.EvtKillFocus((s, e) => _targetCurrentHasFocus = false);
}
示例2: CreateSendPanel
private Panel CreateSendPanel()
{
Panel panel = new Panel(this);
BoxSizer sizer = new BoxSizer(Orientation.Horizontal);
_textInput = new TextCtrl(panel, "", WxDefaultPosition, WxDefaultSize, WindowStyles.TextCtrlProcessEnter)
{
Font = _dataFont
};
sizer.Add(_textInput, 1, SizerFlag.Expand | SizerFlag.All, 0);
_textInput.EvtKeyDown((s, e) =>
{
KeyEvent keyEvent = e as KeyEvent;
if (keyEvent != null && keyEvent.KeyCode == 13)
{
OnSend();
}
e.Skip(true);
});
_send = new Button(panel, ID_Send, "Send");
EvtButton(ID_Send, (s, e) => OnSend());
sizer.Add(_send, 0, SizerFlag.Expand | SizerFlag.All, 0);
panel.SetSizer(sizer);
sizer.SetSizeHints(panel);
return panel;
}
示例3: CreateControlPanel
private Panel CreateControlPanel()
{
Panel panel = new Panel(this);
BoxSizer sizer = new BoxSizer(Orientation.Horizontal);
_port = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, new string[0],
WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
UpdatePorts();
sizer.Add(_port, 0, SizerFlag.Expand | SizerFlag.All, 5);
Bitmap refreshBitmap = GetType().Assembly.GetManifestResourceWxBitmap("DummyLoadController.Images.refresh.png");
_refreshPorts = new BitmapButton(panel, ID_RefreshPorts, refreshBitmap);
EvtButton(ID_RefreshPorts, (s, e) => UpdatePorts());
sizer.Add(_refreshPorts, 0, SizerFlag.Expand | SizerFlag.All, 0);
string[] baudRates = new[] { "300", "600", "1200", "2400", "4800", "9600", "14,400", "19,200", "28,800", "38,400", "57,600", "76,800", "115,200", "230,400" };
_baudRate = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, baudRates, WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
_baudRate.Select(5);
sizer.Add(_baudRate, 0, SizerFlag.Expand | SizerFlag.All, 5);
_connect = new Button(panel, ID_Connect, "Connect");
EvtButton(ID_Connect, (s, e) => Connect());
sizer.Add(_connect, 0, SizerFlag.Expand | SizerFlag.All, 5);
_disconnect = new Button(panel, ID_Disconnect, "Disconnect");
EvtButton(ID_Disconnect, (s, e) => _comService.Disconnect());
sizer.Add(_disconnect, 0, SizerFlag.Expand | SizerFlag.All, 5);
panel.SetSizer(sizer);
sizer.SetSizeHints(panel);
return panel;
}