May 04, 2024, 03:04:38 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Image Loading

Started by Bruce Peaslee, January 21, 2006, 02:59:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruce Peaslee

Do we have the capability of loading images and placing them into windows?
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Bruce Peaslee

Found a solution on my ownÂÃ,  8)

dlg::OnInitDialog(), int
{
ÂÃ,  string sText;
ÂÃ,  CStatic *pLabel;
ÂÃ,  unsigned int hImage;

ÂÃ,  sText = "Program Name\n"ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, +ÂÃ, 
ÂÃ,  ÂÃ,  "ÂÃ,© 2006 Campanile Data Systems\n" +
ÂÃ,  ÂÃ,  "All Rights Reserved\n\n"ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, +
ÂÃ,  ÂÃ,  "Version 0.01 1/21/06";
ÂÃ,  pLabel = GetControl(lblAboutText);
ÂÃ,  pLabel ->SetText(sText);
ÂÃ,  hImage = LoadImageA(GetModuleHandleA(0),"chezp",0,0,0,0); // "chezp" is resource id
ÂÃ,  if (hImage = null)
ÂÃ,  ÂÃ,  MessageBox(0,"Image failed to load","Internal Error",0);
ÂÃ,  pLabel = GetControl(lblAboutImage); // static control, SS_SUNKEN for nice look
ÂÃ,  pLabel ->SetImage(hImage);

ÂÃ,  CenterWindow();
ÂÃ,  return true;
}

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

The image functions are not done yet.  We will have load and show image soon.
Ionic Wind Support Team

Bruce Peaslee

Quote from: Ionic Wizard on January 22, 2006, 12:37:38 PM
The image functions are not done yet.ÂÃ,  We will have load and show image soon.

I thought so. However, it's good for me to see if I can figure this stuff out while we wait for the language to be fleshed out. One cannot have too much experience with MSDN and the API!

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

You did a good job ;)

Both the button and static classes have a SetImage method.   If creating your controls manually, without the dialog editor, use the styles ABS_BITMAP or ASS_BITMAP.

Paul.

Ionic Wind Support Team

Bruce Peaslee

Here is an example of putting an image onto your main window:


global sub main()
{
ÂÃ,  def winMain as myWindow;
ÂÃ,  CStatic Image;

ÂÃ,  winMain.Create(0,0,640,440,
ÂÃ,  ÂÃ,  AWS_CAPTION|AWS_VISIBLE|AWS_BORDER|AWS_SYSMENU|AWS_AUTODRAW|AWS_SIZE|
ÂÃ,  ÂÃ,  ÂÃ,  AWS_MAXIMIZEBOX|AWS_MINIMIZEBOX,
ÂÃ,  ÂÃ,  ÂÃ,  0," Cafe Critique",NULL);

ÂÃ,  winMain.SetWindowColor(GetSysColor(15));
ÂÃ,  Image.m_hwnd = CreateWindowEXA(0,"STATIC","",
ÂÃ,  ÂÃ,  ASS_BITMAP|AWS_CHILD|AWS_VISIBLE|SS_NOTIFY|SS_CENTERIMAGE|SS_SUNKEN,
ÂÃ,  ÂÃ,  30,30,
ÂÃ,  ÂÃ,  170,255,
ÂÃ,  ÂÃ,  winMain.m_hwnd,1,GetModuleHandleA(0),null);

ÂÃ,  Image.SetImage(LoadImageA(GetModuleHandleA(0),"chezp2",0,0,0,0)); //chezp2 = resource ID

ÂÃ,  // message loop
ÂÃ,  do
ÂÃ,  {
ÂÃ,  ÂÃ,  wait();
ÂÃ,  }until winMain.m_run = 0;
ÂÃ,  return 0;
}



(It's just a scrap and won't compile as is.)
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles