本文整理汇总了C#中NetGore.Graphics.GUI.Control类的典型用法代码示例。如果您正苦于以下问题:C# Control类的具体用法?C# Control怎么用?C# Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Control类属于NetGore.Graphics.GUI命名空间,在下文中一共展示了Control类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChatForm
/// <summary>
/// Initializes a new instance of the <see cref="ChatForm"/> class.
/// </summary>
/// <param name="parent">The parent.</param>
/// <param name="pos">The pos.</param>
public ChatForm(Control parent, Vector2 pos) : base(parent, pos, new Vector2(300, 150))
{
// Create the input and output TextBoxes
_input = new TextBox(this, Vector2.Zero, new Vector2(32, 32))
{
IsMultiLine = false,
IsEnabled = true,
Font = GameScreenHelper.DefaultChatFont,
MaxInputTextLength = GameData.MaxClientSayLength,
BorderColor = new Color(255, 255, 255, 100)
};
_output = new TextBox(this, Vector2.Zero, new Vector2(32, 32))
{
IsMultiLine = true,
IsEnabled = false,
Font = GameScreenHelper.DefaultChatFont,
BorderColor = new Color(255, 255, 255, 100)
};
_input.KeyPressed -= Input_KeyPressed;
_input.KeyPressed += Input_KeyPressed;
// Force the initial repositioning
RepositionTextBoxes();
}
示例2: FriendsForm
/// <summary>
/// Initializes a new instance of the <see cref="FriendsForm"/> class.
/// </summary>
/// <param name="userInfo">The user info.</param>
/// <param name="parent">The parent.</param>
/// <exception cref="ArgumentNullException"><paramref name="userInfo" /> is <c>null</c>.</exception>
public FriendsForm(UserInfo userInfo, Control parent)
: base(parent, Vector2.Zero, new Vector2(225, 400))
{
if (userInfo == null)
throw new ArgumentNullException("userInfo");
AddBtn = new Button(this, new Vector2(30, 300), new Vector2(30, 25)) { Text = "Add" };
AddBtn.Clicked += AddBtn_Clicked;
RemoveBtn = new Button(this, new Vector2(90, 300), new Vector2(30, 25)) { Text = "Remove" };
RemoveBtn.Clicked += RemoveBtn_Clicked;
SendBtn = new Button(this, new Vector2(150, 300), new Vector2(30, 25)) { Text = "Send" };
SendBtn.Clicked += SendBtn_Clicked;
// Create the input and output TextBoxes
InputTextBox = new TextBox(this, new Vector2(10, 270), new Vector2(120, 25))
{
IsMultiLine = false,
IsEnabled = true,
Font = GameScreenHelper.DefaultChatFont,
BorderColor = new Color(255, 255, 255, 100)
};
_userInfo = userInfo;
for (int i = 0; i < 50; i++)
{
var position = new Vector2(10, (30 + 15 * i));
FriendsCollection[i] = new Label(this, position) { Text = "", CanFocus = false, Tag = i, Font = GameScreenHelper.DefaultChatFont };
FriendsCollection[i].MouseDown += Friend_Clicked;
}
}
示例3: DragControl
/// <summary>
/// Handles the Drag event of a <see cref="Control"/>.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
void DragControl(Control sender, EventArgs e)
{
var s = (TextControl)sender;
s.Text = s.Position.ToString();
_dragLbl.Text = "Screen Position: " + s.ScreenPosition;
}
示例4: StatsForm
/// <summary>
/// Initializes a new instance of the <see cref="StatsForm"/> class.
/// </summary>
/// <param name="userInfo">The user info.</param>
/// <param name="parent">The parent.</param>
/// <exception cref="ArgumentNullException"><paramref name="userInfo" /> is <c>null</c>.</exception>
public StatsForm(UserInfo userInfo, Control parent) : base(parent, Vector2.Zero, new Vector2(225, 275))
{
if (userInfo == null)
throw new ArgumentNullException("userInfo");
_addStatGrh = new Grh(GrhInfo.GetData("GUI", "AddStat"));
_userInfo = userInfo;
_yOffset = 2;
NewUserInfoLabel("Level", x => x.Level.ToString());
NewUserInfoLabel("Exp", x => x.Exp.ToString());
NewUserInfoLabel("StatPoints", x => x.StatPoints.ToString());
AddLine();
NewUserInfoLabel("HP", x => x.HP + " / " + x.ModStats[StatType.MaxHP]);
NewUserInfoLabel("MP", x => x.MP + " / " + x.ModStats[StatType.MaxMP]);
AddLine();
NewStatLabel(StatType.MinHit);
NewStatLabel(StatType.MaxHit);
NewStatLabel(StatType.Defence);
AddLine();
NewStatLabel(StatType.Str);
NewStatLabel(StatType.Agi);
NewStatLabel(StatType.Int);
}
示例5: SkillsForm
/// <summary>
/// Initializes a new instance of the <see cref="SkillsForm"/> class.
/// </summary>
/// <param name="cooldownManager">The skill cooldown manager.</param>
/// <param name="position">The position.</param>
/// <param name="parent">The parent.</param>
/// <param name="knownSkills">The known skills.</param>
/// <exception cref="ArgumentNullException"><paramref name="knownSkills" /> is <c>null</c>.</exception>
public SkillsForm(ISkillCooldownManager cooldownManager, Vector2 position, Control parent,
KnownSkillsCollection knownSkills) : base(parent, position, new Vector2(32, 32))
{
if (knownSkills == null)
throw new ArgumentNullException("knownSkills");
_knownSkills = knownSkills;
IsVisible = false;
_cooldownManager = cooldownManager;
var fontLineSpacing = Font.GetLineSpacing();
// Find the spacing to use between lines
_lineSpacing = (int)Math.Max(fontLineSpacing, _iconSize.Y);
// Create all the skills
var offset = Vector2.Zero;
foreach (var skillType in EnumHelper<SkillType>.Values)
{
CreateSkillEntry(offset, skillType);
offset += new Vector2(0, _lineSpacing);
}
}
示例6: QuickBarForm
/// <summary>
/// Initializes a new instance of the <see cref="Form"/> class.
/// </summary>
/// <param name="gps">The <see cref="GameplayScreen"/>.</param>
/// <param name="parent">Parent <see cref="Control"/> of this <see cref="Control"/>.</param>
/// <param name="position">Position of the Control reletive to its parent.</param>
/// <exception cref="NullReferenceException"><paramref name="parent"/> is null.</exception>
public QuickBarForm(GameplayScreen gps, Control parent, Vector2 position) : base(parent, position, Vector2.One)
{
ResizeToChildren = false;
_gps = gps;
RepositionSlots();
}
示例7: MiniMapForm
/// <summary>
/// Initializes a new instance of the <see cref="MiniMapForm"/> class.
/// </summary>
/// <param name="parent">The parent.</param>
/// <param name="screen">The game play screen.</param>
public MiniMapForm(Control parent, GameplayScreen screen) : base(parent, new Vector2(50, 50), new Vector2(250, 250))
{
_topLeftPos = new Vector2(this.Position.X + this.Border.LeftWidth, this.Position.Y + this.Border.TopHeight);
_scaledMapGrh = new Grh(null);
_entityCharGrh = new Grh(GrhInfo.GetData("GUI", "MiniMapCharacter"));
_entityNPCGrh = new Grh(GrhInfo.GetData("GUI", "MiniMapNPC"));
_gamePlayScreen = screen;
}
示例8: Toolbar
/// <summary>
/// Initializes a new instance of the <see cref="Toolbar"/> class.
/// </summary>
/// <param name="parent">The parent.</param>
/// <param name="pos">The pos.</param>
public Toolbar(Control parent, Vector2 pos) : base(parent, pos, Vector2.One)
{
ResizeToChildren = true;
ResizeToChildrenPadding = _padding;
_items = CreateToolbarItems();
Position = pos;
}
示例9: TextBox
/// <summary>
/// Initializes a new instance of the <see cref="TextControl"/> class.
/// </summary>
/// <param name="parent">Parent <see cref="Control"/> of this <see cref="Control"/>.</param>
/// <param name="position">Position of the Control reletive to its parent.</param>
/// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
/// <exception cref="NullReferenceException"><paramref name="parent"/> is null.</exception>
public TextBox(Control parent, Vector2 position, Vector2 clientSize) : base(parent, position, clientSize)
{
_numCharsToDraw.TextBox = this;
_editableTextHandler = new EditableTextHandler(this);
// Set the initial line length and number of visible lines
UpdateMaxLineLength();
UpdateMaxVisibleLines();
}
示例10: AvailableQuestsForm
/// <summary>
/// Initializes a new instance of the <see cref="AvailableQuestsForm"/> class.
/// </summary>
/// <param name="parent">Parent <see cref="Control"/> of this <see cref="Control"/>.</param>
/// <param name="position">Position of the Control reletive to its parent.</param>
/// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
/// <param name="hasStartQuestReqs">A func used to check if the user has the requirements to start a quest.</param>
/// <param name="hasFinishQuestReqs">A func used to check if the user has the requirements to finish a quest.</param>
/// <exception cref="NullReferenceException"><paramref name="parent"/> is null.</exception>
public AvailableQuestsForm(Control parent, Vector2 position, Vector2 clientSize, Func<QuestID, bool> hasStartQuestReqs, Func<QuestID, bool> hasFinishQuestReqs)
: base(parent, position, clientSize)
{
_hasStartQuestReqs = hasStartQuestReqs;
_hasFinishQuestReqs = hasFinishQuestReqs;
CreateChildren();
IsVisible = false;
}
示例11: ClickButton_DeleteCharacter
void ClickButton_DeleteCharacter(Control sender, MouseButtonEventArgs args)
{
var s = (CharacterSlotControl)sender;
var ci = s.CharInfo;
if (ci == null)
return;
var mb = new DeleteCharacterMessageBox(GUIManager, ci.Name, ci.Index) { Font = GameScreenHelper.DefaultChatFont };
mb.DeleteRequested += DeleteCharacterMsgBox_DeleteRequested;
}
示例12: StatusEffectsForm
/// <summary>
/// Initializes a new instance of the <see cref="StatusEffectsForm"/> class.
/// </summary>
/// <param name="parent">The parent.</param>
/// <param name="position">The position.</param>
/// <param name="getTime">The get time.</param>
public StatusEffectsForm(Control parent, Vector2 position, IGetTime getTime) : base(parent, position, _iconSize)
{
IsCloseButtonVisible = false;
_getTime = getTime;
Border = null;
CanFocus = false;
CanDrag = false;
}
示例13: GameMenuForm
/// <summary>
/// Initializes a new instance of the <see cref="GameMenuForm"/> class.
/// </summary>
/// <param name="parent">The parent.</param>
public GameMenuForm(Control parent) : base(parent, Vector2.Zero, new Vector2(32))
{
var logOutLbl = new Label(this, new Vector2(3, 3)) { Text = "Log Out" };
logOutLbl.Clicked += logOutLbl_Clicked;
// Center on the parent
Position = (Parent.ClientSize / 2f) - (Size / 2f);
IsVisible = false;
parent.KeyPressed += parent_KeyPressed;
}
示例14: EquippedForm
/// <summary>
/// Initializes a new instance of the <see cref="EquippedForm"/> class.
/// </summary>
/// <param name="dragDropHandler">The drag-drop handler.</param>
/// <param name="infoRequester">The info requester.</param>
/// <param name="position">The position.</param>
/// <param name="parent">The parent.</param>
/// <exception cref="ArgumentNullException"><paramref name="infoRequester" /> is <c>null</c>.</exception>
/// <exception cref="ArgumentNullException"><paramref name="dragDropHandler" /> is <c>null</c>.</exception>
public EquippedForm(DragDropHandler dragDropHandler, ItemInfoRequesterBase<EquipmentSlot> infoRequester, Vector2 position,
Control parent) : base(parent, position, new Vector2(200, 200))
{
if (infoRequester == null)
throw new ArgumentNullException("infoRequester");
if (dragDropHandler == null)
throw new ArgumentNullException("dragDropHandler");
_dragDropHandler = dragDropHandler;
_infoRequester = infoRequester;
CreateItemSlots();
}
示例15: ChatBubble
/// <summary>
/// Initializes a new instance of the <see cref="ChatBubble"/> class.
/// </summary>
/// <param name="parent">The parent <see cref="Control"/>.</param>
/// <param name="owner">The <see cref="Entity"/> that this <see cref="ChatBubble"/> is for.</param>
/// <param name="text">The text to display.</param>
/// <exception cref="ArgumentNullException"><paramref name="owner" /> is <c>null</c>.</exception>
/// <exception cref="ArgumentNullException"><paramref name="text" /> is <c>null</c>.</exception>
public ChatBubble(Control parent, Entity owner, string text) : base(parent, Vector2.Zero, Vector2.Zero)
{
if (owner == null)
throw new ArgumentNullException("owner");
if (string.IsNullOrEmpty(text))
throw new ArgumentNullException("text");
_owner = owner;
_deathTime = (TickCount)(TickCount.Now + Lifespan);
_textControl = new ChatBubbleText(this, text) { Font = Font };
_owner.Disposed += ChatBubble_Owner_Disposed;
}