本文整理汇总了C#中System.Windows.Forms.ToolStrip.PointToClient方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStrip.PointToClient方法的具体用法?C# ToolStrip.PointToClient怎么用?C# ToolStrip.PointToClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStrip
的用法示例。
在下文中一共展示了ToolStrip.PointToClient方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderToolButtonBackground
private void RenderToolButtonBackground(Graphics g,
ToolStripButton button,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (button.Enabled)
{
if (button.Checked)
{
if (button.Pressed)
this.DrawGradientToolItem(g, button, _itemToolItemPressedColors);
else if (button.Selected)
this.DrawGradientToolItem(g, button, _itemToolItemCheckPressColors);
else
this.DrawGradientToolItem(g, button, _itemToolItemCheckedColors);
}
else
{
if (button.Pressed)
this.DrawGradientToolItem(g, button, _itemToolItemPressedColors);
else if (button.Selected)
this.DrawGradientToolItem(g, button, _itemToolItemSelectedColors);
}
}
else
{
if (button.Selected)
{
// Get the mouse position in tool strip coordinates
Point mousePos = toolstrip.PointToClient(Control.MousePosition);
// If the mouse is not in the item area, then draw disabled
if (!button.Bounds.Contains(mousePos))
this.DrawGradientToolItem(g, button, _itemDisabledColors);
}
}
}
示例2: RenderToolSplitButtonBackground
private void RenderToolSplitButtonBackground(Graphics g,
ToolStripSplitButton splitButton,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (splitButton.Selected || splitButton.Pressed)
{
if (splitButton.Enabled)
{
if (!splitButton.Pressed && splitButton.ButtonPressed)
this.DrawGradientToolSplitItem(g, splitButton,
_itemToolItemPressedColors,
_itemToolItemSelectedColors,
_itemContextItemEnabledColors);
else if (splitButton.Pressed && !splitButton.ButtonPressed)
this.DrawContextMenuHeader(g, splitButton);
else
this.DrawGradientToolSplitItem(g, splitButton,
_itemToolItemSelectedColors,
_itemToolItemSelectedColors,
_itemContextItemEnabledColors);
}
else
{
// Get the mouse position in tool strip coordinates
Point mousePos = toolstrip.PointToClient(Control.MousePosition);
// If the mouse is not in the item area, then draw disabled
if (!splitButton.Bounds.Contains(mousePos))
this.DrawGradientToolItem(g, splitButton, _itemDisabledColors);
}
}
}
示例3: RenderToolDropButtonBackground
private void RenderToolDropButtonBackground(Graphics g,
ToolStripItem item,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (item.Selected || item.Pressed)
{
if (item.Enabled)
{
if (item.Pressed)
DrawContextMenuHeader(g, item);
else
DrawGradientToolItem(g, item, _itemToolItemSelectedColors);
}
else
{
// Get the mouse position in tool strip coordinates
Point mousePos = toolstrip.PointToClient(Control.MousePosition);
// If the mouse is not in the item area, then draw disabled
if (!item.Bounds.Contains(mousePos))
DrawGradientToolItem(g, item, _itemDisabledColors);
}
}
}
示例4: RenderToolSplitButtonBackground
private void RenderToolSplitButtonBackground(Graphics g,
ToolStripSplitButton splitButton,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (splitButton.Selected || splitButton.Pressed)
{
if (splitButton.Enabled)
{
// Ensure we have cached the objects we need
UpdateCache();
if (!splitButton.Pressed && splitButton.ButtonPressed)
DrawGradientToolSplitItem(g, splitButton, _gradientPressed, _gradientPressed, _gradientPressed);
else if (splitButton.Pressed && !splitButton.ButtonPressed)
DrawContextMenuHeader(g, splitButton);
else
DrawGradientToolSplitItem(g, splitButton, _gradientTracking, _gradientTracking, _gradientTracking);
}
else
{
// Get the mouse position in tool strip coordinates
Point mousePos = toolstrip.PointToClient(Control.MousePosition);
// If the mouse is not in the item area, then draw disabled
if (!splitButton.Bounds.Contains(mousePos))
DrawGradientToolItem(g, splitButton, _disabledGradientItem);
}
}
}
示例5: RenderToolDropButtonBackground
private void RenderToolDropButtonBackground(Graphics g,
ToolStripItem item,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (item.Selected || item.Pressed)
{
if (item.Enabled)
{
if (item.Pressed)
DrawContextMenuHeader(g, item);
else
{
// Ensure we have cached the objects we need
UpdateCache();
DrawGradientToolItem(g, item, _gradientTracking);
}
}
else
{
// Get the mouse position in tool strip coordinates
Point mousePos = toolstrip.PointToClient(Control.MousePosition);
// If the mouse is not in the item area, then draw disabled
if (!item.Bounds.Contains(mousePos))
DrawGradientToolItem(g, item, _disabledItem);
}
}
}
示例6: RenderToolButtonBackground
private void RenderToolButtonBackground(Graphics g,
ToolStripButton button,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (button.Enabled)
{
// Ensure we have cached the objects we need
UpdateCache();
if (button.Checked)
{
if (button.Pressed)
DrawGradientToolItem(g, button, _gradientPressed);
else if (button.Selected)
DrawGradientToolItem(g, button, _gradientCheckedTracking);
else
DrawGradientToolItem(g, button, _gradientChecked);
}
else
{
if (button.Pressed)
DrawGradientToolItem(g, button, _gradientPressed);
else if (button.Selected)
DrawGradientToolItem(g, button, _gradientTracking);
}
}
else
{
if (button.Selected)
{
// Get the mouse position in tool strip coordinates
Point mousePos = toolstrip.PointToClient(Control.MousePosition);
// If the mouse is not in the item area, then draw disabled
if (!button.Bounds.Contains(mousePos))
DrawGradientToolItem(g, button, _disabledItem);
}
}
}
示例7: getButtonState
private ButtonSelectedState getButtonState(ToolStrip toolStrip, ToolStripItem item)
{
if (!item.Enabled)
return ButtonSelectedState.Disabled;
if (item is ToolStripButton)
{
ToolStripButton button = (ToolStripButton)item;
if (button.Checked)
return ButtonSelectedState.Checked;
}
if (item.Pressed)
{
return ButtonSelectedState.Pressed;
}
else
{
Point cursorPos = toolStrip.PointToClient(Cursor.Position);
if ((item.Visible) && (item.Bounds.Contains(cursorPos)))
return ButtonSelectedState.Focused;
else
return ButtonSelectedState.None;
}
}