May 05, 2024, 01:25:30 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Window background

Started by Rock Ridge Farm (Larry), January 30, 2006, 07:41:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rock Ridge Farm (Larry)

I want to add a background to an Aurora window.
Anyone with an idea on how to do this?

Zen

I dont think there are Aurora functions yet to load and manage graphics. If you take a look at peasleas Skeleton Code example you will see he has loaded and displayed some pictures using the windows API. Its not that hard apart from you have to use the classname.m_hwnd instead of just the class name for specifying windows and dialogs

Lewis

sapero

SetBitmap(path) sets the bitmap as background
Maybe replacing and not resizing m_hBitmap window class member is bad, but it works ;D

class CImageWindow : window
{
declare OnClose(),int;
declare SetBitmap(string *path);
}

global sub main()
{
CImageWindow win;

win.Create(0x80000000,0x80000000,0x80000000,0x80000000,AWS_VISIBLE|AWS_OVERLAPPEDWINDOW|AWS_AUTODRAW,0,"",null);

win.SetWindowColor(0); // image background is black
win.SetBitmap("D:\\IBpro\\temp\\twenty-four-bit.bmp");
win.DrawMode(TRANSPARENT);//text
win.FrontPen(0xFFFFFF);//text
win.SetFont("Arial", 30,100);//text
win.WriteText(100, 300, "yahooo :)");//text

while win.m_hwnd<>0{wait();}
return;
}

import int LoadImage alias LoadImageA(int hInstance,string *lpszName,
int uType,int cxDesired,int cydesired,int fuLoad);

import int DeleteObject(int obj);
import int GetObject alias GetObjectA(int hgdiobj, int cbBuffer, void *lpvObject);

import int BitBlt(int hdcDest,int nXDest,int nYDest,int nWidth,
int nHeight,int hdcSrc,int nXSrc,int nYSrc,int dwRop);

struct BITMAP
{
  int   bmType;
  int   bmWidth;
  int   bmHeight;
  int   bmWidthBytes;
  int   bmPlanes;
  int   bmBitsPixel;
  void *bmBits;
}

CImageWindow :: SetBitmap(string *path)
{
BITMAP bm;
DeleteObject(m_hBitmap);
m_hBitmap = LoadImage(0, path, 0,0,0,16);
GetObject(m_hBitmap, len(BITMAP), bm);
int dc = GetHDC();
BitBlt(dc, 0,0,bm.bmWidth,bm.bmHeight,dc,0,0,0x00CC0020);
ReleaseHDC(dc, true);
return;
}

CImageWindow :: OnClose(),int
{
Destroy();
return true;
}