Sayfayı Yazdır | Pencereyi Kapat

Bitmap hatası

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=855
Tarih: 08 Ocak 2025 Saat 00:01
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: Bitmap hatası
Mesajı Yazan: Furblood
Konu: Bitmap hatası
Mesaj Tarihi: 09 Ağustos 2024 Saat 17:52
fotoğrafı base64 formatından streame dönüştüremiyorum.


var
MyprofileForm : TclForm;
labelID, labelUsername, labelName, labelSurname, labelAge, labelWeight, labelHeight, labelBMI, labelPhone, labelPassword, labelCity, labelGender, labelTitle, labelSidetitle1, labelSidetitle2, labelSidetitle3: TClProLabel;
panelTop,panelBottom,panel3 : TclProPanel;

BMI:Real;
bmiResultLabel: TClProLabel;
Qry : TclSQLiteQuery;
userPhoto : TclProImage;

noteMemo:TCLMemo;
baseString : String;
LMemStream:TCLMemoryStream;




void SqLiteConnection;
{
  try
    Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'GYM1.db3', '');
  except
   ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
  }
}

void SelectKullaniciVerileri;
{
  try
    Qry = Clomosy.DBSQLiteQueryWith('SELECT * FROM users WHERE USERNAME=' + QuotedStr(Clomosy.GlobalVariableString));
    Qry.OpenOrExecute;
   
  except
    ShowMessage('Exception Class: ' + LastExceptionClassName + ' Exception Message: ' + LastExceptionMessage);
  }  
}

void GetPhoto;
{
  noteMemo.lines.Text = Qry.FieldByName('PROFILEPHOTO').AsString;
  LMemStream = TCLMemoryStream.Create;
  LMemStream = Clomosy.Base64ToStream(noteMemo.Lines.Text);
  userPhoto.Bitmap.LoadFromStream(LMemStream);
}



function BMIHesapla(weightR: Real; heightR: Real):Real;
var
  heightM:Real;
{
  heightM = heightR / 100;
  BMI = weightR / Sqr(heightM);
  BMI = Trunc(BMI*100)/100;
}
function bmiResult(BMI:Real):String;
{
  if(BMI < 18.5)
    bmiResultLabel.Text = '(Underweight)';
  else if(18.5 <= BMI && BMI < 25 )
    bmiResultLabel.Text = '(Normal weight)';
  else if(25 <= BMI && BMI < 30)
    bmiResultLabel.Text = '(Overweight)';
  else
    bmiResultLabel.Text = '(Obesity)';
}


