예제 #1
0
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     GrabRect rt = ImagepropertyGrid.SelectedObject as GrabRect;
     m_rtList.Remove(rt);
     bDragging = null;
     bSizing = null;
     ImagepropertyGrid.SelectedObject = null;
     RedrawItems();
 }
예제 #2
0
 private Bitmap ConvertToHorisontal(Bitmap bmp, GrabRect el)
 {
     int iCeilWidth = el.Rect.Width/el.ColCount;
     int iCeilHeight = el.Rect.Height/el.RowCount;
     Bitmap bmpNew = new Bitmap(el.Rect.Width*el.RowCount, el.Rect.Height/el.RowCount);
     int iCount = 0;
     Graphics gr = Graphics.FromImage(bmpNew);
     for (int i = el.ColCount - 1; i >= 0; i--)
     {
         for (int j = 0; j < el.RowCount; j++)
         {
             gr.DrawImage(bmp.Clone(new Rectangle(i * iCeilWidth, j * iCeilHeight, iCeilWidth, iCeilHeight), PixelFormat.Format24bppRgb), iCount * iCeilWidth, 0);
             iCount++;
         }
     }
     gr.Dispose();
     return bmpNew;
 }
예제 #3
0
 private void ImagepictureBox_MouseUp(object sender, MouseEventArgs e)
 {
     bDragging = null;
     bSizing = null;
 }
예제 #4
0
 private void ImagepictureBox_MouseDown(object sender, MouseEventArgs e)
 {
     if (bSizing == null)
     {
         bDragging = null;
         foreach (var el in m_rtList)
         {
             Rectangle rt = el.Rect;
             rt.Inflate(-iMul, -iMul);
             if (rt.Contains(e.Location))
             {
                 bDragging = el;
                 Cursor = iCursorType = Cursors.SizeAll;
                 break;
             }
         }
     }
     if (bDragging == null)
     {
         bSizing = null;
         foreach (var el in m_rtList)
         {
             if (el.Rect.Contains(e.Location))
             {
                 iDraggingType = DetectPointOnRect(el.Rect, e.Location);
                 if (iDraggingType >= 1 && iDraggingType <= 8)
                 {
                     bSizing = el;
                     Cursor = iCursorType = GetCursorByType(iDraggingType);
                     break;
                 }
             }
         }
     }
     pOld = e.Location;
 }