![]() |
|
|
|
#1
|
|||
|
|||
|
Code:
Procedure TFrmMain.SBPenClick(Sender: TObject);
Begin
If (Pen = False) Then
Begin
Pen := True;
PenGlyph.LoadFromResourceName(hInstance, 'Pen');
SBPen.Glyph := PenGlyph;
End
Else If (Pen = True) Then
Begin
Pen := False;
PenGlyph.LoadFromResourceName(hInstance, 'NoPen');
SBPen.Glyph := PenGlyph;
End;
End;
These buttons are on an MdiForm with a MdiChild sitting next to them im using for drawing on. |
|
#2
|
|||
|
|||
|
did you take a look at the down property of the speedbutton ?
|
|
#3
|
|||
|
|||
|
i know how to set it down state and up and tht didnt work either nothing does the event proceses but the button won't change state nor glyph like im trying to do.
|
|
#4
|
|||
|
|||
|
Not sure, but Perhaps you'll need to Repaint or Refresh your speedbutton ???
Because now you only load a new icon, but nowhere you paint the icon ... MvG Peter Objective reality is a delirium caused by lack of alcohol in blood. 24 hous in a day, 24 beers in a case. Coincidence ??? |
|
#5
|
|||
|
|||
|
ive tryed tht too.........also ive tryed refresh/repaint and paint the form.
|
|
#6
|
|||
|
|||
|
I dont realy like using the resource to lode glyphs
but thats only becouse I discoverd LMD SE .. LMD SE is free and you can use it in your app is has a very nice bitmaplist with this control I would do somthing like this var bPen : boolean; Procedure TFrmMain.SBPenClick(Sender : TObject); var bitList : TLMDBITMAPLIST; begin bitlist := TLMDBITMAPLIST.CREATE(Self); bitlist.loadfromfile('\<Filelocation>\my.bml'); if bPen then begin bpen := False; SBPen.Glyph.Assign(bitlist.Items[0].Bitmap); end else begin if bPen = False then begin bpen := True; SBPen.Glyph.Assign(bitlist.Items[1].Bitmap); end; end; freeandnil(Bitlist); end; this work for me every time Help is good |
|
#7
|
|||
|
|||
|
thnks for the suggestion but i fixed it sorta :P i hide the control before glyph change and then show it it doesnt flicker or take ages to do it so it's all good dis way
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|