{
  MyprofileForm = TclForm.Create(Self);
  MyprofileForm.SetFormColor('#FEEFCD', '', clGNone);//,F6EACB
  SqLiteConnection;
  SelectKullaniciVerileri;
 
  GetPhoto;
 
  noteMemo = MyprofileForm.AddNewMemo(MyprofileForm,'noteMemo',''+ Qry.FieldByName('PROFILEPHOTO').AsString);
   
  panelTop = MyprofileForm.AddNewProPanel(MyprofileForm,'panelTop');
  panelTop.Align = alCenter;
  panelTop.Margins.Right = 200;
  panelTop.Margins.Bottom = 400;
  panelTop.Width = 200;
  panelTop.Height = 300;
  panelTop.clProSettings.BackgroundColor = clAlphaColor.clHextoColor('#ffffff');
  panelTop.SetclProSettings(panelTop.clProSettings);
 
  userPhoto = MyprofileForm.AddNewProImage(panelTop,'userPhoto');
  userPhoto.Align = alCenter;
  userPhoto.Margins.Bottom = 100;
  userPhoto.Margins.Right = 10;
  userPhoto.Height = 150;
  userPhoto.clProSettings.PictureSource = ' https://i.imgur.com/38uoXIt.png" rel="nofollow - https://i.imgur.com/38uoXIt.png ';
  userPhoto.SetclProSettings(userPhoto.clProSettings);
 
  panelBottom = MyprofileForm.AddNewProPanel(MyprofileForm,'panelBottom');
  panelBottom.Align = alCenter;
  panelBottom.Margins.Left = 200;
  panelBottom.Margins.Bottom = 100;
  panelBottom.Width = 200;
  panelBottom.Height = 600;
  panelBottom.clProSettings.BackgroundColor = clAlphaColor.clHextoColor('#ffffff');
  panelBottom.SetclProSettings(panelBottom.clProSettings);
 
    labelSidetitle1 = MyprofileForm.AddNewProLabel(panelBottom, 'labelSidetitle1', 'Personal Information');
    labelSidetitle1.Align = alCenter;
    labelSidetitle1.Margins.Top = -500;
    labelSidetitle1.Width = 200;
    labelSidetitle1.clProSettings.FontColor = clAlphaColor.clHextoColor('#000000');
    labelSidetitle1.clProSettings.FontSize = 16;
    labelSidetitle1.clProSettings.TextSettings.Font.Style = [fsBold];
    labelSidetitle1.SetclProSettings(labelSidetitle1.clProSettings);
 
  labelID = MyprofileForm.AddNewProLabel(panelBottom, 'labelID', 'User ID:  '+ Qry.FieldByName('userID').AsString);
  labelID.Align = alCenter;
  labelID.Margins.Top = -400;
  labelID.Width = 200;
  labelID.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelID.clProSettings.FontSize = 14;
  labelID.SetclProSettings(labelID.clProSettings);
 
  labelUsername = MyprofileForm.AddNewProLabel(panelBottom, 'labelUsername', 'Username:  '+ Qry.FieldByName('USERNAME').AsString);
  labelUsername.Align = alCenter;
  labelUsername.Margins.Top = -300;
  labelUsername.Width = 200;
  labelUsername.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelUsername.clProSettings.FontSize = 14;
  labelUsername.SetclProSettings(labelUsername.clProSettings);
 
  labelName = MyprofileForm.AddNewProLabel(panelBottom, 'labelName', 'Name:  ' + Qry.FieldByName('NAME').AsString);
  labelName.Align = alCenter;
  labelName.Margins.Top = -200;
  labelName.Width = 200;
  labelName.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelName.clProSettings.FontSize = 14;
  labelName.SetclProSettings(labelName.clProSettings);
 
  labelSurname = MyprofileForm.AddNewProLabel(panelBottom, 'labelSurname', 'Surname:  '+ Qry.FieldByName('SURNAME').AsString);
  labelSurname.Align = alCenter;
  labelSurname.Margins.Top = -100;
  labelSurname.Width = 200;
  labelSurname.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelSurname.clProSettings.FontSize = 14;
  labelSurname.SetclProSettings(labelSurname.clProSettings);
 
  labelAge = MyprofileForm.AddNewProLabel(panelBottom, 'labelAge', 'Age:  ' +Qry.FieldByName('AGE').AsString);
  labelAge.Align = alCenter;
  labelAge.Margins.Top = 0;
  labelAge.Width = 200;
  labelAge.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelAge.clProSettings.FontSize = 14;
  labelAge.SetclProSettings(labelAge.clProSettings);
 
  labelWeight = MyprofileForm.AddNewProLabel(panelBottom, 'labelWeight', 'Weight: '+Qry.FieldByName('WEIGHT').AsString + ' kg');
  labelWeight.Align = alCenter;
  labelWeight.Margins.Top = 100;
  labelWeight.Width = 200;
  labelWeight.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelWeight.clProSettings.FontSize = 14;
  labelWeight.SetclProSettings(labelWeight.clProSettings);
 
  labelHeight = MyprofileForm.AddNewProLabel(panelBottom, 'labelHeight', 'Height:  '+Qry.FieldByName('HEIGHT').AsString + ' cm');
  labelHeight.Align = alCenter;
  labelHeight.Margins.Top = 200;
  labelHeight.Width = 200;
  labelHeight.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelHeight.clProSettings.FontSize = 14;
  labelHeight.SetclProSettings(labelHeight.clProSettings);
 
  BMIHesapla(StrToFloat(Qry.FieldByName('WEIGHT').AsString),StrToFloat(Qry.FieldByName('HEIGHT').AsString));
  labelBMI = MyprofileForm.AddNewProLabel(panelBottom, 'labelBMI', 'BMI:  '+ FloatToStr(BMI));
  labelBMI.Align = alCenter;
  labelBMI.Margins.Top = 300;
  labelBMI.Width = 200;
  labelBMI.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelBMI.clProSettings.FontSize = 14;
  labelBMI.SetclProSettings(labelBMI.clProSettings);
 
  bmiResultLabel = MyprofileForm.AddNewProLabel(panelBottom, 'bmiResultLabel', '');
  bmiResultLabel.Align = alCenter;
  bmiResultLabel.Margins.Top = 300;
  bmiResultLabel.Margins.Left = 150;
  bmiResultLabel.Width = 200;
  bmiResultLabel.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  bmiResultLabel.clProSettings.FontSize = 14;
  bmiResultLabel.SetclProSettings(bmiResultLabel.clProSettings);
 
  labelGender = MyprofileForm.AddNewProLabel(panelBottom, 'labelGender', 'Gender:  '+Qry.FieldByName('GENDER').AsString);
  labelGender.Align = alCenter;
  labelGender.Margins.Top = 400;
  labelGender.Width = 200;
  labelGender.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelGender.clProSettings.FontSize = 14;
  labelGender.SetclProSettings(labelGender.clProSettings);
 
  labelPassword = MyprofileForm.AddNewProLabel(panelBottom, 'labelPassword', 'Password:  '+Qry.FieldByName('PASSWORD').AsString);
  labelPassword.Align = alCenter;
  labelPassword.Margins.Top = 500;
  labelPassword.Width = 200;
  labelPassword.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelPassword.clProSettings.FontSize = 14;
  labelPassword.SetclProSettings(labelPassword.clProSettings);
 
 
  panel3 = MyprofileForm.AddNewProPanel(MyprofileForm,'panel3');
  panel3.Align = alCenter;
  panel3.Margins.Right = 200;
  panel3.Margins.Top = 100;
  panel3.Width = 200;
  panel3.Height = 400;
  panel3.clProSettings.BackgroundColor = clAlphaColor.clHextoColor('#ffffff');
  panel3.SetclProSettings(panel3.clProSettings);
 
    labelSidetitle2 = MyprofileForm.AddNewProLabel(panel3, 'labelSidetitle2', 'Contact Information');
    labelSidetitle2.Align = alCenter;
    labelSidetitle2.Margins.Bottom = 300;
    labelSidetitle2.Margins.Left = 40;
    labelSidetitle2.Width = 200;
    labelSidetitle2.clProSettings.FontColor = clAlphaColor.clHextoColor('#000000');
    labelSidetitle2.clProSettings.FontSize = 16;
    labelSidetitle2.clProSettings.TextSettings.Font.Style = [fsBold];
    labelSidetitle2.SetclProSettings(labelSidetitle2.clProSettings);
 
  labelPhone = MyprofileForm.AddNewProLabel(panel3, 'labelPhone', 'Phone:  '+Qry.FieldByName('PHONE').AsString);
  labelPhone.Align = alCenter;
  labelPhone.Margins.Bottom = 200;
  labelPhone.Margins.Left = 40;
  labelPhone.Width = 200;
  labelPhone.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelPhone.clProSettings.FontSize = 14;
  labelPhone.SetclProSettings(labelPhone.clProSettings);
 
    labelSidetitle3 = MyprofileForm.AddNewProLabel(panel3, 'labelSidetitle3', 'Location');
    labelSidetitle3.Align = alCenter;
    labelSidetitle3.Margins.Bottom = 100;
    labelSidetitle3.Margins.Left = 40;
    labelSidetitle3.Width = 200;
    labelSidetitle3.clProSettings.FontColor = clAlphaColor.clHextoColor('#000000');
    labelSidetitle3.clProSettings.FontSize = 16;
    labelSidetitle3.clProSettings.TextSettings.Font.Style = [fsBold];
    labelSidetitle3.SetclProSettings(labelSidetitle3.clProSettings);
 
  labelCity = MyprofileForm.AddNewProLabel(panel3, 'labelCity', 'City:  '+Qry.FieldByName('CITY').AsString);
  labelCity.Align = alCenter;
  labelCity.Margins.Bottom = 0;
  labelCity.Margins.Left = 40;
  labelCity.Width = 200;
  labelCity.clProSettings.FontColor = clAlphaColor.clHextoColor('#6482AD');
  labelCity.clProSettings.FontSize = 14;
  labelCity.SetclProSettings(labelCity.clProSettings);
 
  bmiResult(BMI);


  MyprofileForm.Run;
}
--------------------------------------------------------------------
TclForm
Unknown member identifier: 'Bitmap'.
Source position: 43,20
Clomosy Build : 20240709.111531
--------------------------------------------------------------------


-------------
furkanfidan



Cevaplar:
Mesajı Yazan: BilalCndn
Mesaj Tarihi: 13 Ağustos 2024 Saat 14:47
Merhaba Furblood,

GetPhoto prosedürünü userPhoto nesnesini oluşturduktan sonra çağırmalısın. Nesneyi oluşturmadan kullanmaya çalışıyorsun. Ayrıca LoadFromStream özelliği TclImage nesnesi ile çalışıyor. TclProImage yerine TclImage kullanmalısın.

https://www.docs.clomosy.com/index.php/TclMemoryStream" rel="nofollow - https://www.docs.clomosy.com/index.php/TclMemoryStream


-------------
Bilal Candan

Atiker Yazılım Veri İşlem A.Ş.
Software Developer

[email protected]


Mesajı Yazan: Furblood
Mesaj Tarihi: 13 Ağustos 2024 Saat 17:41
Düzeldi, teşekkürler.

-------------
furkanfidan



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net