unit U_bitmap_design; {Écrit par Denis Bertin pour ajouter des fonctions de dessin bitmap qu'il a conçus} { - Tous droit de reproduction autorisé www.denisdraw.com le 5.01.2010 © beelog - } {Si notre galaxie serait issus d'un big bang pourquoi d'autre galaxie ne se serait pas formé ainsi} {Ce paint là écrit pour Delphi the seven, au moins dispose d'une palette de 128 couleurs étendu by db} {Une Création de denis Bertin - blague Rien serait possible si nous n'étions pas tous intelligent} interface uses windows,u_object,messages,c_color; type TCase_Outil_de_dessin = (TOD_Point,TOD_ligne,TOD_cercle,TOD_rectangle,TOD_ellipse,TOD_remplissage); TOutilWindowBitmap = class(u_object.TGWindow) procedure Setupwindow; override; {recouvrement} function Getstyle:DWORD; override; {recouvrement} function Getexstyle:DWORD; override; {recouvrement} procedure Sedeplace_et_saffiche; procedure Paint(PaintDC: HDC; var PaintInfo: TPaintStruct); override; {recouvrement} procedure Wmlbuttondown(var msg:TMessage); override; {recouvrement en français} procedure Wmlbuttonup(var msg:TMessage); override; {recouvrement en français} procedure WMMousemove(var msg:TMessage); override; {recouvrement en français} procedure Show_palette_brosse; {brush en anglais} procedure Show_palette_pinceau; {pencil en anglais} procedure Positionner_la_palette(une_fenetre_palette:c_color.tw_color_surgissante); procedure Mouse_Down(var msg:TMessage); procedure Mouse_Bouge(var msg:TMessage); procedure Mouse_Up(var msg:TMessage); procedure Wmset_painture_control(var Msg: TMessage); override; private Outil_Dessin:TCase_Outil_de_dessin; Mouse_key_pressed:boolean; taille_size_point:integer; round_border_size:integer; deja_dessiner:boolean; Depart_Memoriser_Ce_Point, old_point_dessin:TPoint; clic_pinceau,clic_brush:boolean; end; implementation uses wbase,g_base,wmain,toolbar,wutil,col_plan,wformebm,wregles, sysutils,utile,unit_menu,paint_flood_fill_pictogramme; var Rect_posit_tool : array[TOD_Point..TOD_remplissage] of trect; var posit_rect_brush,posit_rect_pencil,Rect_posit_taille_bordure:trect; procedure TOutilWindowBitmap.Setupwindow; begin inherited Setupwindow; ShowWindow(self.hwindow,sw_hide); Self.Mouse_key_pressed:=False; taille_size_point:=20; round_border_size:=6; end; function TOutilWindowBitmap.Getstyle:DWORD; begin self.Outil_Dessin:=TOD_Point; Getstyle:=Ws_Popup+Ws_visible; //Ws_caption end; function TOutilWindowBitmap.getexstyle:DWORD; begin getexstyle:=WS_EX_PALETTEWINDOW; end; {TOutilWindow.TOutilWindowBitmap} procedure TOutilWindowBitmap.Sedeplace_et_saffiche; var un_rect:trect; un_taille_point:tpoint; begin GetClientRect(wmain.MainWindow.hwindow,un_rect); un_taille_point.x:=un_rect.Left; un_taille_point.y:=un_rect.top; ClienttoScreen(wmain.MainWindow.hwindow,un_taille_point); Movewindow(self.hwindow,un_taille_point.x,un_taille_point.y,un_rect.left+40,un_rect.bottom,true); if wmain.MainWindow<>nil then if wmain.MainWindow.Button_bitmap_function then Showwindow(self.hwindow,sw_show) else Showwindow(self.hwindow,sw_Hide); invalidaterect(self.hwindow,nil,false); end; {TOutilWindowBitmap.Setupwindow} procedure TOutilWindowBitmap.Paint(PaintDC: HDC; var PaintInfo: TPaintStruct); var i:integer; un_rect:trect; apencil:hpen; abrush:hbrush; old_rop:integer; atabtriangle:array[1..3] of tpoint; begin GetClientRect(self.hwindow,un_rect); Rectangle(PaintDC,0,0,un_rect.right,un_rect.bottom); for i:=0 to un_rect.Bottom do begin {for i} apencil:=selectobject(paintDC,createpen(PS_SOLID,1,toolbar.Get_color_degrader_barre(i,un_rect.bottom,un_rect,tbHorizontal))); wutil.moveto(paintDC,0,i); lineto(paintDC,un_rect.right,i); deleteobject(selectobject(paintDC,apencil)); end; {for i} abrush:=selectobject(paintDC,GetStockObject(null_brush)); Rectangle(PaintDC,0,0,un_rect.right,un_rect.bottom); selectobject(paintDC,abrush); case self.Outil_Dessin of TOD_Point: begin with Rect_posit_tool[TOD_Point] do rectangle(paintdc,left,top,right,bottom); end; TOD_ligne: begin with Rect_posit_tool[TOD_ligne] do rectangle(paintdc,left,top,right,bottom); end; TOD_cercle: begin with Rect_posit_tool[TOD_cercle] do rectangle(paintdc,left,top,right,bottom); end; TOD_rectangle: begin with Rect_posit_tool[TOD_rectangle] do rectangle(paintdc,left,top,right,bottom); end; TOD_ellipse: begin with Rect_posit_tool[TOD_ellipse] do rectangle(paintdc,left,top,right,bottom); end; TOD_remplissage: begin with Rect_posit_tool[TOD_remplissage] do rectangle(paintdc,left,top,right,bottom); end; end; {case} {Dessin des Outils} with Rect_posit_tool[TOD_Point] do Ellipse(paintdc,20-4,22-4,20+4,22+4); with Rect_posit_tool[TOD_ligne] do begin Moveto(paintdc,20-16+4,60-16+4+1); lineto(paintdc,20+16-4,60+16-4+1); end; with Rect_posit_tool[TOD_cercle] do Ellipse(paintdc,20-12,100-11,20+12,100+12+2); with Rect_posit_tool[TOD_rectangle] do Rectangle(paintdc,20-11,140-12+2,20+11,140+12+2); with Rect_posit_tool[TOD_ellipse] do Ellipse(paintdc,20-12,180-6,20+12,180+9); with Rect_posit_tool[TOD_remplissage] do Paint_flood_fill_pictogramme.draw_flood_file_image(paintdc,6,206); if un_rect.bottom>300 then begin abrush:=SelectObject(paintdc,CreateSolidBrush(g_base.rgb_noir)); atabtriangle[1].x:=20; atabtriangle[1].y:=260; atabtriangle[2].x:=2; atabtriangle[2].y:=260+18; atabtriangle[3].x:=38; atabtriangle[3].y:=260+18; polygon(paintdc,atabtriangle,3); old_rop:=SetRop2(paintdc,R2_NOT); DeleteObject(SelectObject(paintdc,abrush)); moveto(paintdc,4,260+self.round_border_size); lineto(paintdc,36,260+self.round_border_size); SetRop2(paintdc,old_rop); SetRect(Rect_posit_taille_bordure,2,260,38,278); end; {S'affiche si la taille de la fenêtre est suffissante} if un_rect.bottom>380 then begin {Afficher la couleur de remplissage} abrush:=SelectObject(paintdc,CreateSolidBrush(u_object.brush1_actif.lbColor)); with un_rect do roundrect(paintdc,4,bottom-60,right-5,bottom-40,4,4); with un_rect do setrect(posit_rect_brush,4,bottom-60,right-5,bottom-40); DeleteObject(SelectObject(paintdc,abrush)); {Afficher la couleur du contour} abrush:=SelectObject(paintdc,CreateSolidBrush(u_object.pen1_actif.lopnColor)); with un_rect do roundrect(paintdc,4,bottom-30,right-5,bottom-10,4,4); with un_rect do setrect(posit_rect_pencil,4,bottom-30,right-5,bottom-10); DeleteObject(SelectObject(paintdc,abrush)); end; end; {TOutilWindowBitmap.Paint} procedure TOutilWindowBitmap.wmlbuttondown(var msg:TMessage); var apoint:tpoint; begin apoint.x:=Smallint(loword(msg.lparam)); apoint.y:=Smallint(hiword(msg.lparam)); if ptinrect(Rect_posit_tool[TOD_Point],apoint) then Self.Outil_Dessin:=TOD_Point else if ptinrect(Rect_posit_tool[TOD_ligne],apoint) then Self.Outil_Dessin:=TOD_ligne else if ptinrect(Rect_posit_tool[TOD_cercle],apoint) then Self.Outil_Dessin:=TOD_cercle else if ptinrect(Rect_posit_tool[TOD_rectangle],apoint) then Self.Outil_Dessin:=TOD_rectangle else if ptinrect(Rect_posit_tool[TOD_ellipse],apoint) then Self.Outil_Dessin:=TOD_ellipse else if ptinrect(Rect_posit_tool[TOD_remplissage],apoint) then Self.Outil_Dessin:=TOD_remplissage; InvalidateRect(self.hwindow,nil,false); end; {TOutilWindowBitmap.wmlbuttondown} procedure TOutilWindowBitmap.wmlbuttonup(var msg:TMessage); var apoint:tpoint; begin apoint.x:=Smallint(loword(msg.lparam)); apoint.y:=Smallint(hiword(msg.lparam)); if ptinrect(posit_rect_brush,apoint) then show_palette_brosse else if ptinrect(posit_rect_pencil,apoint) then show_palette_pinceau; end; {TOutilWindowBitmap.wmlbuttonup} procedure TOutilWindowBitmap.WMMousemove(var msg:TMessage); var apoint:tpoint; begin apoint.x:=Smallint(loword(msg.lparam)); apoint.y:=Smallint(hiword(msg.lparam)); if ptinrect(Rect_posit_taille_bordure,apoint) then begin self.round_border_size:=apoint.y-260; invalidaterect(self.hwindow,@Rect_posit_taille_bordure,false); end; end; procedure TOutilWindowBitmap.show_palette_brosse; var une_fenetre_palette:c_color.tw_color_surgissante; begin une_fenetre_palette:=c_color.creer_fenetre_surgisante_couleur(wbase.Twindow(self), (GetKeyState(VK_SHIFT)<0) or (GetKeyState(VK_Control)<0),false); Positionner_la_palette(une_fenetre_palette); clic_brush:=true; end; procedure TOutilWindowBitmap.Positionner_la_palette(une_fenetre_palette:c_color.tw_color_surgissante); var ax,ay,hauteur,largeur:integer; centre:tpoint; begin centre.x:=(posit_rect_brush.left+posit_rect_brush.right) div 2; centre.y:=(posit_rect_brush.top+posit_rect_brush.bottom) div 2; ClientToScreen(self.hwindow,centre); hauteur:=c_color.hauteur_rect_couleur*16+20; largeur:=c_color.largeur_rect_couleur*8; ax:=centre.x-largeur div 2; ay:=centre.y-hauteur div 2; MoveWindow(une_fenetre_palette.hwindow,aX,aY,largeur,hauteur,true); end; {TOutilWindowBitmap.show_palette_brosse} procedure TOutilWindowBitmap.show_palette_pinceau; var une_fenetre_palette:c_color.tw_color_surgissante; begin une_fenetre_palette:=c_color.creer_fenetre_surgisante_couleur(wbase.Twindow(self), (GetKeyState(VK_SHIFT)<0) or (GetKeyState(VK_Control)<0),false); Positionner_la_palette(une_fenetre_palette); clic_pinceau:=true; end; {TOutilWindowBitmap.show_palette_pinceau} procedure TOutilWindowBitmap.Mouse_Down(var msg:TMessage); var apoint,calculted_point:tpoint; a_display_contexte,adc,Memdc:hdc; un_rectangle:trect; un_Calque_actif:col_plan.TCalque; une_image:wformebm.Tforme_TBitMap; Ce_plot_d_une_couleur:tcolorRef; abrush:hbrush; begin {Vérifier la présence de l'image sinon revenir à Denis-Draw} un_calque_actif:=wmain.MainWindow.wmsg.col_dessin.Get_calque_actif; if un_calque_actif=nil then exit; une_image:=wformebm.Tforme_TBitMap(un_calque_actif.last_selection); if une_image=nil then begin PostMessage(wmain.MainWindow.hwindow,wm_command,unit_menu.id_editer_un_bitmap,0); exit; end; {Une image est bien sélectionnée} if not Self.Mouse_key_pressed then begin Self.mouse_key_pressed:=True; SetCapture(wmain.MainWindow.hwindow); end; case self.Outil_Dessin of TOD_Point: begin postmessage(wmain.MainWindow.hwindow,WM_MouseMove,msg.WParam,msg.lparam); end; TOD_ligne, TOD_cercle, TOD_rectangle, TOD_ellipse: begin deja_dessiner:=false; Depart_Memoriser_Ce_Point.x:=Smallint(loword(msg.lparam)); Depart_Memoriser_Ce_Point.y:=Smallint(hiword(msg.lparam)); a_display_contexte:=GetDc(wmain.MainWindow.hwindow); wregles.map_mode(a_display_contexte,client,wmain.MainWindow.wmsg.origine,wmain.MainWindow.wmsg.zoom_coef); dptolp(a_display_contexte,Depart_Memoriser_Ce_Point,sizeof(tpoint) div sizeof(tpoint)); releasedc(wmain.MainWindow.hwindow,a_display_contexte); end; TOD_remplissage: begin {Obtenir l'image par point} un_calque_actif:=wmain.MainWindow.wmsg.col_dessin.Get_calque_actif; if un_calque_actif=nil then exit; une_image:=wformebm.Tforme_TBitMap(un_calque_actif.last_selection); if une_image=nil then exit; {Vérification du type caste comme à dit Rico} if not(une_image.ClassType=wformebm.Tforme_TBitMap) then exit; {Obtention du rectangle} un_rectangle:=une_image.rect; {Vérification de la position de la souris} apoint.x:=Smallint(loword(msg.lparam)); apoint.y:=Smallint(hiword(msg.lparam)); adc:=GetDc(wmain.MainWindow.hwindow); wregles.map_mode(adc,client,wmain.MainWindow.wmsg.origine,wmain.MainWindow.wmsg.zoom_coef); dptolp(adc,apoint,sizeof(tpoint) div sizeof(tpoint)); if not ptinrect(un_rectangle,apoint) then exit; {Action si correspondance du rectangle} Memdc:=Createcompatibledc(adc); SelectObject(Memdc,une_image.BitMap.Handle); Dec(apoint.x,un_rectangle.Left); Dec(apoint.y,un_rectangle.Top); {Calcul du rapport de l'un vers l'autre : des points logique vers les pixels} calculted_point.x:=round(apoint.x/une_image.la_largeur*une_image.BitMap.Width); calculted_point.y:=round(apoint.y/une_image.la_hauteur*une_image.BitMap.Height); SetMapMode(adc,MM_Text); {Quel geek ce bill, un mode dit texte pour dessiner} abrush:=SelectObject(Memdc,CreateSolidBrush(u_object.brush1_actif.lbcolor)); With calculted_point do begin Ce_plot_d_une_couleur:=GetPIxel(Memdc,x,y); ExtFloodFill(Memdc,x,y,Ce_plot_d_une_couleur,FLOODFILLSURFACE); end; DeleteObject(SelectObject(Memdc,abrush)); DeleteDC(memdc); Releasedc(wmain.MainWindow.hwindow,adc); InvalidateRect(wmain.MainWindow.hwindow,nil,false); end; end; {case} end; {TOutilWindowBitmap.Mouse_Down} procedure TOutilWindowBitmap.Mouse_Bouge(var msg:TMessage); var i:integer; adc,memdc{$ifdef debug},another_dc{$endif debug}:hdc; abrosse:hbrush; un_pencil:hpen; {Vanille} apoint,calculted_point:tpoint; un_rectangle:trect; un_Calque_actif:col_plan.TCalque; une_image:wformebm.Tforme_TBitMap; {$ifdef debug} apc,bpc:pc100; {$endif debug} begin if not Self.Mouse_key_pressed then exit; {Obtenir l'image par point} un_calque_actif:=wmain.MainWindow.wmsg.col_dessin.Get_calque_actif; if un_calque_actif=nil then exit; une_image:=wformebm.Tforme_TBitMap(un_calque_actif.last_selection); if une_image=nil then exit; {Vérification du type caste comme à dit Rico} if not(une_image.ClassType=wformebm.Tforme_TBitMap) then exit; {Obtention du rectangle} un_rectangle:=une_image.rect; {Vérification de la position de la souris} apoint.x:=Smallint(loword(msg.lparam)); apoint.y:=Smallint(hiword(msg.lparam)); adc:=GetDc(wmain.MainWindow.hwindow); wregles.map_mode(adc,client,wmain.MainWindow.wmsg.origine,wmain.MainWindow.wmsg.zoom_coef); dptolp(adc,apoint,sizeof(tpoint) div sizeof(tpoint)); if not ptinrect(un_rectangle,apoint) then exit; {Action si correspondance du rectangle} case self.Outil_Dessin of TOD_Point: begin Memdc:=Createcompatibledc(adc); SelectObject(Memdc,une_image.BitMap.Handle); Dec(apoint.x,un_rectangle.Left); Dec(apoint.y,un_rectangle.Top); {Calcul du rapport de l'un vers l'autre : des points logique vers les pixels} calculted_point.x:=round(apoint.x/une_image.la_largeur*une_image.BitMap.Width); calculted_point.y:=round(apoint.y/une_image.la_hauteur*une_image.BitMap.Height); SetMapMode(adc,MM_Text); {Quel geek ce bill, un mode dit texte pour dessiner} un_pencil:=SelectObject(Memdc,CreatePen(round_border_size,PS_Solid,u_object.pen1_actif.lopnColor)); abrosse:=SelectObject(Memdc,CreateSolidBrush(u_object.brush1_actif.lbcolor)); Ellipse(Memdc,calculted_point.x-taille_size_point,calculted_point.y-taille_size_point,calculted_point.x+taille_size_point,calculted_point.y+taille_size_point); DeleteObject(SelectObject(Memdc,abrosse)); DeleteObject(SelectObject(Memdc,un_pencil)); DeleteDC(memdc); InvalidateRect(wmain.MainWindow.hwindow,nil,false); {$ifdef debug} another_dc:=getdc(0); inttopchar(Apoint.x,apc); inttopchar(Apoint.y,bpc); strcat(strcat(apc,' - '),bpc); textout(another_dc,10,10,apc,strlen(apc)); releasedc(0,another_dc); {$endif debug} end; TOD_ligne: begin Setrop2(adc,R2_NOT); //Moveto(adc,random(10000),random(10000)); //Lineto(adc,random(10000),random(10000)); if deja_dessiner then begin with Depart_Memoriser_Ce_Point do Moveto(adc,x,y); with old_point_dessin do Lineto(adc,x,y); end; if true then begin deja_dessiner:=true; {$ifdef debug} another_dc:=getdc(0); inttopchar(Apoint.x,apc); inttopchar(Apoint.y,bpc); strcat(strcat(apc,' - '),bpc); textout(another_dc,10,10,apc,strlen(apc)); releasedc(0,another_dc); {$endif debug} with Depart_Memoriser_Ce_Point do Moveto(adc,x,y); with Apoint do Lineto(adc,x,y); old_point_dessin:=apoint; end; end; TOD_cercle: begin Setrop2(adc,R2_NOT); abrosse:=SelectObject(adc,GetStockObject(NULL_BRUSH)); if deja_dessiner then begin wutil.Cercleto(adc,Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,utile.idistance( Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,old_point_dessin.x,old_point_dessin.y)); end; wutil.Cercleto(adc,Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,utile.idistance( Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,apoint.x,apoint.y)); old_point_dessin:=apoint; SelectObject(adc,abrosse); deja_dessiner:=true; end; TOD_rectangle: begin Setrop2(adc,R2_NOT); abrosse:=SelectObject(adc,GetStockObject(NULL_BRUSH)); if deja_dessiner then begin Rectangle(adc,Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,old_point_dessin.x,old_point_dessin.y); end; Rectangle(adc,Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,apoint.x,apoint.y); old_point_dessin:=apoint; SelectObject(adc,abrosse); deja_dessiner:=true; end; TOD_ellipse: begin Setrop2(adc,R2_NOT); abrosse:=SelectObject(adc,GetStockObject(NULL_BRUSH)); if deja_dessiner then begin Ellipse(adc,Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,old_point_dessin.x,old_point_dessin.y); end; Ellipse(adc,Depart_Memoriser_Ce_Point.x,Depart_Memoriser_Ce_Point.y,apoint.x,apoint.y); old_point_dessin:=apoint; SelectObject(adc,abrosse); deja_dessiner:=true; end; end; {case} releasedc(wmain.MainWindow.hwindow,adc); end; {TOutilWindowBitmap.Mouse_Bouge} procedure TOutilWindowBitmap.Mouse_Up(var msg:TMessage); var adc,Memdc:hdc; apoint,bpoint:tpoint; un_calque_actif:col_plan.TCalque; une_image:wformebm.Tforme_TBitMap; un_rectangle:trect; apencil:hpen; abrosse:hbrush; begin Self.Mouse_key_pressed:=False; ReleaseCapture; {Obtention du calque actif} un_calque_actif:=wmain.MainWindow.wmsg.col_dessin.Get_calque_actif; if un_calque_actif=nil then exit; une_image:=wformebm.Tforme_TBitMap(un_calque_actif.last_selection); if une_image=nil then exit; {Vérification du type caste comme à dit Rico} if not(une_image.ClassType=wformebm.Tforme_TBitMap) then exit; {Obtention du rectangle} un_rectangle:=une_image.rect; {Vérification de la position de la souris} apoint.x:=Smallint(loword(msg.lparam)); apoint.y:=Smallint(hiword(msg.lparam)); adc:=GetDc(wmain.MainWindow.hwindow); wregles.map_mode(adc,client,wmain.MainWindow.wmsg.origine,wmain.MainWindow.wmsg.zoom_coef); dptolp(adc,apoint,sizeof(tpoint) div sizeof(tpoint)); if ptinrect(un_rectangle,apoint) then begin Memdc:=Createcompatibledc(adc); SelectObject(Memdc,une_image.BitMap.Handle); apoint.x:=Depart_Memoriser_Ce_Point.x; apoint.y:=Depart_Memoriser_Ce_Point.y; bpoint.x:=old_point_dessin.x; bpoint.y:=old_point_dessin.y; {decalage pour obtenir la position zéro} Dec(apoint.x,un_rectangle.Left); Dec(apoint.y,un_rectangle.Top); Dec(bpoint.x,un_rectangle.Left); Dec(bpoint.y,un_rectangle.Top); {Calcul du rapport de l'un vers l'autre : des points logique vers les pixels} apoint.x:=round(apoint.x/une_image.la_largeur*une_image.BitMap.Width); apoint.y:=round(apoint.y/une_image.la_hauteur*une_image.BitMap.Height); bpoint.x:=round(bpoint.x/une_image.la_largeur*une_image.BitMap.Width); bpoint.y:=round(bpoint.y/une_image.la_hauteur*une_image.BitMap.Height); //wregles.map_mode(memdc,client,wmain.MainWindow.wmsg.origine,wmain.MainWindow.wmsg.zoom_coef); apencil:=Selectobject(memdc,CreatePen(PS_SOLID,self.round_border_size,u_object.pen1_actif.lopnColor)); abrosse:=Selectobject(memdc,CreateSolidBrush(u_object.brush1_actif.lbColor)); case self.Outil_Dessin of TOD_Point: begin end; TOD_ligne: begin moveto(memdc,aPoint.x,aPoint.y); lineto(memdc,bPoint.x,bPoint.y); end; TOD_cercle: begin wutil.Cercleto(memdc,aPoint.x,aPoint.y,utile.idistance(aPoint.x,aPoint.y,bPoint.x,bPoint.y)); end; TOD_rectangle: begin Rectangle(memdc,apoint.x,apoint.y,bpoint.x,bpoint.y); end; TOD_Ellipse: begin Ellipse(memdc,apoint.x,apoint.y,bpoint.x,bpoint.y); end; end; {case} DeleteObject(Selectobject(memdc,apencil)); DeleteObject(Selectobject(memdc,abrosse)); DeleteDC(memdc); end; releasedc(wmain.MainWindow.hwindow,adc); invalidaterect(wmain.MainWindow.hwindow,nil,false); end; {TOutilWindowBitmap.Mouse_Up} procedure TOutilWindowBitmap.wmset_painture_control(var Msg: TMessage); var a:real; begin if clic_brush then begin self.clic_brush:=false; u_object.brush1_actif.lbColor:=msg.lparam; invalidaterect(self.hwindow,nil,false); end; if clic_pinceau then begin self.clic_pinceau:=false; u_object.pen1_actif.lopncolor:=msg.lparam; invalidaterect(self.hwindow,nil,false); end; end; {TOutilWindowBitmap.wmset_painture_control} begin {init position des outils} //position de l'outil de dessin par point Rect_posit_tool[TOD_Point].left:=4; Rect_posit_tool[TOD_Point].top:=4; Rect_posit_tool[TOD_Point].right:=36; Rect_posit_tool[TOD_Point].bottom:=36+3; //position de l'outil de Ligne, Rect_posit_tool[TOD_ligne].left:=4; Rect_posit_tool[TOD_ligne].top:=4+40; Rect_posit_tool[TOD_ligne].right:=36; Rect_posit_tool[TOD_ligne].bottom:=36+3+40; //position de l'outil de cercle Rect_posit_tool[TOD_cercle].left:=4; Rect_posit_tool[TOD_cercle].top:=4+80; Rect_posit_tool[TOD_cercle].right:=36; Rect_posit_tool[TOD_cercle].bottom:=36+3+80; //position de l'outil de Rectangle Rect_posit_tool[TOD_rectangle].left:=4; Rect_posit_tool[TOD_rectangle].top:=4+120; Rect_posit_tool[TOD_rectangle].right:=36; Rect_posit_tool[TOD_rectangle].bottom:=36+3+120; //position de l'outil de l'ellipse Rect_posit_tool[TOD_ellipse].left:=4; Rect_posit_tool[TOD_ellipse].top:=4+160; Rect_posit_tool[TOD_ellipse].right:=36; Rect_posit_tool[TOD_ellipse].bottom:=36+3+160; //position de l'outil de remplissage Rect_posit_tool[TOD_remplissage].left:=4; Rect_posit_tool[TOD_remplissage].top:=4+200; Rect_posit_tool[TOD_remplissage].right:=36; Rect_posit_tool[TOD_remplissage].bottom:=36+3+200; end.