2
A
回答
5
您正在尋找Control.Region
property,它允許您設置與特定控件關聯的窗口區域。操作系統不會繪製或顯示位於窗口區域之外的窗口的任何部分。
文檔給出瞭如何使用Region
屬性創建一個圓形按鈕示例:
// This method will change the square button to a circular button by
// creating a new circle-shaped GraphicsPath object and setting it
// to the RoundButton objects region.
private void roundButton_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Drawing2D.GraphicsPath buttonPath =
new System.Drawing.Drawing2D.GraphicsPath();
// Set a new rectangle to the same size as the button's
// ClientRectangle property.
System.Drawing.Rectangle newRectangle = roundButton.ClientRectangle;
// Decrease the size of the rectangle.
newRectangle.Inflate(-10, -10);
// Draw the button's border.
e.Graphics.DrawEllipse(System.Drawing.Pens.Black, newRectangle);
// Increase the size of the rectangle to include the border.
newRectangle.Inflate(1, 1);
// Create a circle within the new rectangle.
buttonPath.AddEllipse(newRectangle);
// Set the button's Region property to the newly created
// circle region.
roundButton.Region = new System.Drawing.Region(buttonPath);
}
0
相關問題
- 1. 圓角容器IE6
- 2. 需要在行中創建圓角?
- 3. 在Opera中創建CSS3圓角
- 4. 如何在svg中創建圓角
- 5. 如何使用css1創建一個圓角的容器?
- 6. 創建角1.6容器
- 7. 創建帶圓角的ImageView
- 8. 創建帶圓角的三角形
- 9. 在圓角創建CSS3形狀?
- 10. 在MS Access中創建「Winform」
- 11. .NET核心圓角圖像
- 12. 創建一個圓角的BlockArrow
- 13. 用CSS圓角創建一條線
- 14. 創建具有圓角/圓角或倒角的文本的三維模型
- 15. 如何創建一個圓角的NSImageView?
- 16. 試圖創建一個圓角UIButton類
- 17. 如何創建靈活的圓角?
- 18. 使用圓角創建表格
- 19. 如何創建背景CSS div /圓角?
- 20. 用於在Outlook中顯示容器的圓角
- 21. 在IE8中使用Canvas/VML創建圓角
- 22. 如何在android中創建圓角標籤?
- 23. 在Cocoa中創建半透明,圓角的邊框窗口?
- 24. 如何在X11中創建圓角矩形窗口
- 25. 如何使用CSS在IE 8中創建圓角?
- 26. 如何在WM6中創建圓角矩形按鈕?
- 27. 如何在可可中創建黑色圓角窗口
- 28. 如何在WPF中創建帶圓角的虛線邊框?
- 29. 如何在C#中使用圓角創建圖像?
- 30. 如何在Flex中創建一個虛線圓角矩形?
添加一些圖片來準確解釋你的問題 – 2011-03-08 06:35:28