91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 130KB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-25
  • 語言: C#
  • 標簽: C#??繪制??刪除??編輯??

資源簡介

左單擊添加點 左雙擊完成圖形閉合 右雙擊刪除圖形 右單擊撤回一個點 鼠標靠進點可以修改圖形

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;

namespace?DrawPolygon
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????????Setstyle(Controlstyles.UserPaint?true);
????????????Setstyle(Controlstyles.AllPaintingInWmPaint?true);?//?禁止擦除背景.??
????????????Setstyle(Controlstyles.DoubleBuffer?true);?//?雙緩沖
????????}

????????List?ListPolyon?=?new?List();
????????List?_tempPolyon?=?new?List();
????????Point?_tempPoint?=?new?Point();
????????bool?IsDrawPolyonstart?=?false;

????????bool?IsEdit?=?false;
????????int?SelectListIndex?=?0;
????????int?SelectRc?=?0;
????????public?float?isLeft1(Point?P0?Point?P1?Point?P2)
????????{
????????????float?abc?=?((P1.X?-?P0.X)?*?(P2.Y?-?P0.Y)?-?(P2.X?-?P0.X)?*?(P1.Y?-?P0.Y));
????????????return?abc;

????????}
????????private?bool?PointInFences(Point?pnt1?Point[]?fencePnts)
????????{

????????????int?wn?=?0?j?=?0;?//wn?計數器?j第二個點指針
????????????for?(int?i?=?0;?i?????????????{//開始循環
????????????????if?(i?==?fencePnts.Length?-?1)
????????????????????j?=?0;//如果?循環到最后一點?第二個指針指向第一點
????????????????else
????????????????????j?=?j?+?1;?//如果不是?,則找下一點


????????????????if?(fencePnts[i].Y?<=?pnt1.Y)?//?如果多邊形的點?小于等于?選定點的?Y?坐標
????????????????{
????????????????????if?(fencePnts[j].Y?>?pnt1.Y)?//?如果多邊形的下一點?大于于?選定點的?Y?坐標
????????????????????{
????????????????????????if?(isLeft1(fencePnts[i]?fencePnts[j]?pnt1)?>?0)
????????????????????????{
????????????????????????????wn++;
????????????????????????}
????????????????????}
????????????????}
????????????????else
????????????????{
????????????????????if?(fencePnts[j].Y?<=?pnt1.Y)
????????????????????{
????????????????????????if?(isLeft1(fencePnts[i]?fencePnts[j]?pnt1)?????????????????????????{
????????????????????????????wn--;
????????????????????????}
????????????????????}
????????????????}
????????????}
????????????if?(wn?==?0)
????????????????return?false;
????????????else
????????????????return?true;
????????}
????????private?void?pictureBox1_MouseDoubleClick(object?sender?MouseEventArgs?e)
????????{
????????????if?(!IsDrawPolyonstart)
????????????{
????????????????if?(_tempPolyon.Count?<=?2)
????????????????{
????????????????????MessageBox.Show(“多邊形至少三個點“);
????????????????????return;
????????????????}
????????????????IsDrawPolyonstart?=?true;
????????????????_tempPolyon.Add(new?Point(e.X?e.Y));

????????????????_tempPolyon.Add(_tempPolyon[0]);


????????????????ListPolyon.Add(_tempPolyon.ToArray());





????????????????_tempPolyon?=?new?List();
????????????}
????????????if?(IsDrawPolyonstart?&&?e.Button?==?MouseButtons.Right)
????????????{

????????????????for?(int?i?=

評論

共有 條評論