minhlap.allgoo.us
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.


When we control the event,we control your lives
 
Trang ChínhLatest imagesTìm kiếmĐăng kýĐăng Nhập
Tìm kiếm
 
 

Display results as :
 
Rechercher Advanced Search
Latest topics
» Tô màu theo vùng quét
Draw Marker Icon_minitimeTue Aug 13, 2013 4:18 pm by minhlap

» authentischen Hermes Lindy Taschen
Draw Marker Icon_minitimeWed Jan 23, 2013 11:15 am by cangliang

» Hermes Bag
Draw Marker Icon_minitimeWed Jan 23, 2013 11:14 am by cangliang

» Hermes Evelyn pm
Draw Marker Icon_minitimeWed Jan 23, 2013 11:13 am by cangliang

» Hermes Kelly bag billig
Draw Marker Icon_minitimeMon Jan 21, 2013 8:57 am by cangliang

» Hermes Constance Bag
Draw Marker Icon_minitimeMon Jan 21, 2013 8:56 am by cangliang

» Discout Hermes Belt
Draw Marker Icon_minitimeMon Jan 21, 2013 8:55 am by cangliang

» Christian Louboutin Love Flats
Draw Marker Icon_minitimeTue Jan 15, 2013 12:25 pm by cangliang

» Christian Louboutin Love Flats
Draw Marker Icon_minitimeTue Jan 15, 2013 12:25 pm by cangliang

Navigation
 Portal
 Diễn Đàn
 Thành viên
 Lý lịch
 Trợ giúp
 Tìm kiếm
April 2024
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     
CalendarCalendar
Diễn Đàn
Affiliates
free forum


 

 Draw Marker

Go down 
Tác giảThông điệp
minhlap
Admin - Quản trị viên
Admin - Quản trị viên
minhlap


Tổng số bài gửi : 129
Points : 374
Reputation : 5
Join date : 22/07/2009
Age : 34
Đến từ : TP Hồ Chí Minh

Draw Marker Empty
Bài gửiTiêu đề: Draw Marker   Draw Marker Icon_minitimeWed Mar 17, 2010 8:33 am

Code:
#define MAX_MARKERS 100
int tsize=5;
int tang=2;
int color=0;
void DrawMarker(HDC hdc, POINT pt, int size);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{

   PAINTSTRUCT ps;
   HDC hdc;
   TCHAR szHello[MAX_LOADSTRING];
   LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
   int i;
   static POINT apt[MAX_MARKERS];
   static int nMarkers=0;

   switch (message)
   {
   
      case WM_LBUTTONDOWN:
         if(nMarkers <= MAX_MARKERS)
         {
            apt[nMarkers].x = LOWORD(lParam);
            apt[nMarkers].y = HIWORD(lParam);
            nMarkers++;
         }
         InvalidateRect(hWnd, NULL, TRUE);
         break;

      case WM_RBUTTONDOWN:
         nMarkers=0;
         InvalidateRect(hWnd, NULL, TRUE);
         break;
      case WM_PAINT:
         hdc = BeginPaint(hWnd, &ps);
         // TODO: Add any drawing code here...
         for(i=0 ; i < nMarkers ; i++)
               DrawMarker(hdc, apt[i], tsize);
         
         
         RECT rt;
         GetClientRect(hWnd, &rt);
         wsprintf(szHello,"So marker: %d",nMarkers);

         DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
         EndPaint(hWnd, &ps);
         break;

      case WM_DESTROY:
         PostQuitMessage(0);
         break;
      case WM_CHAR:
         switch(wParam)
         {
         case '+':            
            if(tsize >100 || tsize <0)
               tang =- tang;         
            tsize +=tang;
            InvalidateRect(hWnd, NULL, TRUE);
            break;
         case '-':      

            if(tsize >100 || tsize <0)
               tang =- tang;         
            tsize -=tang;
            InvalidateRect(hWnd, NULL, TRUE);
            break;
         case 'a':
            if(color<255)
             color+=100;
            else
               color=0;
            InvalidateRect(hWnd, NULL, TRUE);
            break;
         }
         
      default:
         return DefWindowProc(hWnd, message, wParam, lParam);
  }
  return 0;
}
void InvertPixel(HDC hdc, int x, int y)
{
   COLORREF crColor = GetPixel(hdc, x, y);
   SetPixel(hdc, x, y, RGB(255, color ,255));
}
void DrawMarkervuong(HDC hdc, POINT pt, int size)
{
   int i, x=pt.x, y=pt.y;
   InvertPixel(hdc, x, y);
   for (i=1 ; i<= size; i++)
   {
      InvertPixel(hdc, x + i, y + size);
      InvertPixel(hdc, x + i, y);
      InvertPixel(hdc, x  + size , y + i);
      InvertPixel(hdc, x  , y + i);
   }
}

void DrawMarkernhan(HDC hdc, POINT pt, int size)
{
   int i, x=pt.x, y=pt.y;
   InvertPixel(hdc, x, y);
   for (i=1 ; i<= size; i++)
   {
      InvertPixel(hdc, x + i, y + i);
      InvertPixel(hdc, x - i, y - i);
      InvertPixel(hdc, x  - i , y + i);
      InvertPixel(hdc, x  +i  , y - i);
   }
}
void DrawMarker(HDC hdc, POINT pt, int size)
{
   int i, x=pt.x, y=pt.y;
   double xc,yc;
   InvertPixel(hdc, x, y);
   for (i=0 ; i<= 360; i++)
   {
      xc = (double)size*cos(i);
      yc = (double)size*sin(i);
      InvertPixel(hdc, (int)x+xc , (int)y + yc);
      
   }
}
Về Đầu Trang Go down
https://minhlap.forumvi.com
 
Draw Marker
Về Đầu Trang 
Trang 1 trong tổng số 1 trang

Permissions in this forum:Bạn không có quyền trả lời bài viết
minhlap.allgoo.us :: Lập trình :: Công nghệ phần mềm, Lập Trình C#-
Chuyển đến