Re: customise button appearences

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Tue, 05 Jun 2007 19:17:57 -0700, <Peted> wrote:

im using radio button array with button appearence.

Im just wondering if there is a easy way programtically to enhance the
button look with such things a gradient color fills and effects and
stuff, without having to resort to using bitmaps or images for
backgrounds ? Im mostly interested in adding something like a metalic
gradient effect to the buttons and the form background.

[...]
Incidently is it possible to perhaps use a vector based image format
that can be resized without pixelisation as a button or form
backgorund.

I wish I knew the exact answer to your queston. :)

However, some thoughts on the general idea...

As far as doing something vector-based, it seems to me that you could instead of using a Bitmap, use a Metafile which is essentially a vector-based thing. Or for that matter, I suppose you could override the OnPaint() method and just always draw what you want. As far as drawing the kinds of things you're talking about goes, I have not played with it yet, but I seem to recall a variety of "fancy" drawing commands from GDI+, which I think is supported from .NET.

Also, I haven't had a chance to try to learn about the whole "VisualStyles" stuff, but it sure seems to me that this is exactly what they exist for. To provide alternate visual styles for your controls. I could be wrong, but perhaps if you look into that section of the .NET Framework classes, there will be some guidance as to how to customize the visual style of your control.

and can images and bitmaps be embedded into the application when used
for buttons and forms or must they be located in the local app
directory ?

Well, you can include a bitmap as a resource in the application, which you can then use to create a Bitmap instance using the Bitmap.FromResource() method. It would be a little harder to create a Metafile instance from a resource, but I believe you could do it by storing the metafile saved as a file in the resources as a plain binary resource, then use that to create a MemoryStream, then use that with Metafile.FromStream() to create the metafile instance. If there's some other "image" you're thinking of that you want to store in the application, you should probably elaborate on that. Other than bitmaps and metafiles, the only other thing that comes to mind is icons, and I don't think they are all that applicable here.

Pete
.



Relevant Pages

  • Re: Handwriting
    ... Alternatively you could save as a monochrome bitmap, ... compression for simple line drawings such as signatures). ... but you can't really just "convert a bitmap to a metafile in code". ... "jpg" format if I were you. ...
    (microsoft.public.vb.general.discussion)
  • Re: Different ways for persistent graphics in VB.net
    ... saved as a bitmap and still be printed with fairly good ... MB) for what is effectively a copy of a small 15 x 8 cm drawing. ... As I mentioned in my previous posts I am a VB6 programmer myself and I am ... because VB6 does not have any native metafile functions it is necessary to ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Export data from VB6 to Label Printer
    ... A static gif image is really just a 256 colour bitmap image that has been data compressed. ... For such purposes I would advise using a metafile image. ... The programs that do allow you to save bitmaps as metafiles don't really generate what I would call a true metafile drawing from the bitmap. ... Some kinds of bitmap stretch quite well using PaintPicture or StretchBlt mode 3. ...
    (comp.lang.basic.visual.misc)
  • Re: GDI Bitmap Prob.
    ... The "required resource not found" is a message which should be findable in the MFC source ... >the OnDraw() and Draw the data needed. ... >stretching the bitmap ... >> rendered does not declare a CPaintDC, you first render the bitmap and then ...
    (microsoft.public.vc.mfc)
  • Re: loading bitmap from file at runtime
    ... Try giving the button an owner-drawn style, then, instead of having 4 ... try making one resource bitmap with the 4 buttons ... When you draw the bitmap onto the button, ... > HBITMAP hBitmap; ...
    (microsoft.public.vc.mfc)