本文整理汇总了C#中System.Drawing.Size类的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Size类的具体用法?C# System.Drawing.Size怎么用?C# System.Drawing.Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Drawing.Size类属于命名空间,在下文中一共展示了System.Drawing.Size类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MetroForFly
public MetroForFly(
System.Windows.Forms.Control fatherControl, // 父容器
int flyWidth,
int flyHeight,
System.Drawing.Point locationPoint, // 整体位置
System.Windows.Forms.AnchorStyles anchorstyle
)
{
// 包裹外层
var panelSec = new HPanel
{
Size = new System.Drawing.Size(flyWidth, flyHeight),
Location = locationPoint,
Anchor = anchorstyle,
BackColor = System.Drawing.Color.Transparent
};
Size = new System.Drawing.Size(flyWidth + 3 + 12, flyHeight + 3);
Location = new System.Drawing.Point(-3, -3);
BackColor = System.Drawing.Color.Transparent;
Anchor = BaseAnchor.AnchorFill;
AllowDrop = true;
AutoScroll = true;
MouseDown += MetroForFly_MouseDown;
DragEnter += MetroForFly_DragEnter;
// 加载实体层
panelSec.Controls.Add(this);
// 加载包裹外层
fatherControl.Controls.Add(panelSec);
}
示例2: SizeToSystemSize
public void SizeToSystemSize()
{
var size = new Size(10, 15);
var actual = size.ToSystemSize();
var expected = new System.Drawing.Size(10, 15);
Assert.AreEqual(expected, actual);
}
示例3: _resize
public void _resize() // Set the resize
{
double _form_ratio_width = (double)form.ClientSize.Width / (double)_formSize.Width; // Ratio could be greater or less than 1
double _form_ratio_height = (double)form.ClientSize.Height / (double)_formSize.Height; // This one too
var _controls = _get_all_controls(form); //reenumerate the control collection
int _pos = -1; //do not change this value unless you know what you are doing
// Do some math calculations
foreach (Control control in _controls)
{
_pos += 1; // Increment by 1;
System.Drawing.Size _controlSize = new System.Drawing.Size((int)(_arr_control_storage[_pos].Width * _form_ratio_width),
(int)(_arr_control_storage[_pos].Height * _form_ratio_height)); // Use for sizing
System.Drawing.Point _controlposition = new System.Drawing.Point((int)
(_arr_control_storage[_pos].X * _form_ratio_width), (int)(_arr_control_storage[_pos].Y * _form_ratio_height)); // Use for location
// Set bounds
control.Bounds = new System.Drawing.Rectangle(_controlposition, _controlSize); //Put together
// Assuming you have a datagridview inside a form()
// If you want to show the row header, replace the false statement of
// showRowHeader on top/public declaration to true;
if (control.GetType() == typeof(DataGridView))
_dgv_Column_Adjust(((DataGridView)control), showRowHeader);
//Font AutoSize
control.Font = new System.Drawing.Font(form.Font.FontFamily,
(float)(((Convert.ToDouble(_fontsize) * _form_ratio_width) / 2) +
((Convert.ToDouble(_fontsize) * _form_ratio_height) / 2)));
}
}
示例4: InitializeComponent
void InitializeComponent ()
{
dataGrid = new DataGrid ();
SuspendLayout ();
//
// dataGrid
//
dataGrid.DataMember = "";
dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
dataGrid.Location = new System.Drawing.Point (10, 50);
dataGrid.Name = "dataGrid";
dataGrid.Size = new System.Drawing.Size (600, 500);
//
// MainForm
//
AutoScaleBaseSize = new System.Drawing.Size (5, 13);
ClientSize = new System.Drawing.Size (700, 600);
Controls.Add (dataGrid);
Text = "SWF-Datagrid RealSample";
Name = "MainForm";
Load += new System.EventHandler (MainFormLoad);
ResumeLayout (false);
}
示例5: InitializeComponent
private void InitializeComponent()
{
this.Size = new System.Drawing.Size(500, 500);
int w = this.Size.Width - 50;
int h = this.Size.Height - 50;
System.Drawing.Size sizeTabControl = new System.Drawing.Size(w, h);
this.tabControl = new System.Windows.Forms.TabControl();
this.tabControl.Controls.Add(new TabPageProfesionales(sizeTabControl));
this.tabHorarios = new TabPageConfiguracionHorarios();
this.tabControl.Controls.Add(this.tabHorarios);
this.Controls.Add(this.tabControl);
this.Size = new System.Drawing.Size(500, 500);// SystemInformation.VirtualScreen.Size;
this.tabControl.Size = sizeTabControl;
this.tabControl.SuspendLayout();
this.SuspendLayout();
//
// tabHorarios
//
this.tabHorarios.Location = new System.Drawing.Point(0,0);
this.tabHorarios.Name = "tabHorarios";
this.tabHorarios.Padding = new System.Windows.Forms.Padding(3);
this.tabHorarios.Size = this.tabControl.Size;
this.tabHorarios.TabIndex = 1;
this.tabHorarios.Text = "Horarios";
this.tabHorarios.UseVisualStyleBackColor = true;
}
示例6: UserDialog
public UserDialog (IWin32Window owner, Control content, MessageBoxButtons buttons)
{
InitializeComponent();
ClientSize = new System.Drawing.Size(content.Width, content.Height + buttonPanel.Height);
contentPanel.Controls.Add(content);
content.Dock = DockStyle.Fill;
StartPosition = owner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent;
if (buttons == MessageBoxButtons.OK)
{
okButton.Visible = true;
cancelButton.Visible = false;
}
else if (buttons == MessageBoxButtons.OKCancel)
{
okButton.Visible = true;
cancelButton.Visible = true;
}
else
{
throw new NotImplementedException("UserDialog currently only supports OK and OKCancel values for MessageBoxButtons");
}
}
示例7: ChangeApiKey
private static DialogResult ChangeApiKey(ref string input)
{
System.Drawing.Size windowSize = new System.Drawing.Size(200, 60);
Form inputBox = new Form();
inputBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
inputBox.ClientSize = windowSize;
inputBox.Text = "Enter or edit API key";
inputBox.StartPosition = FormStartPosition.CenterParent;
System.Windows.Forms.TextBox keyField = new TextBox();
keyField.Text = input;
keyField.Size = new System.Drawing.Size(windowSize.Width - 10, 23);
keyField.Location = new System.Drawing.Point(5, 2);
inputBox.Controls.Add(keyField);
Button okButton = new Button();
okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
okButton.Name = "okButton";
okButton.Size = new System.Drawing.Size(75, 23);
okButton.Text = "OK";
okButton.Location = new System.Drawing.Point(windowSize.Width / 2 - 37, 30);
inputBox.Controls.Add(okButton);
inputBox.AcceptButton = okButton;
DialogResult result = inputBox.ShowDialog();
input = keyField.Text;
return result;
}
示例8: OnWindowClosing
private void OnWindowClosing(object sender, CancelEventArgs e)
{
//WindowInteropHelper helper = new WindowInteropHelper(this);
System.Drawing.Size size = new System.Drawing.Size((int)this.ActualWidth, (int)this.ActualHeight);
SHAppBarMessageHelper.RegisterBar(handle, size);
}
示例9: VirtualProjector
public VirtualProjector(string name, string uuid, Size imageSize, PointF principal, double focalLength, Screen screen, Chessboard chessboard, CaptureCamera captureCamera)
: base(name, uuid, imageSize, principal, focalLength, screen, chessboard, captureCamera)
{
OrbitCamera = new OrbitCamera("{0} Orbit".FormatWith(name), "N/A", imageSize, principal, focalLength,
Intrinsics.NearPlaneDistance, Intrinsics.FarPlaneDistance) { Color = Color.DarkCyan.Alpha(0.7f), };
Color = Color.DarkKhaki.Alpha(0.6f);
ProgramTask.AttachInputToCamera(Program.WhenInput.Where(input => !input.KeyPressed(Keys.C)), Window, OrbitCamera);
Program.WhenInput.Where(input => input.KeyDown(Keys.P)).Subscribe(input =>
{
var frustum = new Frustum(OrbitCamera, Intrinsics.ImageSize);
var plane = new Plane(Vector3.UnitZ, 0);
var p0 = frustum.IntersectWithPlane(ProjectorQuadCorners[0].X, ProjectorQuadCorners[0].Y, plane).ToPointF();
var p1 = frustum.IntersectWithPlane(ProjectorQuadCorners[1].X, ProjectorQuadCorners[1].Y, plane).ToPointF();
var p2 = frustum.IntersectWithPlane(ProjectorQuadCorners[2].X, ProjectorQuadCorners[2].Y, plane).ToPointF();
var p3 = frustum.IntersectWithPlane(ProjectorQuadCorners[3].X, ProjectorQuadCorners[3].Y, plane).ToPointF();
var quadCorners = new[] { p0, p1, p2, p3, };
// Chessboard.HomographTo(quadCorners);
});
}
示例10: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
button1 = new System.Windows.Forms.Button();
SuspendLayout();
//
// button1
//
button1.Location = new System.Drawing.Point(52, 36);
button1.Name = "button1";
button1.Size = new System.Drawing.Size(75, 23);
button1.TabIndex = 0;
button1.Text = "button1";
button1.UseVisualStyleBackColor = true;
//
// GameMusic
//
AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(534, 311);
Controls.Add(button1);
Name = "GameMusic";
Text = "GameMusic";
FormClosing += new System.Windows.Forms.FormClosingEventHandler(GameMusic_FormClosing);
ResumeLayout(false);
}
示例11: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
tmrApp = new System.Windows.Forms.Timer(components)
{
Interval = 2,
Enabled = true
};
SuspendLayout();
//
// tmrApp
//
tmrApp.Tick += new System.EventHandler(tmrApp_Tick);
//
// Maze_Form
//
AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
BackColor = System.Drawing.Color.FromArgb(31,31,31);
ClientSize = new System.Drawing.Size(484, 461);
DoubleBuffered = true;
KeyPreview = true;
Name = "MazeForm";
Text = "Maze AI";
Load += new System.EventHandler(Form1_Load);
Paint += new System.Windows.Forms.PaintEventHandler(Form1_Paint);
KeyDown += new System.Windows.Forms.KeyEventHandler(Form1_KeyDown);
MouseClick += new System.Windows.Forms.MouseEventHandler(Form1_LeftClick);
MouseMove += new System.Windows.Forms.MouseEventHandler(Form1_MouseMove);
Resize += new System.EventHandler(Form1_Resize);
Shown += new System.EventHandler(OnShow);
ResumeLayout(false);
}
示例12: InputProvider
public InputProvider()
{
contactsQueue = new Queue<Contact>();
//monitorSize = SystemInformation.PrimaryMonitorSize;
monitorSize = new Size(1600, 1200);
SendEmptyFrames = false;
}
示例13: OpenGLWriteableBitmapUpdater
/// <summary>
/// Constructor
/// </summary>
public OpenGLWriteableBitmapUpdater(Size size, GraphicsMode graphicsMode, Action<GLControl> onPrepare = null, Action<GLControl> onFinalize = null)
{
this.loaded = false;
this.Size = size;
this.framebufferId = -1;
this.OnPrepare += onPrepare;
this.OnFinalize += onFinalize;
messagingTask.StartMessageLoop(
prepare: () =>
{
this.glControl = new GLControl(graphicsMode);
this.glControl.MakeCurrent();
if (this.OnPrepare != null)
{
this.OnPrepare(this.glControl);
this.OnPrepare -= onPrepare;
}
},
finalize: () =>
{
if (this.OnFinalize != null)
{
this.OnFinalize(this.glControl);
this.OnFinalize -= onFinalize;
}
this.glControl.Context.MakeCurrent(null);
this.glControl.Dispose();
});
}
示例14: SubFrame
public SubFrame(JsonObject jsonSchedule)
: base()
{
JsonObjectCollection col = (JsonObjectCollection)jsonSchedule;
//string jsonstr = col.ToString();
int xPos = int.Parse(col["xPos"].GetValue().ToString());
int yPos = int.Parse(col["yPos"].GetValue().ToString());
int hLen = int.Parse(col["hLen"].GetValue().ToString());
int vLen = int.Parse(col["vLen"].GetValue().ToString());
string media = (string)col["fileName"].GetValue();
int volum = int.Parse(col["volume"].GetValue().ToString());
BackColor = System.Drawing.Color.Black;
Location = new System.Drawing.Point(xPos,yPos);
Name = "NDS20 Player";
Size = new System.Drawing.Size(hLen, vLen);
TabIndex = 0;
Text = "NDSPlayerControl";
VlcLibDirectory = null;
VlcLibDirectoryNeeded += new
System.EventHandler<Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs>
(this.OnVlcControlNeedLibDirectory);
SetMedia(new FileInfo(@media));
// Audio.Volume = 10;
Rate = 2.0f;
}
示例15: MenuStrip
public MenuStrip()
{
BorderColor = Drawing.Color.Transparent;
Orientation = Forms.Orientation.Horizontal;
Padding = new Padding(2);
Size = new System.Drawing.Size(600, 24);
}