Esempio n. 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();
 }
 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;
 }
Esempio n. 3
0
 private void ImagepictureBox_MouseUp(object sender, MouseEventArgs e)
 {
     bDragging = null;
     bSizing = null;
 }
Esempio n. 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;
 }