Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pictures on forms
Message
From
20/02/1998 20:50:13
 
 
To
20/02/1998 04:58:52
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00079308
Message ID:
00080246
Views:
38
>Hello,
>
>
>>I have an image in GIF format that I would like to display on a form. When I attach it to an Image control it looks fine in design mode, but as soon as I run the form the colors are completely distorted. The same thing happens if I put the image into
>>a general field in a table and attempt to use an OLEBoundControl to display it. I tried saving the GIF as a BMP and got the same results. Anyone know what could cause this?
>It's a bug in VFP (cannot display properly 256 color pictures) But, AFAIK,
>16 color pictures displays just fine...

Hi, In Active X control, there is a 'Visual Foxpro HWND Control'!!
This control all image type even icons, JPG, GIF, 16M Color BMP!! ^_^"

  1. Select this control in option

  2. Save to Default in option

  3. In Form Designer, Click the 'Book' icon & select 'Active X'

  4. Find the HWND icon, Like a small tick at right bottom corner

  5. Work it as Normal Control such as textbox

  6. To set open image,
    *OleImage.dblclick
    This.Picture=LoadPicture(cFileName)

  7. If you want to set more Flexible on Select Image,
    Add Common Dialog Control in Active X similar to step 1-2.
    For more information on using Common Dialog box to open file, See 'Solution Sample' Active X 'commdlog.scx'

  8. That is, you can assign the return value to cFileName b4 LoadPicture



But there is a problem that VFP HWND Control DO NOT HAVE stretch property. You need to add code to control the width and height after loadpicture
urself! This Time, I really want ppl to write some code here because I fail to
copy my VB Version on stretch the image to a fixed width and height which still maintain the ratio on width and height! ~_~'

My Logic on Stretch was:
+----+        +-------------+
|    |  ==>   |             |
+----+        |   Zoom      |
nh x nw       |             |
actual        |=============|
              |   HNWD      |
              +-------------+
                 Ah x Aw

I want to maintain the shape at Zoom...
So, Ratio will be:
If (nh * Aw /nw) > Ah
   this.height = nh * Aw / nw
   this.width = Aw
else
   this.height = Ah
   this.width = nw * Ah / nh
endif
* but hard to paste this code?? In refresh? In which Events??
If you find solution for stretch... wish can place it at middle of fix size la.
One problem is if the image size is greater than the form...
The above calculation will get wrong ratio and thus wrong output....>_<'
IF really fail on maintain the shape, at least fix it to default Aw and Ah!!
else it will cover other form control such as 'Quit' button... :(

Thanks, Remember Forward a copy to me if found new idea on control it!!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Reply
Map
View

Click here to load this message in the networking platform