cs_Jean_Jean
Messages postés615Date d'inscriptiondimanche 13 août 2006StatutMembreDernière intervention13 décembre 2018
-
26 août 2010 à 17:26
Utilisateur anonyme -
28 août 2010 à 22:49
Salut!
Au moment où je dépose mon composant sur une fiche il m'affiche cette erreur :
"violation d'accès à l'adresse 03293CEC dans le module TBTreeGraph.bpl. Ecriture à l'adresse 1758AE60".
C'est le genre d'erreur que je suis incapable d'analyser! Sauf quand il propose de voir le contenu de la mémoire, j'arrive parfois à déterminer l'instruction qui pose problème. Mais là, rien!
Ensuite, je vérifie le code et je trouve généralement l'erreur, mais je n'en vois pas!
J'ai donc désinstaller le composant et réinstallé, tout se passe bien, mais dès que je veux déposer le composant sur la Fiche, ça me ressort l'erreur.
Qu'en pensez-vous?
j'ai eu quelques plantages auparavant car j'avais affecté une propriété de Font sans avoir au préalable créé le type Font. J'ai été obligé de redémarrer D7.
Comment identifier l'erreur?
Que feriez-vous, avant que je décide à réécrire tout la composant?
Merci pour votre aide.
Guillemouze
Messages postés991Date d'inscriptionsamedi 25 octobre 2003StatutMembreDernière intervention29 août 20136 27 août 2010 à 09:12
Dans delphi 7, tu ouvre le dpk qui contient ton composant, et dans le menu Executer->parametres, tu met le chemin complet de delphi32.exe dans "application hote". Ensuite, tu peux faire "Executer" et ca te demarrera une aurtre instance de delphi, dans laquelle tu met ton composant et tu verra ou ca plante comme dans nimporte quel exe (ou plutot dll, car un dpk/bpl n'est rien d'autre qu'une dll)
PS: c'est un peu chiant a debugger car une partie du code n'est pas accessible, donc certains "pas à pas" sont tres long a passer d'un pas à un autre, et pire avec le "pas à pas approfondi"
cs_Jean_Jean
Messages postés615Date d'inscriptiondimanche 13 août 2006StatutMembreDernière intervention13 décembre 20183 26 août 2010 à 18:01
Je te l'envoie comment? Il est un peu long pour le mettre ici. Sur ta boite privée?
bon on va pas chochoter 2 h. Est-ce que ta besoin du programme test?
Merci à toi
cs_Jean_Jean
Messages postés615Date d'inscriptiondimanche 13 août 2006StatutMembreDernière intervention13 décembre 20183 26 août 2010 à 18:25
{==================================================}
{ COMPOSANT VISUEL DE B - ARBRE }
{==================================================}
- le composant est en conception :
1. Les étiquettes sont encore en réglage car j'ai rajouté une zone de titre, je ne sais plus si l'arbre s'affiche correctement, mais ça n'est pas le problème
2. Je n'ai pas encore intégré la solution de l'éditeur de propriété
3. Les figures géométriques ne sont pas finies...
Je n'ai rien touché au code pour le diagnostic, simplement les commentaires perso pour alléger!
Merci Francky!
===================================================}
unit CBTreeGraph;
{$R-,W-,S-}
===================================================}
{Type pour Debug}
Const
MaxCteColor = 51;
kStrColor : array[1..MaxcteColor] of string[78] = (
'Blanc sur Windows 9x, noir sur NT','Couleur de la barre de défilement',
'Aqua','Couleur du fond du bureau Windows','Noir',
'Couleur de la barre de titre de la fenêtre active','Bleu',
'Couleur de la barre de titre des fenêtres inactives','Crème',
'Couleur du fond des menus','Gris foncé',
'Couleur du fond des fenêtres','Fuchsia',
'Couleur des cadres de fenêtres','Gris','Couleur du texte des menus',
'Vert','Couleur du texte dans les fenêtres','Vert citron',
'Couleur du texte de la barre de titres de la fenêtre active',
'Gris clair','Couleur de la bordure de la fenêtre active',
'Marron','Couleur de la bordure des fenêtres inactives',
'Gris moyen','Couleur de l''espace de travail de l''application',
'Vert menthe','Couleur du fond du texte sélectionné',
'Bleu marine','Couleur du texte sélectionné',
'Vert olive','Couleur de la face d''un bouton',
'Violet','Couleur de l''ombre projetée par un bouton',
'Rouge','Couleur d''un texte estompé','Argent',
'Couleur du texte sur un bouton','Bleu ciel',
'Couleur du texte de la barre de titre des fenêtres inactives',
'Sarcelle','Couleur d''un bouton sélectionné','Blanc',
'Win 95 & NT 4.0 : ombre foncée des éléments s''affichant en 3D',
'Jaune','Win 95 & NT 4.0 : couleur claire en 3D (côtés faces à la lumière)',
'Win 95 & NT 4.0 : couleur du texte des fenêtres de conseils',
'Win 95 & NT 4.0 : couleur du fond des fenêtres de conseils',
'Win 98 & 2000 : coul. à droite du dégradé barre de titre fenêtre active',
'Win 98 & 2000 : coul.à droite du dégradé barre de titre fenêtre inactive',
'Couleur par défaut pour le contrôle auquel la couleur est affectée');
Type
{ définition des types utilisés}
TTypeData = (tdChar,tdInteger,tdReal,tdString);
TTypeDataModeInput =(tdmiListByNiveau);
procedure Register;
begin
// RegisterPropertyEditor(TypeInfo(TSeparator),Nil,TSeparatorProperty);
RegisterComponents('Test', [TBTreeGraph]);
end;
{-------------------------------------------------------------------------------
Fonction servant au Débugage
-------------------------------------------------------------------------------}
Function ColorToString(Const aColor : TColor) : String;
begin
result := 'Couleur non typée';
Case aColor of
clNone : result := kStrColor[1];
clScrollBar : result := kStrColor[2];
clAqua : result := kStrColor[3];
clBackground : result := kStrColor[4];
clBlack : result := kStrColor[5];
clActiveCaption : result := kStrColor[6];
clBlue : result := kStrColor[7];
clInactiveCaption : result := kStrColor[8];
clCream : result := kStrColor[9];
clMenu : result := kStrColor[10];
clDkGray : result := kStrColor[11];
clWindow : result := kStrColor[12];
clFuchsia : result := kStrColor[13];
clWindowFrame : result := kStrColor[14];
// clGray : result := kStrColor[15];
clMenuText : result := kStrColor[16];
clGreen : result := kStrColor[17];
clWindowText : result := kStrColor[18];
clLime : result := kStrColor[19];
clCaptionText : result := kStrColor[20];
clLtGray : result := kStrColor[21];
clActiveBorder : result := kStrColor[22];
clMaroon : result := kStrColor[23];
clInactiveBorder : result := kStrColor[24];
clMedGray : result := kStrColor[25];
clAppWorkSpace : result := kStrColor[26];
clMoneyGreen : result := kStrColor[27];
clHighlight : result := kStrColor[28];
clNavy : result := kStrColor[29];
// clHightlightText : result := kStrColor[30];
clOlive : result := kStrColor[31];
clBtnFace : result := kStrColor[32];
clPurple : result := kStrColor[33];
clBtnShadow : result := kStrColor[34];
clRed : result := kStrColor[35];
clGrayText : result := kStrColor[36];
// clSilver : result := kStrColor[37];
clBtnText : result := kStrColor[38];
clSkyBlue : result := kStrColor[39];
clInactiveCaptionText : result := kStrColor[40];
clTeal : result := kStrColor[41];
clBtnHighlight : result := kStrColor[42];
clWhite : result := kStrColor[43];
cl3DDkShadow : result := kStrColor[44];
clYellow : result := kStrColor[45];
cl3DLight : result := kStrColor[46];
clInfoText : result := kStrColor[47];
clInfoBk : result := kStrColor[48];
clGradientActiveCaption : result := kStrColor[49];
clGradientInactiveCaption : result := kStrColor[50];
clDefault : result := kStrColor[51];
end;
end;
{Valeurs des données de l'arbre par défaut}
Const
DataCharDef : Array[1..NbDataDef] of Char =
('A','B','C','D','E','F','G','H','I');
DataIntegerDef : Array[1..NbDataDef] of Integer =
(0,1,2,3,4,5,6,7,8);
DataRealDef : Array[1..NbDataDef] of Extended =
(0.0,1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8);
DataCharString : Array[1..NbDataDef] of String =
('ABC','DEF','GHI','JKL','MNO','PQR','STU','VWX','YZ');
ListFilsDef : Array[1..MaxDataDef] of boolean =
(true, // racine = niveau 0
true,true,true, // niveau 1
true,true,true,true,true,true,true,true,true); // niveau 2;
// false,false
{Valeur des Points construisant les figures qui utilisent la fonction Polygon -}
const
Points_TRIANGLE : Array[0..3] of TPoint =
((X:50;Y:0),(X:100;Y:100),(X:0;Y:100),(X:50;Y:0));
Points_PARALLELOGRAM : Array[0..4] of TPoint =
((X:0;Y:0),(X:75;Y:0),(X:100;Y:100),(X:25;Y:100),(X:0;Y:0));
Points_TRAPEZOID : Array[0..4] of TPoint =
((X:25;Y:0),(X:75;Y:0),(X:100;Y:100),(X:0;Y:100),(X:25;Y:0));
Points_PENTAGON : Array[0..5] of TPoint =
((X:50;Y:0),(X:100;Y:50),(X:75;Y:100),(X:25;Y:100),(X:0;Y:50),(X:50;Y:0));
Points_HEXAGON : Array[0..6] of TPoint =
((X:25;Y:0),(X:75;Y:0),(X:100;Y:50),(X:75;Y:100),(X:25;Y:100),(X:0;Y:50),
(X:25;Y:0));
Points_OCTAGON : Array[0..8] of TPoint =
((X:25;Y:0),(X:75;Y:0),(X:100;Y:25),(X:100;Y:75),(X:75;Y:100),(X:25;Y:100),
(X:0;Y:75),(X:0;Y:25),(X:25;Y:0));
Points_STAR : Array[0..16] of TPoint =
((X:11;Y:0),(X:13;Y:6),(X:19;Y:3),(X:16;Y:9),(X:22;Y:11),(X:16;Y:13),
(X:19;Y:19),(X:13;Y:16),(X:11;Y:22),(X:9;Y:16),(X:3;Y:19),(X:6;Y:13),
(X:0;Y:11),(X:6;Y:9),(X:3;Y:3),(X:9;Y:6),(X:11;Y:0));
Points_BUBBLE : Array[0..11] of TPoint =
((X:10;Y:23),(X:17;Y:10),(X:20;Y:10),(X:23;Y:7),(X:23;Y:3),(X:20;Y:0),
(X:3;Y:0),(X:0;Y:3),(X:0;Y:7),(X:3;Y:10),(X:15;Y:10),(X:10;Y:23));
destructor TBTreeGraphTitle.Destroy;
begin
FBackgroundBrush.Free;
FTextBrush.Free;
FFont.Free;
inherited Destroy;
end;
procedure TBTreeGraphTitle.Assign(Source : TPersistent);
begin
if Source is TBTreeGraphTitle then
begin
with TBTreeGraphTitle(Source) do
begin
Self.FBackgroundBrush.Assign(FBackgroundBrush);
Self.FTextBrush.Assign(FTextBrush);
Self.FFont.Assign(FFont);
end;
end else inherited;
end;
procedure TBTreeGraphTitle.SetBackgroundBrush(New : TBrush);
begin
FBackgroundBrush.Assign(New);
end;
procedure TBTreeGraphTitle.SetTextBrush(New : TBrush);
begin
FTextBrush.Assign(New);
end;
procedure TBTreeGraphTitle.SetHeight(Value : Integer);
begin
if FHeight Value then
begin
FHeight := Value;
FBTreeGraph.PaintTitle;
end;
end;
procedure TBTreeGraphTitle.SetText(Value : String);
begin
if FText Value then
begin
FText := Value;
FBTreeGraph.PaintTitle;
end;
end;
procedure TBTreeGraphTitle.SetAlignText(Value : TAlignText);
begin
if (FAlignText Value) then
begin
FAlignText := Value;
FBTreeGraph.PaintTitle;
end;
end;
{Création par défaut des données de l'arbre
et des tables}
SetLength(FCenterPointEtiquette,NbEleMax);
SetLength(FTabExistenceNoeuds,NbeleMax);
InitializeTableauExistenceNoeuds(NbEleMax,FTabExistenceNoeuds);
InitializeCentresEtiquettes(NbEleMax,FCenterPointEtiquette);
end;
destructor TBTreeGraph.Destroy;
begin
BmpTree.Free;
if MemDC 0 then DeleteDC(MemDC);
FBrush.Free;
FPen.Free;
inherited Destroy;
end;
{-------------------------------------------------------------------------------
Calcul le maximum d'éléments de l'arbre en fonction de l'Ordre et du nombre
de niveaux de l'arbre. 0 1 (niveau - 1)
N = O + O + ... O
-------------------------------------------------------------------------------}
Function TBTreeGraph.NbMaxElements(Const OrdreArbre : Integer; Const NbNiveau : Integer) : LongInt;
var ii : integer;
Begin
result := 0;
for ii := 0 to NbNiveau -1 do result := result + Trunc(Power(OrdreArbre,ii));
End;
{-------------------------------------------------------------------------------
Donne le nombre de freres Maximum à un niveau déterminé de l'arbre d'ordre
Ordrearbre 2
Exemple : Arbre d'ordre 3, au 2ème niveau => Nmax = 3 = 9
-------------------------------------------------------------------------------}
Function TBTreeGraph.NbFreresMaxIntoNiv(Const OrdreArbre : Integer; Const Niveau : Integer) : Integer;
Begin
Result := Trunc(Power(OrdreArbre,Niveau));
End;
{-------------------------------------------------------------------------------
Calcul de la longueur et la hauteur d'un texte
Sert à l'ajustement des textes aux zones réservées
-------------------------------------------------------------------------------}
Procedure TBTreeGraph.TextSizeWH(Texte : string; Police : TFont; Var Wtext,Htext : Integer);
var
DC : HDC;
Rect: TRect;
Bmpt: TBitmap;
begin
Bmpt := TBitmap.create;
if police nil then Bmpt.canvas.Font := police;
Rect.Left := 0;
Rect.Top := 0;
Rect.Right := 0;
Rect.Bottom := 0;
DC := GetDC(0);
Bmpt.Canvas.Handle := DC;
DrawText(Bmpt.Canvas.Handle, PChar(Texte), Length(Texte), Rect,
(DT_EXPANDTABS or DT_CALCRECT));
Bmpt.Canvas.Handle := 0;
ReleaseDC(0, DC);
Wtext :=Rect.Right - Rect.Left;
Htext :=Rect.Bottom - Rect.Top;
Bmpt.Free;
end;
{-------------------------------------------------------------------------------
Fonction de conversion de l'ordre des ascii séparteur de données en son nom
symbolique qui apparaitra tel quel dans l'inspecteur de propriété du composant
Ord('.') => '.' visuel dans l'inspecteur
utilise pour cela un nouveau type de propriété qui n'est pas hérité naturellement
et qu'il faut définir
--------------------------------------------------------------------------------}
{Function TBTreeGraph.SeparatorToIdent(Separator : LongInt; Var Ident : String):Boolean;
begin
result := IntToIdent(Separator,Ident,Separators);
end;
Function TBTreeGraph.IdentToSeparator(const Ident : string; Var Separator : LongInt):Boolean;
begin
end;
{===============================================================================
DESSINS DES FORMES D'ETIQUETTES
===============================================================================}
{ Paint ------------------------------------------------------------------------
--------------------------------------------------------------------------------
Paint est appelée à chaque fois que l'objet TreeShape doit mettre à jour son image,
c'est à dire :
- La première fois qu'elle est dessinée
- Qu'une fenêtre au desus est enlevée
- En forçant son dessin par la méthode Invalidate, lorsque par exemple, une
propriété de la Led est modifiée par programme.
- Met à jour à la fois la couleur de l'étiquette et de son ombre
-------------------------------------------------------------------------------}
procedure TBTreeGraph.Paint;
var
ii : Integer;
O : TPoint;
WidthText,
HeightText : Integer;
oldFont : TFont;
begin
with inherited Canvas do
begin
{Création mémoire pour la sauvegarde du bitmap}
if MemDC = 0 then MemDC := CreateCompatibleDC(Canvas.Handle);
{Création image de l'arbre}
BmpTree.Canvas.FillRect(ClientRect); {Efface l'ancien arbre avec la couleur de fond}
With BmpTree.Canvas do
begin
{Sauvegarde de la police pour les caractères}
Font.Name := 'Times New Roman';
Font.Style := [fsBold];
Font.Size := 10;
Font.Color := ClRed;
Brush.Color := FBackgroundColor;
OldFont := Font;
{Positionnement et Dessin des étiquettes}
{Position de la Racine}
O.X := FCenterPointEtiquette[0].X;
O.Y := FCenterPointEtiquette[0].Y;
if ShadowEtiquette then PaintShadowEtiquette(O);
PaintEtiquette(O);
{Position des autres étiquettes}
For ii := 1 to High(FCenterPointEtiquette) do
begin
O.X := FCenterPointEtiquette[ii].X;
O.Y := FCenterPointEtiquette[ii].Y;
if ShadowEtiquette then PaintShadowEtiquette(O);
PaintEtiquette(O);
end;
end;
if FBmpStretch
then StretchDraw(Rect, BmpTree)
else Draw(Rect.Left, Rect.Top, BmpTree);
end;
end;
{-------------------------------------------------------------------------------
Dessine la zone de titre : couleurs, style, texte
-------------------------------------------------------------------------------}
procedure TBTreeGraph.PaintTitle;
var
aRect : TRect;
WidthText,
HeightText : Integer;
begin
With BmpTree.Canvas do
begin
{Ecriture du titre de l'arbre}
aRect.Left := 0;
aRect.Bottom := Title.Height;
aRect.Right := BmpTree.Width;
aRect.Top := 0;
Brush.Color := Title.BackGroundBrush.Color;
Rectangle(aRect);
WidthText := 0;
HeightText := 0;
TextSizeWH(FTitle.FText,FTitle.FFont,WidthText,HeightText);
if FTitle.Height > HeightText then
begin
Font := FTitle.FFont;
Case FTitle.FAlignText of
taLeftBottom : TextOut(2,FTitle.Height - HeightText - 1,FTitle.FText);
taLeftCenter : TextOut(2,(FTitle.Height - HeightText ) div 2,FTitle.FText);
taLeftTop : TextOut(2,2,FTitle.FText);
taCenterBottom: TextOut((Width - WidthText) div 2,FTitle.Height - HeightText - 1,FTitle.FText);
taCenterCenter: TextOut((Width - WidthText) div 2,(FTitle.Height - HeightText ) div 2,FTitle.FText);
taCenterTop : TextOut((Width - WidthText) div 2,2,FTitle.FText);
taRightBottom : TextOut( Width - WidthText - 2,FTitle.Height - HeightText - 1,FTitle.FText);
taRightCenter : TextOut( Width - WidthText - 2,(FTitle.Height - HeightText ) div 2,FTitle.FText);
taRigthTop : TextOut( Width - WidthText - 2,2,FTitle.FText);
End;
end;
end;
end;
procedure TBTreeGraph.PaintShadowEtiquette(Const Centre : TPoint);
begin
With BmpTree.Canvas do
begin
Brush.Color := FShadowEtiquetteColor;
Pen.Color := FShadowEtiquetteColor;
Case FEtiquette of
teCircle : DrawShadowEtiqCircle(Centre);
teEllipse : DrawShadowEtiqEllipse(Centre);
teSquare : DrawShadowEtiqSquare(Centre);
teRect : DrawShadowEtiqRect(Centre);
teRoundSquare: DrawShadowEtiqRoundSquare(Centre);
teRoundRect : DrawShadowEtiqRoundrect(Centre);
teTriangle : DrawShadowEtiqTriangle(Centre);
teParallelogram : DrawShadowEtiqParallelogram(Centre);
teTrapezoid : DrawShadowEtiqTrapezoid(Centre);
tePentagon : DrawShadowEtiqPentagon(Centre);
teHexagon : DrawShadowEtiqHexagon(Centre);
teOctagon : DrawShadowEtiqOctagon(Centre);
teNonagone : DrawShadowEtiqNonagon(Centre);
teStar : DrawShadowEtiqStar(Centre);
teBubble : DrawShadowEtiqBuble(Centre);
end;
end;
end;
procedure TBTreeGraph.PaintEtiquette(Const Centre : TPoint);
begin
With BmpTree.Canvas do
begin
Brush.Color := FEtiquetteColor;//FBrush.Color;
Pen.Color := FEtiquetteFrameColor;//FPen.Color;
Case FEtiquette of
teCircle : DrawEtiqCircle(Centre);
teEllipse : DrawEtiqEllipse(Centre);
teSquare : DrawEtiqSquare(Centre);
teRect : DrawEtiqRect(Centre);
teRoundSquare: DrawEtiqRoundSquare(Centre);
teRoundRect : DrawEtiqRoundrect(Centre);
teTriangle : DrawEtiqTriangle(Centre);
teParallelogram : DrawEtiqParallelogram(Centre);
teTrapezoid : DrawEtiqTrapezoid(Centre);
tePentagon : DrawEtiqPentagon(Centre);
teHexagon : DrawEtiqHexagon(Centre);
teOctagon : DrawEtiqOctagon(Centre);
teNonagone : DrawEtiqNonagon(Centre);
teStar : DrawEtiqStar(Centre);
teBubble : DrawEtiqBuble(Centre);
end;
end;
end;
{-------------------------------------------------------------------------------
Centralisation des évènements OnChange de FPen et FBrush
-------------------------------------------------------------------------------}
procedure TBTreeGraph.ChangeRedraw(Sender: TObject);
begin
Invalidate;
end;
{-------------------------------------------------------------------------------
On mémorise les fils existants par défaut
-------------------------------------------------------------------------------}
procedure TBTreeGraph.InitializeTableauExistenceNoeuds(NombreMaxElements : LongInt; Var FTabExistenceNoeuds : array of boolean);
var ii : integer;
begin
For ii := 0 to High(FTabExistenceNoeuds)
do FTabExistenceNoeuds[ii]:= ListFilsDef[ii];
end;
{-------------------------------------------------------------------------------
On mémorise dans un tableau les coordonnées de chaque Centre d'étiquette
-------------------------------------------------------------------------------}
procedure TBTreeGraph.InitializeCentresEtiquettes(NombreElements : LongInt; var FCenterPointEtiquette : array of Tpoint);
var X,Y,X0,Y0 : integer;
Nel : Integer; // nb Noeud au niveau considéré
eeW : Integer; // interval entre les noeuds au niveau considéré
Niv : Integer;
nFr,nFrMax : Integer; // nb de frères sur un niveau
MemEl : Integer; // centre noeuds déjà calculés
begin
{Racine centrée en largeur}
FCenterPointEtiquette[0]:= Point(BmpTree.Width div 2,
1 + FTitle.Height + (FHeightSpace + FHeightEtiq) div 2);
Niv := 2;
MemEl := 1;
nFr := 0;
nFrMax:= NbFreresMaxIntoNiv(OrdreArbre,Niv-1);
{coordonnées du centre première étiquette à gauche}
eeW := ( BmpTree.Width - (nFrMax * FWidthEtiq) ) div nFrMax;
X0 := (FWidthEtiq + eeW) div 2;
Y0 := FTitle.Height + FHeightEtiq div 2;
{Parcours des éléments potentiels de l'arbre}
For nEl := 1 to High(FCenterPointEtiquette) do
begin
if FTabExistenceNoeuds[nEl] then
begin
if (nEl - MemEl) = nFrMax then
begin {Changement de niveau}
if Niv < FHauteurArbre + 1 then
begin
{Coordonnées du centrepremière étiquette à gauche}
eeW := ( BmpTree.Width - (nFrMax * FWidthEtiq) ) div nFrMax;
X0 := (FWidthEtiq + eeW) div 2;
Y0 := Y0 + FHeightSpace + FHeightEtiq div 2;
end;
end else inc(nFr);
{Calcul et Stockage des coordonnées du centre}
X := X0 + (eeW + FWidthEtiq) * (nFr - 1);
Y := Y0;
FCenterPointEtiquette[nEl] := Point(X,Y);
end;
end;
end;
procedure TBTreeGraph.SetBrush(Value: TBrush);
begin
FBrush.Assign(Value);
end;
procedure TBTreeGraph.SetPen(Value: TPen);
begin
FPen.Assign(Value);
end;
procedure TBTreeGraph.SetTransparent(Value: Boolean);
begin
if value FTransparent then
begin
FTransparent := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetAutoSize(Value: Boolean);
begin
if value FAutoSize then
begin
FAutoSize := Value;
if FAutosize And (not BmpTree.Empty)then
begin
Width := BmpTree.Width;
Height := BmpTree.Height;
end;
Invalidate;
end;
end;
procedure TBTreeGraph.SetBmpStretch(Value: Boolean);
begin
if value FBmpStretch then
begin
FBmpStretch := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetTypeData(Value: TTypeData);
begin
if value FDataType then
begin
FDataType := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetDataModeInput(Value: TTypeDataModeInput);
begin
if value FDataModeInput then
begin
FDataModeInput := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetDataSeparator(Value: TDataSeparator);
begin
if value FDataSeparator then
begin
FDataSeparator := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetDataInteger(Value: Integer);
begin
if value FDataInteger then
begin
FDataInteger := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetDataReal(Value: Extended);
begin
if value FDataReal then
begin
FDataReal := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetDataChar(Value: Char);
begin
if value FDataChar then
begin
FDataChar := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetDataString(Value: String);
begin
if value FDataString then
begin
FDataString := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetBackgroundColor(const Value: TColor);
begin
FBackgroundColor := Value;
Invalidate;
end;
procedure TBTreeGraph.SetTitle(Value: TBTreeGraphTitle);
begin
with FTitle do
begin
TextBrush := Value.TextBrush;
Font := Value.Font;
AlignText := Value.AlignText;
Height := Value.Height;
Text := Value.Text;
end;
end;
procedure TBTreeGraph.SetShadowEtiquette(Value: Boolean);
begin
if FShadowEtiquette Value then
begin
FShadowEtiquette := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetFrameShadowEtiquette(Value: Boolean);
begin
if FFrameShadowEtiquette Value then
begin
FFrameShadowEtiquette := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetShadowOffset(Value: Integer);
begin
if FShadowEtiquetteOffset Value then
begin
FShadowEtiquetteOffset := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetShadowColor(Value: TColor);
begin
if FShadowEtiquetteColor Value then
begin
FShadowEtiquetteColor := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetShadowFrameColor(Value: TColor);
begin
if FShadowEtiquetteColor Value then
begin
FShadowEtiquetteColor := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetEtiquetteColor(Value: TColor);
begin
Showmessage('Value dans SetEtiquetteColor : '+ColorToString(Value)+#13+
'FEtiquetteColor dans SetEtiquetteColor : '+ColorToString(FEtiquetteColor));
if FEtiquetteColor Value then
begin
FEtiquetteColor := Value;
Showmessage('SetEtiquetteColor : '+ColorToString(FEtiquetteColor));
Invalidate;
end;
end;
procedure TBTreeGraph.SetEtiquetteFrameColor(Value: TColor);
begin
if FEtiquetteFrameColor Value then
begin
FEtiquetteFrameColor := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetEtiquetteTextColor(Value: TColor);
begin
if FEtiquetteTextColor Value then
begin
FEtiquetteTextColor := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetConnectColor(Value: TColor);
begin
if FConnectColor Value then
begin
FConnectColor := Value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetBmpTransparentColor(const Value: TColor);
begin
FBmpTransparentColor := Value;
Invalidate;
end;
procedure TBTreeGraph.SetEtiquette(value: TTypeEtiquet);
begin
if value FEtiquette then
begin
FEtiquette := value;
Paint;
Invalidate;
end;
end;
procedure TBTreeGraph.SetConnexion(value : TTypeConnexion);
begin
if value FConnexion then
begin
FConnexion := value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetConnected(value : Boolean);
begin
if value FConnect then
begin
FConnect := value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetTreeFull(value : Boolean);
begin
if value FTreeFull then
begin
FTreeFull := value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetHeightEtiquette(Value : Integer);
begin
if value FHeightEtiq then
begin
If FEtiquette In [TeCircle,TeSquare,TeRoundSquare] then
begin
FHeightEtiq := value;
FWidthEtiq := value;
Invalidate;
end;
end;
end;
procedure TBTreeGraph.SetWidthEtiquette(Value : Integer);
begin
if value FWidthEtiq then
begin
If FEtiquette In [TeCircle,TeSquare,TeRoundSquare] then
begin
FWidthEtiq := value;
FHeightEtiq := value;
Invalidate;
end;
end;
end;
procedure TBTreeGraph.SetWidthSpace(Value : Integer);
begin
if value FWidthSpace then
begin
FWidthSpace := value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetHeightSpace(Value : Integer);
begin
if value FHeightSpace then
begin
FHeightSpace := value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetOrdreArbre(Value : Integer);
begin
if value FOrdreArbre then
begin
FOrdreArbre := value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetHauteurarbre(Value : Integer);
begin
if value FHauteurArbre then
begin
FHauteurArbre := value;
Invalidate;
end;
end;
procedure TBTreeGraph.SetNumberFeuillesMax(Value : Integer);
begin
if value FNbFeuillesMax then
begin
FNbFeuillesMax := value;
Invalidate;
end;
end;
function TBTreeGraph.CalcPoly(var Points: Array of TPoint; Source: Array of TPoint; AWidth, AHeight: Integer): Boolean;
var i : Integer;
lx,ly : LongInt;
begin
Result := True;
try
for i := Low(Points) to High(Points) do begin
lx := MulDiv(Source[i].x,AWidth,100);
ly := MulDiv(Source[i].y,AHeight,100);
Points[i].x := lx;
Points[i].y := ly;
end;
except
Result := False;
end;
end;
procedure TBTreeGraph.OffsetPoly(var Points: Array of TPoint; OfsX,OfsY: Integer);
var i: Integer;
begin
for i := Low(Points) to High(Points) do begin
Points[i].x := Points[i].x+OfsX;
Points[i].y := Points[i].y+OfsY;
end;
end;
{-------------------------------------------------------------------------------
Dessin Etiquette circulaire et son ombre projetée
-------------------------------------------------------------------------------}
procedure TBTreeGraph.DrawShadowEtiqCircle(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
if ShadowEtiquette then
begin
{ Calcul dimensions width et height de l'ombre}
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
BmpTree.Canvas.Ellipse(x,y,xx,yy);
end;
end;
procedure TBTreeGraph.DrawEtiqCircle(Const Centre : TPoint);
var x,y,xx,yy: Integer;
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1;
BmpTree.Canvas.Ellipse(x,y,xx,yy);
end;
{-------------------------------------------------------------------------------
Dessin Etiquette elliptique et son ombre projetée
-------------------------------------------------------------------------------}
procedure TBTreeGraph.DrawShadowEtiqEllipse(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
if ShadowEtiquette then
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
BmpTree.Canvas.Ellipse(x,y,xx,yy);
end;
end;
procedure TBTreeGraph.DrawEtiqEllipse(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
BmpTree.Canvas.Ellipse(x,y,xx,yy);
end;
{-------------------------------------------------------------------------------
Dessin Etiquette carrée et son ombre projetée
-------------------------------------------------------------------------------}
procedure TBTreeGraph.DrawShadowEtiqSquare(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
if ShadowEtiquette then
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
BmpTree.Canvas.Rectangle(x,y,xx,yy);
end;
end;
procedure TBTreeGraph.DrawEtiqSquare(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
xx := Centre.X + FWidthEtiq div 2 + ShadowEtiquetteOffset + BmpTree.Canvas.Pen.Width + 1;
yy := Centre.Y + FHeightEtiq div 2 + ShadowEtiquetteOffset + BmpTree.Canvas.Pen.Width + 1;
BmpTree.Canvas.Rectangle(x,y,x+xx,y+yy);
end;
{-------------------------------------------------------------------------------
Dessin Etiquette rectangulaire et son ombre projetée
-------------------------------------------------------------------------------}
{procedure TBTreeGraph.DrawBackEtiqRect(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
if ShadowEtiquette then
begin
x := Centre.X - FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width div 2 - ShadowEtiquetteOffset;
y := Centre.Y - FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width div 2 - ShadowEtiquetteOffset;
xx := Centre.X + FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2- BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
if BmpTree.Canvas.Pen.Width = 0 then
begin
Dec(xx);
Dec(yy);
end;
BmpTree.Canvas.Rectangle(x,y,xx,yy);
end;
end;
}procedure TBTreeGraph.DrawShadowEtiqRect(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
if ShadowEtiquette then
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
BmpTree.Canvas.Rectangle(x,y,xx,yy);
end;
end;
procedure TBTreeGraph.DrawEtiqRect(Const Centre : TPoint);
var x,y,xx,yy : Integer;
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width div 2;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width div 2;
BmpTree.Canvas.Rectangle(x,y,xx,yy);
end;
procedure TBTreeGraph.DrawShadowEtiqRoundSquare(Const Centre : TPoint);
var x,y,xx,yy,r : Integer;
begin
if ShadowEtiquette then
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 + ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 - ShadowEtiquetteOffset;
r := xx - x;
BmpTree.Canvas.RoundRect(x,y,x+xx,y+yy,r div 4,r div 4);
end;
end;
procedure TBTreeGraph.DrawEtiqRoundSquare(Const Centre : TPoint);
var x,y,xx,yy,r : Integer;
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 - ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 - ShadowEtiquetteOffset;
r := xx - x;
BmpTree.Canvas.RoundRect(x,y,x+xx,y+yy,r div 4,r div 4);
end;
procedure TBTreeGraph.DrawShadowEtiqRoundrect(Const Centre : TPoint);
var x,y,xx,yy,r : Integer;
begin
if ShadowEtiquette then
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2 + ShadowEtiquetteOffset;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 - ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 - ShadowEtiquetteOffset;
r := xx - x;
BmpTree.Canvas.RoundRect(x,y,xx,yy,r div 4,r div 4);
end;
end;
procedure TBTreeGraph.DrawEtiqRoundrect(Const Centre : TPoint);
var x,y,xx,yy,r : Integer;
begin
x := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
y := Centre.Y - FHeightEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
xx := Centre.X + FWidthEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 - ShadowEtiquetteOffset;
yy := Centre.Y + FHeightEtiq div 2 + BmpTree.Canvas.Pen.Width + 1 - ShadowEtiquetteOffset;
r := xx - x;
BmpTree.Canvas.RoundRect(x,y,xx,yy,r div 4,r div 4);
end;
procedure TBTreeGraph.DrawShadowEtiqTriangle(Const Centre : TPoint);
var Points : Array[0..3] of TPoint;
l,t,w,h : Integer;
begin
l := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
t := l;
w := Width-Pen.Width-ShadowEtiquetteOffset-1;
h := Height-Pen.Width-ShadowEtiquetteOffset-1;
if CalcPoly(Points,Points_TRIANGLE,w,h) then
begin
OffsetPoly(Points,l+ShadowEtiquetteOffset,t+ShadowEtiquetteOffset);
BmpTree.Canvas.Polygon(Points);
end;
end;
procedure TBTreeGraph.DrawEtiqTriangle(Const Centre : TPoint);
var Points : Array[0..3] of TPoint;
l,t,w,h : Integer;
begin
l := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
t := l;
w := Width-Pen.Width-ShadowEtiquetteOffset-1;
h := Height-Pen.Width-ShadowEtiquetteOffset-1;
if CalcPoly(Points,Points_TRIANGLE,w,h) then
begin
OffsetPoly(Points,l,t);
BmpTree.Canvas.Polygon(Points);
end;
end;
procedure TBTreeGraph.DrawShadowEtiqParallelogram(Const Centre : TPoint);
var Points : Array[0..4] of TPoint;
l,t,w,h : Integer;
begin
l := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
t := l;
w := Width-Pen.Width-ShadowEtiquetteOffset-1;
h := Height-Pen.Width-ShadowEtiquetteOffset-1;
if CalcPoly(Points,Points_PARALLELOGRAM,w,h) then
begin
OffsetPoly(Points,l+ShadowEtiquetteOffset,t+ShadowEtiquetteOffset);
BmpTree.Canvas.Polygon(Points);
end;
end;
procedure TBTreeGraph.DrawEtiqParallelogram(Const Centre : TPoint);
var Points : Array[0..4] of TPoint;
l,t,w,h : Integer;
begin
l := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
t := l;
w := Width-Pen.Width-ShadowEtiquetteOffset-1;
h := Height-Pen.Width-ShadowEtiquetteOffset-1;
if CalcPoly(Points,Points_PARALLELOGRAM,w,h) then
begin
OffsetPoly(Points,l,t);
BmpTree.Canvas.Polygon(Points);
end;
end;
procedure TBTreeGraph.DrawShadowEtiqTrapezoid(Const Centre : TPoint);
var Points : Array[0..4] of TPoint;
l,t,w,h : Integer;
begin
l := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
t := l;
w := Width-Pen.Width-ShadowEtiquetteOffset-1;
h := Height-Pen.Width-ShadowEtiquetteOffset-1;
if CalcPoly(Points,Points_TRAPEZOID,w,h) then
begin
OffsetPoly(Points,l+ShadowEtiquetteOffset,t+ShadowEtiquetteOffset);
BmpTree.Canvas.Polygon(Points);
end;
end;
procedure TBTreeGraph.DrawEtiqTrapezoid(Const Centre : TPoint);
var Points : Array[0..4] of TPoint;
l,t,w,h : Integer;
begin
l := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
t := l;
w := Width-Pen.Width-ShadowEtiquetteOffset-1;
h := Height-Pen.Width-ShadowEtiquetteOffset-1;
if CalcPoly(Points,Points_TRAPEZOID,w,h) then
begin
OffsetPoly(Points,l,t);
BmpTree.Canvas.Polygon(Points);
end;
end;
procedure TBTreeGraph.DrawShadowEtiqPentagon(Const Centre : TPoint);
var Points : Array[0..5] of TPoint;
l,t,w,h : Integer;
begin
l := Centre.X - FWidthEtiq div 2 - BmpTree.Canvas.Pen.Width div 2;
t := l;
w := Width-Pen.Width-ShadowEtiquetteOffset-1;
h := Height-Pen.Width-ShadowEtiquetteOffset-1;
if CalcPoly(Points,Points_PENTAGON,w,h) then
begin
OffsetPoly(Points,l+ShadowEtiquetteOffset,t+ShadowEtiquetteOffset);
BmpTree.Canvas.Polygon(Points);
end;
end;
procedure TBTreeGraph.DrawEtiqPentagon(Const Centre : TPoint);
var Points : Array[0..5] of TPoint;
l,t,w,h : Integer;
cs_Jean_Jean
Messages postés615Date d'inscriptiondimanche 13 août 2006StatutMembreDernière intervention13 décembre 20183 26 août 2010 à 22:13
Francky,
j'ai zippé mes fichiers mais je n'ai trouvé aucune aide sur MegaUpload pour dire comment on stocke le dossier. Je me suis inscrit, mais même dans la FAQ, je n'ai pas trouver de mode d'emploi.
Bizarre comme Site. Pourtant utile!!!
je devrais peut-être aller me coucher.
Guillemouze
Messages postés991Date d'inscriptionsamedi 25 octobre 2003StatutMembreDernière intervention29 août 20136 26 août 2010 à 23:34
au passage, sais-tu que tu peux debugger un package en mettant delphi comme application hote ?
Ca fait que tu as 2 instances de delphi demarrées, ce qui peut etre perturbant pour savoir si tu es dans celle de debug ou celle d'execution, mais c'est bien pratique pour debugger les composants
cs_Jean_Jean
Messages postés615Date d'inscriptiondimanche 13 août 2006StatutMembreDernière intervention13 décembre 20183 27 août 2010 à 17:32
Guillemouze
J'ai fait ce que tu as dit, j'ai rien compris, n'ait touché à rien, n'ait rien débuggué....puis j'ai ouvert mon appli pour déposer mon compo sur la fiche. Nickel.
Francky va dire que je chochotte, mais quand même j'aimerai bien comprendre ce qui s'est passé.
cs_Jean_Jean
Messages postés615Date d'inscriptiondimanche 13 août 2006StatutMembreDernière intervention13 décembre 20183 27 août 2010 à 18:27
Guillemouze, tu me prends pour une chochotte?
je l'ai recompilé dans tous les sens.
J'ai même supprimé le composant de la palette et détruit e quelque chosele bpl et remplacé le dpk.
Bah! t'as peut-être raison, j'ai du faire quelque chose de pas chochotte du tout.
Jean_Jean