Statik Kontrol

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
sadettinpolat
Moderator
Mesajlar: 2131
Kayıt: 07 Ara 2003 02:51
Konum: Ankara
İletişim:

Statik Kontrol

Mesaj gönderen sadettinpolat »

forma bir tane image koymak istiyorum ama delphide yer alan image nesnesi benim işimi tam olarak görmüyor.

windowsun statik kontrolleri işimi görebilecek düzeyde ama bir türlü statik kontrolün stilini image olarak ayarlayamadım.

bu konu hakkında bilgisi olan arkadaşlar yardım ederse çok sevinirim.

bu kod label nesnesi gibi handle 'ı olan bir statik kontol oluşturuyor.

Kod: Tümünü seç

Button1.click
var
icon:hicon;
cs:TCreateStruct;
mWnd:Longword;

begin
 mWnd := CreateWindowEx(WS_EX_STATICEDGE Or  WS_EX_TRANSPARENT, 'STATIC', 'statik kontrol', WS_CHILD , 0, 0, 300, 50, Handle, 0, Application.Handle, @CS);

 caption :=inttostr(mWnd);
 ShowWindow( mWnd, SW_NORMAL);

bu msdn de yer alan vc++ kodu
nasıl yaptığını tam olarak anlayamadım

Kod: Tümünü seç

CStatic myStatic;

// Create a child icon static control.
myStatic.Create(_T("my static"), 
   WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), 
   pParentWnd);

// Set the icon of the static control to be the system 
// question mark icon.
myStatic.SetIcon( ::LoadIcon(NULL, IDI_QUESTION) );
Static Control Styles
...

SS_ICON : Specifies an icon is to be displayed in the dialog box. If the control is created as part of a dialog box, the text is the name of an icon (not a filename) defined elsewhere in the resource file. If the control is created via CreateWindow or a related function, the text is the name of an icon (not a filename) defined in the resource file associated with the module specified by the hInstance parameter to CreateWindow. The icon can be an animated cursor. The style ignores the nWidth and nHeight parameters; the control automatically sizes itself to accommodate the icon.

...
Kullanıcı avatarı
sadettinpolat
Moderator
Mesajlar: 2131
Kayıt: 07 Ara 2003 02:51
Konum: Ankara
İletişim:

Mesaj gönderen sadettinpolat »

çince bir sitede lazım olan kodu buldum
teşekkürler...

Kod: Tümünü seç

procedure TForm1.Button1Click(Sender: TObject);
var
Bitmap:HBITMAP;
hStatic:Thandle;
begin
 Bitmap :=image1.Picture.Bitmap.Handle;

 hStatic := CreateWindowEx(0,'Static', '',
 WS_CHILD Or WS_EX_TRANSPARENT or WS_VISIBLE Or SS_BITMAP ,
 0,1,200,200,Handle,0 ,hInstance,nil);
 SendMessage(hStatic, STM_SETIMAGE, IMAGE_BITMAP,Bitmap);
end;
Cevapla