Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  3 670

•  TDictionary Custom Sort  5 800

•  Fast Watermark Sources  5 603

•  3D Designer  8 218

•  Sik Screen Capture  5 913

•  Patch Maker  6 388

•  Айболит (remote control)  6 378

•  ListBox Drag & Drop  5 237

•  Доска для игры Реверси  94 551

•  Графические эффекты  6 570

•  Рисование по маске  5 644

•  Перетаскивание изображений  4 760

•  Canvas Drawing  5 135

•  Рисование Луны  4 863

•  Поворот изображения  4 411

•  Рисование стержней  3 116

•  Paint on Shape  2 360

•  Генератор кроссвордов  3 228

•  Головоломка Paletto  2 551

•  Теорема Монжа об окружностях  3 328

•  Пазл Numbrix  2 200

•  Заборы и коммивояжеры  2 849

•  Игра HIP  1 820

•  Игра Go (Го)  1 740

•  Симулятор лифта  2 072

•  Программа укладки плитки  1 799

•  Генератор лабиринта  2 241

•  Проверка числового ввода  1 925

•  HEX View  2 226

•  Физический маятник  1 911

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Получить Bitmap радио кнопок



Оформил: DeeCo

{ 
  Diese Funktion liefert ein Bitmap eines RadioButton. 

  Parameter: 
  Checked = RadioButton ausgewahlt 
  Hot = RadioButton aktiv (funktioniert nur unter XP und 
  bewirkt z.B. unter Luna einen hellroten Rand) 
  BgColor = Hintergrundfarbe des RadioButton 

  Wichtig: 
  Die Bitmap sollte nach Ausfuhrung der Funktion wieder freigegeben werden! 
  XP-Styles werden erst ab Delphi7 unterstutzt. 
}


 Code:{$IFDEF VER150}

 uses
   Themes;
 {$ENDIF}

 function GetRadioButtonBitmap(Checked, Hot : boolean; BgColor : TColor): TBitmap;
 const
   CtrlState : array[boolean] of integer = (DFCS_BUTTONRADIO,
     DFCS_BUTTONRADIO or DFCS_CHECKED);
 var
   CBRect : TRect;
   {$IFDEF VER150}
   Details : TThemedElementDetails;
   {$ENDIF}
   BgOld : TColor;
   ChkBmp : TBitmap;
   ThemeOK : boolean;
   x, x2, y : integer;
 begin
   Result := nil;
   try
     Result := TBitmap.Create;
     ChkBmp := TBitmap.Create;
     ThemeOK := False;
     with Result do
     begin
       Width := 16;
       Height := 16;
       with Canvas do
       begin
         Brush.Color := BgColor;
         FillRect(ClipRect);
         ChkBmp.Assign(Result);
         CBRect := ClipRect;
         CBRect.Top := 1;
         CBRect.Left := 1;
         {$IFDEF VER150}
         if ThemeServices.ThemesAvailable then
         begin
           //ab WinXP 
          if Checked = True then
           begin
             if Hot = True then
               Details := ThemeServices.GetElementDetails(tbRadioButtonCheckedHot)
             else
               Details :=
                 ThemeServices.GetElementDetails(tbRadioButtonCheckedNormal);
           end
           else
           begin
             if Hot = True then
               Details :=
                 ThemeServices.GetElementDetails(tbRadioButtonUncheckedHot)
             else
               Details :=
                 ThemeServices.GetElementDetails(tbRadioButtonUncheckedNormal);
           end;
           ThemeServices.DrawElement(Handle, Details, CBRect);
           //Prufen ob es tatsachlich geklappt hat (Win2003 liefert leere Images!) 
          for x := 15 downto 0 do
             for y := 15 downto 0 do
               if ChkBmp.Canvas.Pixels[x, y] <> Pixels[x, y] then
               begin
                 ThemeOK := True;
                 break;
               end;
         end;
         {$ENDIF}
         if ThemeOK = False then
         begin
           //alles vor WinXP 
          CBRect.Left := ClipRect.Left + 2;
           CBRect.Right := ClipRect.Right - 1;
           CBRect.Top := ClipRect.Top + 2;
           CBRect.Bottom := ClipRect.Bottom - 1;
           DrawFrameControl(Handle, CBRect, DFC_BUTTON, CtrlState[Checked]);
         end;
       end;
     end;
   finally
   end;
 end;




Похожие по теме исходники

Bitmap Sharpen Filter

Simple Bitmap Rotation

Bitmap 32Bit Demo

Thread Bitmap (pencil drawings)

 



Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте