31640
Goto Top

Runde, Sternformige Fenster erstellen

Erstellen von Fenster in verschieden Formen

Um ein rundes Fenster zu erstellen muss man die Funktion
HRGN R;
R=Create***Rgn(i,j,i+1,j+1);	
SetWindowRgn(Handle, R, TRUE);
Statt *** setzt man name des Figurus(Ellipse für Kreis)

so
weist aber jemand was an dieser Funkton
HRGN R1, R2;
for(int i=0;i<255;i++){
	for(int j=0;j<255;j++){
		if (!(picture->canvas->pixels[i][j]==clRed)){
			R1=CreateRestangleRgn(i,j,i+1,j+1);	
		}	
		CombineRgn(R2,R2,R1,RGN_OR);
	}
}
SetWindowRgn(Handle, R1, TRUE);

falsch ist?
werde sehr dankbar für eine Antwort.

Vprimachenko

Content-Key: 35620

Url: https://administrator.de/contentid/35620

Ausgedruckt am: 19.03.2024 um 03:03 Uhr

Mitglied: filippg
filippg 07.07.2006 um 20:26:20 Uhr
Goto Top
Ich weiss nicht, ob das der Fehler ist, aber ich keine Figur, die sich "Restangle" nennt ( R1=CreateRestangleRgn(i,j,i+1,j+1); ).

Filipp
Mitglied: 31640
31640 07.07.2006, aktualisiert am 23.10.2012 um 12:38:37 Uhr
Goto Top
ja da hast du recht hab das jetzt umgeschrieben als

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h" 
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm" 
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Application->MessageBox("1","1",MB_OK);  
HRGN R1, R2;
for(int i=0;i<255;i++){
	for(int j=0;j<255;j++){
		if (!(Image1->Canvas->Pixels[i][j] == clRed)){
			R1=CreateRectRgn(i,j,i+1,j+1);
		        CombineRgn(R2,R2,R1,RGN_OR);
                       // Application->MessageBox(i,j,MB_OK);
                }

	}
}
Application->MessageBox("2","2",MB_OK);  
SetWindowRgn(Form1->Handle, R2, true);
}
//---------------------------------------------------------------------------
Hillft aber nicht ...
Mitglied: 31640
31640 10.07.2006, aktualisiert am 23.10.2012 um 12:38:57 Uhr
Goto Top
habe das fehler gefunden:
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h" 
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm" 
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Application->MessageBox("1","1",MB_OK);  
HRGN R1, R2;
R2=CreateRectRgn(0,0,1,1);    //erste RGN erstellen
for(int i=0;i<255;i++){
	for(int j=0;j<255;j++){
		if (!(Image1->Canvas->Pixels[i][j] == clRed)){
			R1=CreateRectRgn(i,j,i+1,j+1);
		        CombineRgn(R2,R2,R1,RGN_OR);
                       // Application->MessageBox(i,j,MB_OK);
                }

	}
}
R1=CreateRectRgn(0,0,1,1);           //Erste RGN nochmal erstellen
CombineRgn(R2,R2,R1,RGN_DIFF); //wieder rausnehmen
Application->MessageBox("2","2",MB_OK);  
SetWindowRgn(Form1->Handle, R2, true);
}
//---------------------------------------------------------------------------

Man kann scheinbar nicht NULL mit RGN zusmmensetzen (funktion CombineRgn) also benutz ich son Umweg
Mitglied: 31640
31640 18.07.2006 um 09:53:21 Uhr
Goto Top
jetzt gibt´s ein Tuto dafür(mit Bild)! face-smile